Skip to content

Commit 3884a49

Browse files
Add SQL Server 2022+ on Azure VM to Entra guest users article (#36592)
* docs: Add SQL Server 2022+ on Azure VM to Entra guest users article * Document guest user creation and admin setup in SQL Server Added steps for creating a guest user in SQL Server and setting them as a server admin. * docs: Restructure SQL Server guest user section and fix style issues * docs: Refactor guest user sections to tabbed layout * docs: Fix broken bookmark to guest user heading --------- Co-authored-by: Pratim Dasgupta <111895613+PratimDasgupta@users.noreply.github.com>
1 parent 1c05869 commit 3884a49

2 files changed

Lines changed: 74 additions & 6 deletions

File tree

azure-sql/database/authentication-aad-guest-users.md

Lines changed: 73 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: How to create Microsoft Entra guest users and set them as Microsoft
55
author: VanMSFT
66
ms.author: vanto
77
ms.reviewer: wiassaf, vanto, mathoma, randolphwest
8-
ms.date: 06/10/2025
8+
ms.date: 02/23/2026
99
ms.service: azure-sql
1010
ms.subservice: security
1111
ms.topic: how-to
@@ -15,7 +15,10 @@ monikerRange: "=azuresql || =azuresql-db || =azuresql-mi"
1515
---
1616
# Create Microsoft Entra guest users and set them as a Microsoft Entra admin
1717

18-
[!INCLUDE [appliesto-sqldb-sqlmi](../includes/appliesto-sqldb-sqlmi.md)]
18+
[!INCLUDE [appliesto-sqldb-sqlmi-sqlvm](../includes/appliesto-sqldb-sqlmi-sqlvm.md)]
19+
20+
> [!NOTE]
21+
> This feature applies to SQL Server 2022 and later on Azure Virtual Machines and Arc enabled SQL Server.
1922
2023
[Guest users](/entra/external-id/user-properties) with Microsoft Entra B2B collaboration are users that have accounts in an external Microsoft Entra organization or an external identity provider (for example, Outlook, Windows Live Mail, or Gmail), which isn't managed within your Microsoft Entra tenant. Guest user accounts are created when those individuals are invited to collaborate within your tenant, while still performing authentication against their identity provider.
2124

@@ -35,7 +38,7 @@ Azure SQL Database, SQL Managed Instance, and Azure Synapse Analytics support cr
3538

3639
Follow these steps to create a database user using a Microsoft Entra guest user. In this section, replace `<guest_user>` with a valid email address, for example `guest_user@example.com`.
3740

38-
### Create guest user in SQL Database and Azure Synapse
41+
### [SQL Database and Azure Synapse](#tab/sql-database)
3942

4043
1. Ensure that the guest user is already added into your Microsoft Entra ID and a Microsoft Entra admin has been set for the database server. Having a Microsoft Entra admin is required for Microsoft Entra authentication.
4144

@@ -55,10 +58,10 @@ Follow these steps to create a database user using a Microsoft Entra guest user.
5558

5659
1. Disconnect and sign into the database as the guest user using [SQL Server Management Studio (SSMS)](/ssms/sql-server-management-studio-ssms) using the authentication method **Azure Active Directory - Universal with MFA**. For more information, see [Using Microsoft Entra multifactor authentication](authentication-mfa-ssms-overview.md).
5760

58-
### Create guest user in SQL Managed Instance
61+
### [SQL Managed Instance](#tab/sql-managed-instance)
5962

6063
> [!NOTE]
61-
> SQL Managed Instance supports logins for Microsoft Entra users, as well as Microsoft Entra ID contained database users. The following steps show how to create a login and user for a Microsoft Entra guest user in SQL Managed Instance. You can also choose to create a [contained database user](/sql/relational-databases/security/contained-database-users-making-your-database-portable) in SQL Managed Instance by using the method in the [Create guest user in SQL Database and Azure Synapse](#create-guest-user-in-sql-database-and-azure-synapse) section.
64+
> SQL Managed Instance supports logins for Microsoft Entra users, as well as Microsoft Entra ID contained database users. The following steps show how to create a login and user for a Microsoft Entra guest user in SQL Managed Instance. You can also choose to create a [contained database user](/sql/relational-databases/security/contained-database-users-making-your-database-portable) in SQL Managed Instance by using the method in the **SQL Database and Azure Synapse** tab.
6265
6366
1. Ensure that the guest user is already added into your Microsoft Entra tenant and a Microsoft Entra admin has been set for the SQL Managed Instance. Having a Microsoft Entra admin is required for Microsoft Entra authentication.
6467

@@ -86,6 +89,69 @@ Follow these steps to create a database user using a Microsoft Entra guest user.
8689

8790
1. Disconnect and sign into the database as the guest user using [SQL Server Management Studio (SSMS)](/ssms/sql-server-management-studio-ssms) using the authentication method **Azure Active Directory - Universal with MFA**. For more information, see [Using Microsoft Entra multifactor authentication](authentication-mfa-ssms-overview.md).
8891

92+
### [SQL Server](#tab/sql-server)
93+
94+
> [!NOTE]
95+
> Use this section after Microsoft Entra authentication is enabled for your SQL Server on Azure VMs or Arc-enabled SQL Server.
96+
97+
1. Verify that Microsoft Entra authentication is enabled for the SQL Server.
98+
99+
1. Make sure the guest user is already added to your Microsoft Entra tenant.
100+
101+
1. Verify that the managed identity selected for enabling Microsoft Entra authentication has either the **Directory Readers** role or these Microsoft Graph app roles: **User.Read.All**, **GroupMember.Read.All**, and **Application.Read.All**.
102+
103+
1. Connect to the SQL Server instance as a Microsoft Entra admin (sysadmin).
104+
105+
1. Create the guest user using one of the following options:
106+
107+
**Option A: Create a login first (server principal), then create a database user from that login**
108+
109+
```sql
110+
-- Run in master
111+
CREATE LOGIN [<guest_user>] FROM EXTERNAL PROVIDER;
112+
GO
113+
```
114+
115+
```sql
116+
-- Run in the target user database
117+
CREATE USER [<guest_user>] FROM LOGIN [<guest_user>];
118+
GO
119+
```
120+
121+
**Option B: Create a contained database user (no server login)**
122+
123+
```sql
124+
-- Run in the target user database
125+
CREATE USER [<guest_user>] FROM EXTERNAL PROVIDER;
126+
GO
127+
```
128+
129+
#### Set a guest user as a server admin
130+
131+
In this section, replace `<guest_user>` with a valid email address, for example `guest_user@example.com`.
132+
133+
```sql
134+
USE [master];
135+
GO
136+
```
137+
138+
```sql
139+
-- Create the Microsoft Entra login for the guest user
140+
CREATE LOGIN [<guest_user>] FROM EXTERNAL PROVIDER;
141+
GO
142+
```
143+
144+
```sql
145+
-- Grant full server admin rights
146+
ALTER SERVER ROLE [sysadmin] ADD MEMBER [<guest_user>];
147+
GO
148+
```
149+
150+
> [!NOTE]
151+
> If you want guest users to be able to create other Microsoft Entra logins or users, they must have permissions to read other identities in the Microsoft Entra directory. This permission is configured at the directory-level. For more information, see [guest access permissions in Microsoft Entra ID](/entra/identity/users/users-restrict-guest-permissions).
152+
153+
---
154+
89155
## Set a guest user as a Microsoft Entra admin
90156

91157
Set the Microsoft Entra admin using either the Azure portal, Azure PowerShell, or the Azure CLI. In this section, replace `<guest_user>` with a valid email address, for example `guest_user@example.com`.
@@ -149,3 +215,5 @@ You can also use the Azure CLI command [az sql mi ad-admin](/cli/azure/sql/mi/ad
149215
- [Configure and manage Microsoft Entra authentication with Azure SQL](authentication-aad-configure.md)
150216
- [Using Microsoft Entra multifactor authentication](authentication-mfa-ssms-overview.md)
151217
- [CREATE USER (Transact-SQL)](/sql/t-sql/statements/create-user-transact-sql)
218+
- [Microsoft Entra authentication for Arc-enabled SQL Server](/sql/sql-server/azure-arc/microsoft-entra-authentication-with-managed-identity)
219+
- [Configure Microsoft Entra authentication for SQL Server on Azure VMs](/azure/azure-sql/virtual-machines/windows/configure-azure-ad-authentication-for-sql-vm)

azure-sql/database/authentication-aad-overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ To get started, review [Configure Microsoft Entra multifactor authentication](au
206206

207207
## Microsoft Entra B2B support
208208

209-
Microsoft Entra authentication in all SQL products also supports [Microsoft Entra B2B collaboration](/entra/external-id/what-is-b2b), which enables businesses to invite guest users to collaborate with their organization. Guest users can connect to databases either as individual users or members of a Microsoft Entra group. For more information, see [Create guest user](authentication-aad-guest-users.md#create-guest-user-in-sql-database-and-azure-synapse).
209+
Microsoft Entra authentication in all SQL products also supports [Microsoft Entra B2B collaboration](/entra/external-id/what-is-b2b), which enables businesses to invite guest users to collaborate with their organization. Guest users can connect to databases either as individual users or members of a Microsoft Entra group. For more information, see [Create database user for Microsoft Entra guest user](authentication-aad-guest-users.md#create-database-user-for-microsoft-entra-guest-user).
210210

211211
## Trust architecture for Microsoft Entra federation to Active Directory
212212

0 commit comments

Comments
 (0)