Skip to content

Commit 63affd3

Browse files
committed
update
1 parent 84d2f3d commit 63affd3

7 files changed

+13
-42
lines changed

articles/key-vault/general/tutorial-net-create-vault-azure-web-app.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -230,12 +230,12 @@ http://<your-webapp-name>.azurewebsites.net
230230
You'll see the "Hello World!" message you saw earlier when you visited `http://localhost:5000`.
231231

232232
For more information about deploying web application using Git, see [Local Git deployment to Azure App Service](../../app-service/deploy-local-git.md)
233-
233+
234234
## Configure the web app to connect to Key Vault
235235

236236
In this section, you'll configure web access to Key Vault and update your application code to retrieve a secret from Key Vault.
237237

238-
### Create and assign a managed identity
238+
### Create and assign access to a managed identity
239239

240240
In this tutorial, we'll use [managed identity](../../active-directory/managed-identities-azure-resources/overview.md) to authenticate to Key Vault. Managed identity automatically manages application credentials.
241241

@@ -255,13 +255,7 @@ The command will return this JSON snippet:
255255
}
256256
```
257257

258-
To give your web app permission to do **get** and **list** operations on your key vault, pass the `principalId` to the Azure CLI [az keyvault set-policy](/cli/azure/keyvault?#az-keyvault-set-policy) command:
259-
260-
```azurecli-interactive
261-
az keyvault set-policy --name "<your-keyvault-name>" --object-id "<principalId>" --secret-permissions get list
262-
```
263-
264-
You can also assign access policies by using the [Azure portal](./assign-access-policy-portal.md) or [PowerShell](./assign-access-policy-powershell.md).
258+
[!INCLUDE [Using RBAC to provide access to a key vault](../../../includes/key-vault-quickstart-rbac.md)]
265259

266260
### Modify the app to access your key vault
267261

articles/key-vault/general/tutorial-net-virtual-machine.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -111,18 +111,8 @@ xxxxxxxx-xx-xxxxxx xxxxxxxx-xxxx-xxxx SystemAssigned
111111
---
112112

113113
## Assign permissions to the VM identity
114-
Assign the previously created identity permissions to your key vault with the [az keyvault set-policy](/cli/azure/keyvault#az-keyvault-set-policy) command:
115114

116-
# [Azure CLI](#tab/azure-cli)
117-
```azurecli
118-
az keyvault set-policy --name '<your-unique-key-vault-name>' --object-id <VMSystemAssignedIdentity> --secret-permissions get list set delete
119-
```
120-
# [Azure PowerShell](#tab/azurepowershell)
121-
122-
```azurepowershell
123-
Set-AzKeyVaultAccessPolicy -ResourceGroupName <YourResourceGroupName> -VaultName '<your-unique-key-vault-name>' -ObjectId '<VMSystemAssignedIdentity>' -PermissionsToSecrets get,list,set,delete
124-
```
125-
---
115+
[!INCLUDE [Using RBAC to provide access to a key vault](../../../includes/key-vault-quickstart-rbac.md)]
126116

127117
## Sign in to the virtual machine
128118

articles/key-vault/general/tutorial-python-virtual-machine.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,7 @@ Note the system-assigned identity that's displayed in the following code. The ou
9494

9595
## Assign permissions to the VM identity
9696

97-
Now you can assign the previously created identity permissions to your key vault by running the following command:
98-
99-
```azurecli
100-
az keyvault set-policy --name "<your-unique-keyvault-name>" --object-id "<systemAssignedIdentity>" --secret-permissions get list
101-
```
97+
[!INCLUDE [Using RBAC to provide access to a key vault](../../../includes/key-vault-quickstart-rbac.md)]
10298

10399
## Log in to the VM
104100

articles/key-vault/secrets/quick-create-net.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ This quickstart is using Azure Identity library with Azure PowerShell to authent
7979
### Grant access to your key vault
8080
8181
[!INCLUDE [Using RBAC to provide access to a key vault](../../../includes/key-vault-quickstart-rbac.md)]
82+
8283
---
8384
8485
### Create new .NET console app

includes/key-vault-quickstart-rbac-cli.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ ms.author: msmbaldwin
99

1010
---
1111

12-
To grant your user account permissions to your key vault through Role-Based Access Control (RBAC), assign a role using the Azure CLI command [az role assignment create](/cli/azure/role/assignment#az-role-assignment-create).
12+
To grant your application permissions to your key vault through Role-Based Access Control (RBAC), assign a role using the Azure CLI command [az role assignment create](/cli/azure/role/assignment#az-role-assignment-create).
1313

1414
```azurecli
15-
az role assignment create --role "Key Vault Secrets User" --assignee "<your-email-address>" --scope "/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.KeyVault/vaults/<your-unique-keyvault-name>"
15+
az role assignment create --role "Key Vault Secrets User" --assignee "<app-id>" --scope "/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.KeyVault/vaults/<your-unique-keyvault-name>"
1616
```
1717

18-
Replace \<your-email-address\>, \<subscription-id\>, \<resource-group-name\> and \<your-unique-keyvault-name\> with your actual values. \<your-email-address\> is your sign-in name.
18+
Replace \<app-id\>, \<subscription-id\>, \<resource-group-name\> and \<your-unique-keyvault-name\> with your actual values. \<app-id\> is the Application (client) ID of your registered application in Azure AD.

includes/key-vault-quickstart-rbac-powershell.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ms.author: msmbaldwin
1212
To grant your application permissions to your key vault through Role-Based Access Control (RBAC), assign a role using the Azure PowerShell cmdlet [New-AzRoleAssignment](/powershell/module/az.resources/new-azroleassignment).
1313

1414
```azurepowershell
15-
New-AzRoleAssignment -RoleDefinitionName "Key Vault Secrets User" -SignInName "<your-email-address>" -Scope "/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.KeyVault/vaults/<your-unique-keyvault-name>"
15+
New-AzRoleAssignment -ObjectId "<app-id>" -RoleDefinitionName "Key Vault Secrets User" -Scope "/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.KeyVault/vaults/<your-unique-keyvault-name>"
1616
```
1717

18-
Replace \<your-email-address\>, \<subscription-id\>, \<resource-group-name\> and \<your-unique-keyvault-name\> with your actual values. \<your-email-address\> is your sign-in name; you can instead use the `-ObjectId` parameter and a Microsoft Entra Object ID.
18+
Replace \<app-id\>, \<subscription-id\>, \<resource-group-name\> and \<your-unique-keyvault-name\> with your actual values. \<app-id\> is the Application (client) ID of your registered application in Azure AD.

includes/key-vault-quickstart-rbac.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,10 @@ ms.author: msmbaldwin
1111

1212
### [Azure CLI](#tab/azure-cli)
1313

14-
To grant your application permissions to your key vault through Role-Based Access Control (RBAC), assign a role using the Azure CLI command [az role assignment create](/cli/azure/role/assignment#az-role-assignment-create).
15-
16-
```azurecli
17-
az role assignment create --role "Key Vault Secrets User" --assignee "<app-id>" --scope "/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.KeyVault/vaults/<your-unique-keyvault-name>"
18-
```
14+
[!INCLUDE [Using RBAC to provide access to a key vault - CLI](./key-vault-quickstart-rbac-cli.md)]
1915

2016
### [Azure PowerShell](#tab/azure-powershell)
2117

22-
To grant your application permissions to your key vault through Role-Based Access Control (RBAC), assign a role using the Azure PowerShell cmdlet [New-AzRoleAssignment](/powershell/module/az.resources/new-azroleassignment).
23-
24-
```azurepowershell
25-
New-AzRoleAssignment -ObjectId "<app-id>" -RoleDefinitionName "Key Vault Secrets User" -Scope "/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.KeyVault/vaults/<your-unique-keyvault-name>"
26-
```
18+
[!INCLUDE [Using RBAC to provide access to a key vault - PowerShell](./key-vault-quickstart-rbac-powershell.md)]
2719

2820
---
29-
30-
Replace \<app-id\>, \<subscription-id\>, \<resource-group-name\> and \<your-unique-keyvault-name\> with your actual values. \<app-id\> is the Application (client) ID of your registered application in Azure AD.

0 commit comments

Comments
 (0)