You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/mysql/flexible-server/how-to-azure-ad.md
+67-4Lines changed: 67 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,10 +55,6 @@ To create an Azure AD Admin user, follow the following steps.
55
55
-[GroupMember.Read.All](/graph/permissions-reference#group-permissions): Allows access to Azure AD group information.
56
56
-[Application.Read.ALL](/graph/permissions-reference#application-resource-permissions): Allows access to Azure AD service principal (application) information.
57
57
58
-
For guidance about how to grant and use the permissions, refer to [Overview of Microsoft Graph permissions](/graph/permissions-overview)
59
-
60
-
After you grant the permissions to the UMI, they're enabled for all servers or instances created with the UMI assigned as a server identity.
61
-
62
58
> [!IMPORTANT]
63
59
> Only a [Global Administrator](../../active-directory/roles/permissions-reference.md#global-administrator) or [Privileged Role Administrator](../../active-directory/roles/permissions-reference.md#privileged-role-administrator) can grant these permissions.
64
60
@@ -67,6 +63,73 @@ After you grant the permissions to the UMI, they're enabled for all servers or i
67
63
> [!NOTE]
68
64
> Only one Azure AD admin can be created per MySQL server, and selecting another overwrites the existing Azure AD admin configured for the server.
69
65
66
+
### Grant permissions to User assigned managed identity
67
+
68
+
The following sample PowerShell script grants the necessary permissions for a UMI. This sample assigns permissions to the UMI `umiservertest`.
69
+
70
+
To run the script, you must sign in as a user with a Global Administrator or Privileged Role Administrator role.
71
+
72
+
The script grants the `User.Read.All`, `GroupMember.Read.All`, and `Application.Read.ALL` permissions to a UMI to access [Microsoft Graph](/graph/auth/auth-concepts#microsoft-graph-permissions).
73
+
74
+
```powershell
75
+
# Script to assign permissions to the UMI "umiservertest"
76
+
77
+
import-module AzureAD
78
+
$tenantId = '<tenantId>' # Your Azure AD tenant ID
79
+
80
+
Connect-AzureAD -TenantID $tenantId
81
+
# Log in as a user with a "Global Administrator" or "Privileged Role Administrator" role
82
+
# Script to assign permissions to an existing UMI
83
+
# The following Microsoft Graph permissions are required:
Write-Output "More than 1 principal found, please find your principal and copy the right object ID. Now use the syntax $MSI = Get-AzureADServicePrincipal -ObjectId <your_object_id>"
105
+
106
+
# Choose the right UMI
107
+
108
+
Exit
109
+
}
110
+
111
+
# If you have more UMIs with similar names, you have to use the proper $MSI[ ]array number
In the final steps of the script, if you have more UMIs with similar names, you have to use the proper `$MSI[ ]array` number. An example is `$AAD_SP.ObjectId[0]`.
124
+
125
+
### Check permissions for user-assigned managed identity
126
+
127
+
To check permissions for a UMI, go to the [Azure portal](https://portal.azure.com). In the **Azure Active Directory** resource, go to **Enterprise applications**. Select **All Applications** for **Application type**, and search for the UMI that was created.
128
+
129
+
Select the UMI, and go to the **Permissions** settings under **Security**.
130
+
131
+
After you grant the permissions to the UMI, they're enabled for all servers created with the UMI assigned as a server identity.
132
+
70
133
## Connect to Azure Database for MySQL flexible server using Azure AD
0 commit comments