Skip to content

Commit a9a8ffa

Browse files
committed
new instructions
1 parent 7ba4d1f commit a9a8ffa

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

articles/app-service/tutorial-connect-msi-sql-database.md

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,34 +48,48 @@ For guidance about using Azure Database for MySQL or Azure Database for PostgreS
4848

4949
- Allow client connection from your computer to Azure, so you can debug your app. You can add the client IP address by following the steps at [Manage server-level IP firewall rules using the Azure portal](/azure/azure-sql/database/firewall-configure#use-the-azure-portal-to-manage-server-level-ip-firewall-rules).
5050

51-
- Use Azure Cloud Shell or prepare your environment to use the Azure CLI.
51+
- Sign in to Azure Cloud Shell or prepare your environment to use the Azure CLI.
5252
[!INCLUDE [azure-cli-prepare-your-environment-no-header.md](~/reusable-content/azure-cli/azure-cli-prepare-your-environment-no-header.md)]
5353

5454
<a name='1-grant-database-access-to-azure-ad-user'></a>
5555
## Grant admin access to a Microsoft Entra user
5656

57-
First, enable Microsoft Entra authentication to SQL Database by assigning a Microsoft Entra user as the admin of the server. This user might not be the same as the Microsoft account user for your Azure subscription.
57+
Enable Microsoft Entra authentication to SQL Database by assigning a Microsoft Entra user as the admin of the Azure SQL server. This user might not be the same as the Microsoft account user for your Azure subscription. The Microsoft Entra admin must be a user that is created, imported, synced, or invited into Microsoft Entra ID.
5858

59-
The Microsoft Entra admin must be a user that is created, imported, synced, or invited into Microsoft Entra ID. If your Microsoft Entra tenant doesn't have a user yet, create one by following the steps at [Add or delete users using Microsoft Entra ID](/entra/fundamentals/how-to-create-delete-users).
60-
61-
- For more information on allowed Microsoft Entra users, see [Microsoft Entra features and limitations in SQL Database](/azure/azure-sql/database/authentication-aad-overview#limitations).
59+
- For more information on creating a Microsoft Entra user, see [Add or delete users using Microsoft Entra ID](/entra/fundamentals/how-to-create-delete-users).
60+
- For more information on allowed Microsoft Entra users for SQL Database, see [Microsoft Entra features and limitations in SQL Database](/azure/azure-sql/database/authentication-aad-overview#limitations).
6261
- For more information on adding an Azure SQL server admin, see [Provision a Microsoft Entra administrator for your server](/azure/azure-sql/database/authentication-aad-configure#provision-azure-ad-admin-sql-managed-instance).
6362

6463
Run the following commands in the Bash environment of Azure Cloud Shell, or after signing in to Azure locally.
6564

66-
1. Use [`az ad user list`](/cli/azure/ad/user#az-ad-user-list) to find the `userPrincipalName` of the Microsoft Entra user, and use it to replace `<user-principal-name>` in the following code. The code saves the result of the query on `<user-principal-name>` to a variable called `azureaduser`.
65+
1. Use [`az ad user list`](/cli/azure/ad/user#az-ad-user-list) with the `display-name`, `filter`, or `upn` parameter to get the object ID for the Microsoft Entra ID user. Run `az ad user list` standalone to show information for all the users in the Microsoft Entra directory.
66+
67+
For example, the following command lists information for a Microsoft Entra ID user with the `display-name` of Firstname Lastname.
6768

6869
```azurecli
69-
azureaduser=$(az ad user list --filter "userPrincipalName eq '<user-principal-name>'" --query '[].id' --output tsv)
70+
az ad user list --display-name "Firstname Lastname"
7071
```
7172

72-
> [!TIP]
73-
> To see the list of all user principal names in Microsoft Entra ID, run `az ad user list --query '[].userPrincipalName'`.
73+
Here's example output:
74+
75+
```output
76+
"businessPhones": [],
77+
"displayName": "Firstname Lastname",
78+
"givenName": null,
79+
"id": "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb",
80+
"jobTitle": null,
81+
"mail": "[email protected]",
82+
"mobilePhone": null,
83+
"officeLocation": null,
84+
"preferredLanguage": null,
85+
"surname": null,
86+
"userPrincipalName": "[email protected]"
87+
```
7488

75-
1. Add `$azureaduser` as an Azure SQL server admin by using [`az sql server ad-admin create`](/cli/azure/sql/server/ad-admin#az-sql-server-ad-admin-create), replacing `<server-name>` with your server name without the `.database.windows.net` suffix.
89+
1. Add the Microsoft Entra ID user `id` as an admin on the Azure SQL server by using [`az sql server ad-admin create`](/cli/azure/sql/server/ad-admin#az-sql-server-ad-admin-create). In the following command, replace `<server-name>` with your server name without the `.database.windows.net` suffix, and `<entra-id>` with the `id` value from the preceding `az ad user list` command.
7690

7791
```azurecli
78-
az sql server ad-admin create --resource-group myResourceGroup --server-name <server-name> --display-name ADMIN --object-id $azureaduser
92+
az sql server ad-admin create --resource-group myResourceGroup --server-name <server-name> --display-name ADMIN --object-id <entra-id>
7993
```
8094

8195
## Set up your development environment

0 commit comments

Comments
 (0)