Skip to content

Commit f0b42fd

Browse files
authored
Merge pull request #207675 from Gordonby/gb-akskms
AKS KMS Plugin - RBAC enabled Key Vault
2 parents 178c455 + 1931708 commit f0b42fd

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

articles/aks/use-kms-etcd-encryption.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ KMS supports [public key vault][Enable-KMS-with-public-key-vault] and [private k
4848
>
4949
> If you need to recover your Key Vault or key, see the [Azure Key Vault recovery management with soft delete and purge protection](../key-vault/general/key-vault-recovery.md?tabs=azure-cli) documentation.
5050
51+
#### For non-RBAC key vault
52+
5153
Use `az keyvault create` to create a KeyVault.
5254

5355
```azurecli
@@ -67,6 +69,35 @@ export KEY_ID=$(az keyvault key show --name MyKeyName --vault-name MyKeyVault --
6769
echo $KEY_ID
6870
```
6971

72+
The above example stores the Key ID in *KEY_ID*.
73+
74+
#### For RBAC key vault
75+
76+
Use `az keyvault create` to create a KeyVault using Azure Role Based Access Control.
77+
78+
```azurecli
79+
export KEYVAULT_RESOURCE_ID=$(az keyvault create --name MyKeyVault --resource-group MyResourceGroup --enable-rbac-authorization true --query id -o tsv)
80+
```
81+
82+
Assign yourself permission to create a key.
83+
84+
```azurecli-interactive
85+
az role assignment create --role "Key Vault Crypto Officer" --assignee-object-id $(az ad signed-in-user show --query id --out tsv) --assignee-principal-type "User" --scope $KEYVAULT_RESOURCE_ID
86+
```
87+
88+
Use `az keyvault key create` to create a key.
89+
90+
```azurecli
91+
az keyvault key create --name MyKeyName --vault-name MyKeyVault
92+
```
93+
94+
Use `az keyvault key show` to export the Key ID.
95+
96+
```azurecli
97+
export KEY_ID=$(az keyvault key show --name MyKeyName --vault-name MyKeyVault --query 'key.kid' -o tsv)
98+
echo $KEY_ID
99+
```
100+
70101
The above example stores the Key ID in *KEY_ID*.
71102

72103
### Create a user-assigned managed identity
@@ -107,7 +138,7 @@ az keyvault set-policy -n MyKeyVault --key-permissions decrypt encrypt --object-
107138

108139
#### For RBAC key vault
109140

110-
If your key vault is enabled with `--enable-rbac-authorization`, you need to assign the "Key Vault Administrator" RBAC role which has decrypt, encrypt permission.
141+
If your key vault is enabled with `--enable-rbac-authorization`, you need to assign the "Key Vault Crypto User" RBAC role which has decrypt, encrypt permission.
111142

112143
```azurecli-interactive
113144
az role assignment create --role "Key Vault Crypto User" --assignee-object-id $IDENTITY_OBJECT_ID --assignee-principal-type "ServicePrincipal" --scope $KEYVAULT_RESOURCE_ID

0 commit comments

Comments
 (0)