Skip to content

Commit 0892a62

Browse files
committed
command links
1 parent 685b14a commit 0892a62

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

docs/azure/sdk/authentication/user-assigned-managed-identity.md

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ User-assigned identities are created as standalone resources in your Azure subsc
4141

4242
Azure CLI commands can be run in the [Azure Cloud Shell](https://shell.azure.com) or on a workstation with the [Azure CLI installed](/cli/azure/install-azure-cli).
4343

44-
Use the Azure CLI command `az identity create` to create a managed identity for an Azure resource:
44+
Use the Azure CLI command [`az identity create`](/cli/azure/identity?view=azure-cli-latest#az-identity-create) to create a managed identity for an Azure resource:
4545

4646
```azurecli
4747
az identity create --resource-group <resource-group-name> --name <identity-name>
@@ -59,7 +59,7 @@ The command output prints the following values:
5959

6060
## Assign the managed identity to your app
6161

62-
A user-assigned can be associated with one or more Azure resources. All of the resources that use that identity will gain the permissions applied through the identity's roles.
62+
A user-assigned can be associated with one or more Azure resources. All of the resources that use that identity gain the permissions applied through the identity's roles.
6363

6464
### [Azure portal](#tab/azure-portal)
6565

@@ -87,22 +87,31 @@ az identity show -n cli-identity -g aitesting -o json --query id
8787

8888
Once you have the resource ID, use the Azure CLI command `az <resourceType> identity assign` command to associate the user-assigned identity with different resources, such as the following:
8989

90-
For Azure App Service, use the Azure CLI command `azd webapp identity assign`:
90+
For Azure App Service, use the Azure CLI command [`az webapp identity assign`](/cli/azure/webapp/identity?view=azure-cli-latest#az-webapp-identity-assign):
9191

9292
```azurecli
93-
az webapp identity assign --resource-group <resource-group-name> --name <webapp-name> --identities <user-assigned-identity-resource-id>
93+
az webapp identity assign \
94+
--resource-group <resource-group-name> \
95+
--name <webapp-name> \
96+
--identities <user-assigned-identity-resource-id>
9497
```
9598

96-
For Azure Container Apps, use the Azure CLI command `az containerapp identity assign`:
99+
For Azure Container Apps, use the Azure CLI command [`az containerapp identity assign`](/cli/azure/containerapp/identity?view=azure-cli-latest#az-containerapp-identity-assign):
97100

98101
```azurecli
99-
az webapp identity assign --resource-group <resource-group-name> --name <webapp-name> --identities <user-assigned-identity-resource-id>
102+
az webapp identity assign \
103+
--resource-group <resource-group-name> \
104+
--name <webapp-name> \
105+
--identities <user-assigned-identity-resource-id>
100106
```
101107

102-
For Azure Container Apps, use the Azure CLI command `az containerapp identity assign`:
108+
For Azure Container Apps, use the Azure CLI command [`az vm identity assign`](/cli/azure/vm/identity?view=azure-cli-latest#az-vm-identity-assign):
103109

104110
```azurecli
105-
az vm identity assign --resource-group <resource-group-name> --name <webapp-name> --identities <user-assigned-identity-resource-id>
111+
az vm identity assign \
112+
--resource-group <resource-group-name> \
113+
--name <webapp-name> \
114+
--identities <user-assigned-identity-resource-id>
106115
```
107116

108117
---
@@ -142,16 +151,19 @@ The following example shows how to assign roles at the resource group scope, sin
142151
To assign a user-assigned identity to an Azure App Service web app using the Azure CLI, you'll need the principal ID of the identity. Use the `az identity show` command to retrieve the resource ID:
143152

144153
```dotnetcli
145-
az identity show -n cli-identity -g aitesting -o json --query id
154+
az identity show \
155+
--resource-group <your-resource-group> \
156+
--name <your-managed-identity-name> \
157+
-o json --query principalId
146158
```
147159

148160
Assign a role to a managed identity using the [az role assignment create](/cli/azure/role/assignment#az-role-assignment-create) command:
149161

150162
```azurecli
151163
az role assignment create \
152-
--assignee "{principalId}" \
153-
--role "{roleName}" \
154-
--scope "{scope}"
164+
--assignee <your-principal-id> \
165+
--role <role-name> \
166+
--scope <scope>
155167
```
156168

157169
To get the role names to which a service principal can be assigned, use the [az role definition list](/cli/azure/role/definition#az-role-definition-list) command:

0 commit comments

Comments
 (0)