Skip to content

Commit d7b43bc

Browse files
Merge pull request #17191 from leslielin-5/patch-38
Update workload-identity.md
2 parents fbff06b + 727f920 commit d7b43bc

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

AKS-Arc/workload-identity.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,9 @@ The following example shows how to use the Azure role-based access control (Azur
274274
1. Assign the RBAC [Key Vault Secrets Officer](/azure/role-based-access-control/built-in-roles/security#key-vault-secrets-officer) role to yourself so that you can create a secret in the new key vault. New role assignments can take up to five minutes to propagate and be updated by the authorization server.
275275

276276
```azurecli
277-
az role assignment create --assignee-object-id $MSIPrincipalId --role "Key Vault Secrets Officer" --scope $KVId --assignee-principal-type ServicePrincipal
277+
$CALLER_OBJECT_ID=$(az ad signed-in-user show --query id -o tsv)
278+
279+
az role assignment create --assignee-object-id $CALLER_OBJECT_ID --role "Key Vault Secrets Officer" --scope $KVId --assignee-principal-type ServicePrincipal
278280
```
279281

280282
1. Create a secret in the key vault:
@@ -286,7 +288,9 @@ The following example shows how to use the Azure role-based access control (Azur
286288
1. Assign the [Key Vault Secrets User](/azure/role-based-access-control/built-in-roles/security#key-vault-secrets-user) role to the user-assigned managed identity that you created previously. This step gives the managed identity permission to read secrets from the key vault:
287289

288290
```azurecli
289-
az role assignment create --assignee-object-id $MSIPrincipalId --role "Key Vault Secrets User" --scope $KVId --assignee-principal-type ServicePrincipal
291+
$IDENTITY_PRINCIPAL_ID=$(az identity show --name "$USER_ASSIGNED_IDENTITY_NAME" --resource-group "$resource_group_name" --query principalId --output tsv)
292+
293+
az role assignment create --assignee-object-id $IDENTITY_PRINCIPAL_ID --role "Key Vault Secrets User" --scope $KVId --assignee-principal-type ServicePrincipal
290294
```
291295

292296
1. Create an environment variable for the key vault URL:

0 commit comments

Comments
 (0)