|
1 | 1 | --- |
2 | 2 | title: Managed Identity |
3 | | -description: Describes the features and implementation to use managed identity with SQL Server |
| 3 | +description: Learn how to use a managed identity with SQL Server 2025. |
4 | 4 | author: PratimDasgupta |
5 | 5 | ms.author: prdasgu |
6 | 6 | ms.reviewer: mikeray, randolphwest, mathoma, vanto |
7 | | -ms.date: 05/19/2025 |
| 7 | +ms.date: 05/23/2025 |
8 | 8 | ms.service: sql |
9 | 9 | ms.topic: how-to |
10 | 10 | # CustomerIntent: As a database engineer I need to understand how to implement managed identity with SQL Server 2025. |
@@ -32,7 +32,7 @@ When using managed identity with SQL Server enabled by Azure Arc, consider the f |
32 | 32 | - Only system-assigned managed identities are supported. |
33 | 33 | - SQL Server uses this Azure Arc server level managed identity as the **primary managed identity**. |
34 | 34 | - SQL Server can use this primary managed identity in either `inbound` and/or `outbound` connections. |
35 | | - - `Inbound connections` are Logins and Users connecting to SQL Server. Inbound connections can also be achieved by using [App Registration available from SQL Server 2022](../../sql-server/azure-arc/entra-authentication-setup-tutorial.md). |
| 35 | + - `Inbound connections` are logins and users connecting to SQL Server. Inbound connections can also be achieved by using [App Registration available from SQL Server 2022](../../sql-server/azure-arc/entra-authentication-setup-tutorial.md). |
36 | 36 | - `Outbound connections` are SQL Server connections to Azure resources, like backup to URL, or connecting to Azure Key Vault. |
37 | 37 | - App Registration **can't** enable a SQL Server to make outbound connections. Outbound connections need a primary managed identity assigned to the SQL Server. |
38 | 38 |
|
@@ -153,9 +153,49 @@ If you need to restore to previous registry settings, follow these steps. |
153 | 153 |
|
154 | 154 | For details, review [How to add, modify, or delete registry subkeys and values by using a .reg file](https://support.microsoft.com/topic/how-to-add-modify-or-delete-registry-subkeys-and-values-by-using-a-reg-file-9c7f37cf-a5e9-e1cd-c4fa-2a26218a1a23). |
155 | 155 |
|
| 156 | +## Grant application permissions to the identity |
| 157 | + |
| 158 | +The system-assigned managed identity, which uses the Arc-enabled machine name, must have the following Microsoft Graph application permissions (app roles): `User.Read.All`, `GroupMember.Read.All`, and `Application.Read.All`. |
| 159 | + |
| 160 | +You can use PowerShell to grant required permissions to the managed identity. Alternatively, you can [create a role-assignable group](/entra/identity/role-based-access-control/groups-create-eligible). After the group is created, assign the **Directory readers** role to the group, and add all system-assigned managed identities for your Arc-enabled machines to the group. |
| 161 | + |
| 162 | +The following PowerShell script grants the required permissions to the managed identity: |
| 163 | + |
| 164 | +```powershell |
| 165 | +Install-Module AzureAD |
| 166 | +Connect-AzureAD -TenantId <ENTER-YOUR-TENANT-ID> |
| 167 | +$api = Get-AzureADServicePrincipal -Filter "appId eq '00000003-0000-0000-c000-000000000000'" # Microsoft Graph API |
| 168 | + |
| 169 | +$AAD_AppRole = $api.AppRoles | Where-Object { $_.Value -eq “User.Read.All" } |
| 170 | +$managedIdentity = Get-AzureADServicePrincipal -SearchString "<Arc-Machine-Name>" |
| 171 | +New-AzureADServiceAppRoleAssignment -ObjectId $managedIdentity[0].ObjectId -PrincipalId $managedIdentity[0].ObjectId -ResourceId $api.ObjectId -Id $AAD_AppRole.Id |
| 172 | +
|
| 173 | +$AAD_AppRole = $api.AppRoles | Where-Object { $_.Value -eq “Groupmember.Read.All" } |
| 174 | +$managedIdentity = Get-AzureADServicePrincipal -SearchString "<Arc-Machine-Name>" |
| 175 | +New-AzureADServiceAppRoleAssignment -ObjectId $managedIdentity[0].ObjectId -PrincipalId $managedIdentity[0].ObjectId -ResourceId $api.ObjectId -Id $AAD_AppRole.Id |
| 176 | +
|
| 177 | +$AAD_AppRole = $api.AppRoles | Where-Object { $_.Value -eq “Application.Read.All" } |
| 178 | +$managedIdentity = Get-AzureADServicePrincipal -SearchString "<Arc-Machine-Name>" |
| 179 | +New-AzureADServiceAppRoleAssignment -ObjectId $managedIdentity[0].ObjectId -PrincipalId $managedIdentity[0].ObjectId -ResourceId $api.ObjectId -Id $AAD_AppRole.Id |
| 180 | +
|
| 181 | +``` |
| 182 | + |
| 183 | +## Create logins and users |
| 184 | + |
| 185 | +Follow the steps in the [Microsoft Entra tutorial](../../sql-server/azure-arc/entra-authentication-setup-tutorial.md#create-logins-and-users) to create logins and users for the managed identity. |
| 186 | + |
| 187 | +## Limitations |
| 188 | + |
| 189 | +Consider the following limitations when using a managed identity with SQL Server 2025: |
| 190 | + |
| 191 | +- Microsoft Entra authentication is only supported with Arc enabled SQL Server 2025 running on Windows Server. |
| 192 | +- Using Microsoft Entra authentication with failover cluster instances is not supported. |
| 193 | +- The identity you choose to authenticate to SQL Server has to have either the **Directory Readers** role in Microsoft Entra ID or the following three Microsoft Graph application permissions (app roles): `User.Read.All`, `GroupMember.Read.All`, and `Application.Read.All`. |
| 194 | +- Once Microsoft Entra authentication is enabled, disabling isn't advisable. Disabling Microsoft Entra authentication forcefully by deleting registry entries can result in unpredictable behavior with SQL Server 2025. |
| 195 | +- Authenticating to SQL Server on Arc machines through Microsoft Entra authentication using the [FIDO2 method](/azure/active-directory/authentication/howto-authentication-passwordless-faqs) isn't currently supported. |
156 | 196 |
|
157 | 197 | ## Related content |
158 | 198 |
|
159 | 199 | - [Microsoft Entra authentication for SQL Server](../../relational-databases/security/authentication-access/azure-ad-authentication-sql-server-overview.md) |
160 | 200 | - [What are managed identities for Azure resources?](/entra/identity/managed-identities-azure-resources/overview) |
161 | | -- [Enable Microsoft Entra authentication - SQL Server on Azure VMs](/azure/azure-sql/virtual-machines/windows/configure-azure-ad-authentication-for-sql-vm) |
| 201 | +- [Enable Microsoft Entra authentication - SQL Server on Azure VMs](/azure/azure-sql/virtual-machines/windows/configure-azure-ad-authentication-for-sql-vm) |
0 commit comments