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/key-vault/certificates/quick-create-node.md
+1-7Lines changed: 1 addition & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -66,10 +66,8 @@ Create a Node.js application that uses your key vault.
66
66
npm init -y
67
67
```
68
68
69
-
70
69
## Install Key Vault packages
71
70
72
-
73
71
1. Using the terminal, install the Azure Key Vault secrets library, [@azure/keyvault-certificates](https://www.npmjs.com/package/@azure/keyvault-certificates) for Node.js.
74
72
75
73
```terminal
@@ -84,11 +82,7 @@ Create a Node.js application that uses your key vault.
84
82
85
83
## Grant access to your key vault
86
84
87
-
Create a vault access policy for your key vault that grants key permissions to your user account.
88
-
89
-
```azurecli
90
-
az keyvault set-policy --name <YourKeyVaultName> --upn [email protected] --certificate-permissions delete get list create purge update
91
-
```
85
+
[!INCLUDE [Using RBAC to provide access to a key vault](../../../includes/key-vault-quickstart-rbac.md)]
Copy file name to clipboardExpand all lines: articles/key-vault/certificates/quick-create-powershell.md
+8-6Lines changed: 8 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ ms.author: mbaldwin
13
13
---
14
14
# Quickstart: Set and retrieve a certificate from Azure Key Vault using Azure PowerShell
15
15
16
-
In this quickstart, you create a key vault in Azure Key Vault with Azure PowerShell. Azure Key Vault is a cloud service that works as a secure secrets store. You can securely store keys, passwords, certificates, and other secrets. For more information on Key Vault you may review the [Overview](../general/overview.md). Azure PowerShell is used to create and manage Azure resources using commands or scripts. Once that you have completed that, you will store a certificate.
16
+
In this quickstart, you create a key vault in Azure Key Vault with Azure PowerShell. Azure Key Vault is a cloud service that works as a secure secrets store. You can securely store keys, passwords, certificates, and other secrets. For more information on Key Vault, review the [Overview](../general/overview.md). Azure PowerShell is used to create and manage Azure resources using commands or scripts. Afterwards, you store a certificate.
17
17
18
18
If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
19
19
@@ -34,11 +34,15 @@ Connect-AzAccount
34
34
35
35
[!INCLUDE [Create a key vault](../../../includes/key-vault-powershell-kv-creation.md)]
36
36
37
+
### Grant access to your key vault
38
+
39
+
[!INCLUDE [Using RBAC to provide access to a key vault](../../../includes/key-vault-quickstart-rbac-powershell.md)]
40
+
37
41
## Add a certificate to Key Vault
38
42
39
-
To add a certificate to the vault, you just need to take a couple of additional steps. This certificate could be used by an application.
43
+
To can now add a certificate to the vault. This certificate could be used by an application.
40
44
41
-
Type the commands below to create a self-signed certificate with policy called **ExampleCertificate** :
45
+
Use these commands to create a self-signed certificate with policy called **ExampleCertificate** :
In this quickstart you created a Key Vault and stored a certificate in it. To learn more about Key Vault and how to integrate it with your applications, continue on to the articles below.
79
+
In this quickstart, you created a Key Vault and stored a certificate in it. To learn more about Key Vault and how to integrate it with your applications, continue on to the articles below.
78
80
79
81
- Read an [Overview of Azure Key Vault](../general/overview.md)
80
82
- See the reference for the [Azure PowerShell Key Vault cmdlets](/powershell/module/az.keyvault/)
# Provide access to Key Vault keys, certificates, and secrets with an Azure role-based access control
14
15
15
16
> [!NOTE]
@@ -81,11 +82,11 @@ To add role assignments, you must have `Microsoft.Authorization/roleAssignments/
81
82
> [!NOTE]
82
83
> Changing permission model requires 'Microsoft.Authorization/roleAssignments/write' permission, which is part of [Owner](../../role-based-access-control/built-in-roles.md#owner) and [User Access Administrator](../../role-based-access-control/built-in-roles.md#user-access-administrator) roles. Classic subscription administrator roles like 'Service Administrator' and 'Co-Administrator' are not supported.
83
84
84
-
1.Enable Azure RBAC permissions on new key vault:
85
+
1. Enable Azure RBAC permissions on new key vault:
85
86
86
87

87
88
88
-
2. Enable Azure RBAC permissions on existing key vault:
89
+
1. Enable Azure RBAC permissions on existing key vault:
@@ -97,9 +98,10 @@ To add role assignments, you must have `Microsoft.Authorization/roleAssignments/
97
98
> [!Note]
98
99
> It's recommended to use the unique role ID instead of the role name in scripts. Therefore, if a role is renamed, your scripts would continue to work. In this document role name is used only for readability.
99
100
100
-
Run the following command to create a role assignment:
101
-
102
101
# [Azure CLI](#tab/azure-cli)
102
+
103
+
To create a role assignment using the Azure CLI, use the [az role assignment](/cli/azure/role/assignment) command:
104
+
103
105
```azurecli
104
106
az role assignment create --role <role_name_or_id> --assignee <assignee> --scope <scope>
105
107
```
@@ -108,6 +110,8 @@ For full details, see [Assign Azure roles using Azure CLI](../../role-based-acce
108
110
109
111
# [Azure PowerShell](#tab/azurepowershell)
110
112
113
+
To create a role assignment using Azure PowerShell, use the [New-AzRoleAssignment](/powershell/module/az.resources/new-azroleassignment) cmdlet:
For full details, see [Assign Azure roles using Azure PowerShell](../../role-based-access-control/role-assignments-powershell.md).
120
124
121
-
---
125
+
# [Azure portal](#tab/azure-portal)
122
126
123
127
To assign roles using the Azure portal, see [Assign Azure roles using the Azure portal](../../role-based-access-control/role-assignments-portal.md). In the Azure portal, the Azure role assignments screen is available for all resources on the Access control (IAM) tab.
124
128
129
+
---
130
+
125
131
### Resource group scope role assignment
126
132
133
+
# [Azure portal](#tab/azure-portal)
134
+
127
135
1. Go to the Resource Group that contains your key vault.
@@ -142,7 +150,6 @@ To assign roles using the Azure portal, see [Assign Azure roles using the Azure
142
150
143
151

144
152
145
-
146
153
# [Azure CLI](#tab/azure-cli)
147
154
```azurecli
148
155
az role assignment create --role "Key Vault Reader" --assignee {i.e [email protected]} --scope /subscriptions/{subscriptionid}/resourcegroups/{resource-group-name}
@@ -167,6 +174,8 @@ Above role assignment provides ability to list key vault objects in key vault.
167
174
168
175
### Key Vault scope role assignment
169
176
177
+
# [Azure portal](#tab/azure-portal)
178
+
170
179
1. Go to Key Vault \> Access control (IAM) tab
171
180
1. Select **Add** > **Add role assignment** to open the Add role assignment page.
172
181
@@ -180,7 +189,6 @@ Above role assignment provides ability to list key vault objects in key vault.
180
189
181
190

182
191
183
-
184
192
# [Azure CLI](#tab/azure-cli)
185
193
```azurecli
186
194
az role assignment create --role "Key Vault Secrets Officer" --assignee {i.e [email protected]} --scope /subscriptions/{subscriptionid}/resourcegroups/{resource-group-name}/providers/Microsoft.KeyVault/vaults/{key-vault-name}
@@ -207,6 +215,8 @@ For full details, see [Assign Azure roles using Azure PowerShell](../../role-bas
207
215
> [!NOTE]
208
216
> Key vault secret, certificate, key scope role assignments should only be used for limited scenarios described [here](rbac-guide.md?i#best-practices-for-individual-keys-secrets-and-certificates-role-assignments) to comply with security best practices.
209
217
218
+
# [Azure portal](#tab/azure-portal)
219
+
210
220
1. Open a previously created secret.
211
221
212
222
1. Click the Access control(IAM) tab
@@ -225,8 +235,8 @@ For full details, see [Assign Azure roles using Azure PowerShell](../../role-bas
225
235
226
236

227
237
228
-
229
238
# [Azure CLI](#tab/azure-cli)
239
+
230
240
```azurecli
231
241
az role assignment create --role "Key Vault Secrets Officer" --assignee {i.e [email protected]} --scope /subscriptions/{subscriptionid}/resourcegroups/{resource-group-name}/providers/Microsoft.KeyVault/vaults/{key-vault-name}/secrets/RBACSecret
232
242
```
@@ -285,11 +295,12 @@ For full details, see [Assign Azure roles using Azure PowerShell](../../role-bas
285
295
286
296

287
297
288
-
### Creating custom roles
298
+
### Creating custom roles
289
299
290
300
[az role definition create command](/cli/azure/role/definition#az-role-definition-create)
291
301
292
302
# [Azure CLI](#tab/azure-cli)
303
+
293
304
```azurecli
294
305
az role definition create --role-definition '{ \
295
306
"Name": "Backup Keys Operator", \
@@ -306,6 +317,7 @@ az role definition create --role-definition '{ \
### Can I use Key Vault role-based access control (RBAC) permission model object-scope assignments to provide isolation for application teams within Key Vault?
342
359
No. RBAC permission model allows you to assign access to individual objects in Key Vault to user or application, but any administrative operations like network access control, monitoring, and objects management require vault level permissions, which will then expose secure information to operators across application teams.
[!INCLUDE [Using RBAC to provide access to a key vault](../../../includes/key-vault-quickstart-rbac.md)]
108
94
109
95
## Create the sample code
110
96
@@ -152,8 +138,7 @@ Make sure the code in the previous section is in a file named *kv_keys.py*. Then
152
138
python kv_keys.py
153
139
```
154
140
155
-
- If you encounter permissions errors, make sure you ran the [`az keyvault set-policy` or `Set-AzKeyVaultAccessPolicy` command](#grant-access-to-your-key-vault).
156
-
- Rerunning the code with the same key name may produce the error, "(Conflict) Key \<name\> is currently in a deleted but recoverable state." Use a different key name.
141
+
Rerunning the code with the same key name may produce the error, "(Conflict) Key \<name\> is currently in a deleted but recoverable state." Use a different key name.
0 commit comments