Skip to content

Commit 7b8ef9b

Browse files
committed
fix powershell commands. fix links
1 parent 8922c7c commit 7b8ef9b

File tree

1 file changed

+71
-90
lines changed

1 file changed

+71
-90
lines changed

articles/azure-netapp-files/configure-customer-managed-keys.md

Lines changed: 71 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,14 @@ The following diagram demonstrates how customer-managed keys work with Azure Net
3838
* Customer-managed keys can only be configured on new volumes. You can't migrate existing volumes to customer-managed key encryption.
3939
* To create a volume using customer-managed keys, you must select the *Standard* network features. You can't use customer-managed key volumes with volume configured using Basic network features. Follow instructions in to [Set the Network Features option](configure-network-features.md#set-the-network-features-option) in the volume creation page.
4040
* For increased security, you can select the **Disable public access** option within the network settings of your key vault. When selecting this option, you must also select **Allow trusted Microsoft services to bypass this firewall** to permit the Azure NetApp Files service to access your encryption key.
41-
* Automatic Managed System Identity (MSI) certificate renewal isn't currently supported. It is recommended to set up an Azure monitor alert for when the MSI certificate is going to expire.
41+
* Automatic Managed System Identity (MSI) certificate renewal isn't currently supported. It's recommended you create an Azure monitor alert to notify you when the MSI certificate is set to expire.
4242
* The MSI certificate has a lifetime of 90 days. It becomes eligible for renewal after 46 days. **After 90 days, the certificate is no longer be valid and the customer-managed key volumes under the NetApp account will go offline.**
4343
* To renew, you need to call the NetApp account operation `renewCredentials` if eligible for renewal. If it's not eligible, an error message communicates the date of eligibility.
4444
* Version 2.42 or later of the Azure CLI supports running the `renewCredentials` operation with the [az netappfiles account command](/cli/azure/netappfiles/account#az-netappfiles-account-renew-credentials). For example:
4545

4646
`az netappfiles account renew-credentials –-account-name myaccount –resource-group myresourcegroup`
4747

4848
* If the account isn't eligible for MSI certificate renewal, an error message communicates the date and time when the account is eligible. It's recommended you run this operation periodically (for example, daily) to prevent the certificate from expiring and from the customer-managed key volume going offline.
49-
* If you are using the CLI or PowerShell, you must take additional steps to enable access from the NetApp account to the customer-managed keys.
5049
* Applying Azure network security groups on the private link subnet to Azure Key Vault isn't supported for Azure NetApp Files customer-managed keys. Network security groups don't affect connectivity to Private Link unless `Private endpoint network policy` is enabled on the subnet. It's recommended to keep this option disabled.
5150
* If Azure NetApp Files fails to create a customer-managed key volume, error messages are displayed. Refer to the [Error messages and troubleshooting](#error-messages-and-troubleshooting) section for more information.
5251
* If Azure Key Vault becomes inaccessible, Azure NetApp Files loses its access to the encryption keys and the ability to read or write data to volumes enabled with customer-managed keys. In this situation, create a support ticket to have access manually restored for the affected volumes.
@@ -99,7 +98,7 @@ Azure NetApp Files customer-managed keys is supported for the following regions:
9998

10099
## Requirements
101100

102-
Before creating your first customer-managed key volume, you must have set up:
101+
Before creating your first customer-managed key volume, you must set up:
103102
* An [Azure Key Vault](../key-vault/general/overview.md), containing at least one key.
104103
* The key vault must have soft delete and purge protection enabled.
105104
* The key must be of type RSA.
@@ -183,18 +182,18 @@ The process to configure a NetApp account with customer-managed keys in the Azur
183182
184183
1. Update the NetApp account with your key vault.
185184
186-
```azurecli
187-
key_vault_uri=$(az keyvault show \
188-
--name <key-vault> \
189-
--resource-group <resource_group> \
190-
--query properties.vaultUri \
191-
--output tsv)
192-
az netappfiles account update --name <account_name> \
193-
--resource-group <resource_group> \
194-
--key-source Microsoft.Keyvault \
195-
--key-vault-uri $key_vault_uri \
196-
--key-name <key>
197-
```
185+
```azurecli
186+
key_vault_uri=$(az keyvault show \
187+
--name <key-vault> \
188+
--resource-group <resource_group> \
189+
--query properties.vaultUri \
190+
--output tsv)
191+
az netappfiles account update --name <account_name> \
192+
--resource-group <resource_group> \
193+
--key-source Microsoft.Keyvault \
194+
--key-vault-uri $key_vault_uri \
195+
--key-name <key>
196+
```
198197
199198
#### Use a new user-assigned identity
200199
@@ -219,109 +218,91 @@ az netappfiles account update --name <account_name> \
219218
--object-id $user_assigned_identity_principal \
220219
--key-permissions get encrypt decrypt
221220
```
222-
223-
>[!NOTE]
224-
>You can alternately [use role-based access control to grant access to the key vault](#use-role-based-access-control).
221+
222+
>[!NOTE]
223+
>You can alternately [use role-based access control to grant access to the key vault](#use-role-based-access-control).
225224
226225
1. Assign the user-assigned identity to the NetApp account and update the key vault encryption.
227226
228-
```azurecli
229-
key_vault_uri=$(az keyvault show \
230-
--name <key-vault> \
231-
--resource-group <resource_group> \
232-
--query properties.vaultUri \
233-
--output tsv)
234-
user_assigned_identity=$(az identity show \
235-
--name <identity_name> \
236-
--resource-group <resource_group> \
237-
--query id \
238-
-output tsv)
239-
az netappfiles account update --name <account_name> \
240-
--resource-group <resource_group> \
241-
--identity-type UserAssigned \
242-
--user-identity-id $user-assigned-identity \
243-
--key-source Microsoft.Keyvault \
244-
--key-vault-uri $key_vault_uri \
245-
--key-name <key> \
246-
--keyvault-resource-id <key-vault> \
247-
--user-assigned-identity $user_assigned_identity
248-
```
227+
```azurecli
228+
key_vault_uri=$(az keyvault show \
229+
--name <key-vault> \
230+
--resource-group <resource_group> \
231+
--query properties.vaultUri \
232+
--output tsv)
233+
user_assigned_identity=$(az identity show \
234+
--name <identity_name> \
235+
--resource-group <resource_group> \
236+
--query id \
237+
-output tsv)
238+
az netappfiles account update --name <account_name> \
239+
--resource-group <resource_group> \
240+
--identity-type UserAssigned \
241+
--user-identity-id $user-assigned-identity \
242+
--key-source Microsoft.Keyvault \
243+
--key-vault-uri $key_vault_uri \
244+
--key-name <key> \
245+
--keyvault-resource-id <key-vault> \
246+
--user-assigned-identity $user_assigned_identity
247+
```
249248
250249
### [Azure PowerShell](#tab/azure-powershell)
251250
252-
The process to configure a NetApp account with customer-managed keys in the Azure CLI depends on whether you are using a [system-assigned identity](#enable-access-for-system-assigned-identity) or an [user-assigned identity](#enable-access-for-user-assigned-identityy).
251+
The process to configure a NetApp account with customer-managed keys in the Azure CLI depends on whether you are using a [system-assigned identity](#enable-access-for-system-assigned-identity) or an [user-assigned identity](#enable-access-for-user-assigned-identity).
253252
254253
#### Enable access for system-assigned identity
255254
256255
1. Update your NetApp account to use system-assigned identity.
257256
258-
```azurepowershell
259-
$netappAccount = Update-AzNetAppFilesAccount -ResourceGroupName <resource_group> -Name <account_name> -AssignIdentity
260-
```
257+
```azurepowershell
258+
$netappAccount = Update-AzNetAppFilesAccount -ResourceGroupName <resource_group> -Name <account_name> -AssignIdentity
259+
```
261260
262261
1. To use an access policy, run `Set-AzKeyVaultAccessPolicy` with the key vault name, the principal ID of the account identity, and the permissions "Get", "Encrypt", and "Decrypt".
263262
264-
```azurepowershell
265-
Set-AzKeyVaultAccessPolicy -VaultName <key_vault_name> -ResourceGroupname <resource_group> -ObjectId $netappAccount.Identity.PrincipalId -PermissionsToKeys get,encrypt,decrypt
266-
```
263+
```azurepowershell
264+
Set-AzKeyVaultAccessPolicy -VaultName <key_vault_name> -ResourceGroupname <resource_group> -ObjectId $netappAccount.Identity.PrincipalId -PermissionsToKeys get,encrypt,decrypt
265+
```
267266
268267
1. Update your NetApp account with the key vault information.
269268
270-
```azurepowershell
271-
Update-AzNetAppFilesAccount -ResourceGroupName $netappAccount.ResourceGroupName -AccountName $netappAccount.ResourceGroupName -KeyVaultEncryption -KeyVaultUri <keyVaultUri> -KeyName <keyName>
272-
```
269+
```azurepowershell
270+
Update-AzNetAppFilesAccount -ResourceGroupName $netappAccount.ResourceGroupName -AccountName $netappAccount.ResourceGroupName -KeyVaultEncryption -KeyVaultUri <keyVaultUri> -KeyName <keyName>
271+
```
273272
274273
#### Enable access for user-assigned identity
275274
276275
1. Create a new user-assigned identity.
277276
278-
```azurepowershell
279-
az identity create \
280-
--name <identity_name> \
281-
--resource-group <resource_group>
282-
```
277+
```azurepowershell
278+
$userId = New-AzUserAssignedIdentity -ResourceGroupName <resourceGroupName> -Name $userIdName
279+
```
283280
284281
1. Assign the access policy to the key vault.
285282
286-
```azurepowershell
287-
user_assigned_identity_principal=$(az identity show \
288-
--name <identity_name> \
289-
--resource-group <resource_group> \
290-
--query properties.principalId \
291-
-output tsv)
292-
az keyvault set-policy \
293-
--name <key_vault_name> \
294-
--resource-group <resource-group> \
295-
--object-id $user_assigned_identity_principal \
296-
--key-permissions get encrypt decrypt
297-
```
298-
299-
>[!NOTE]
300-
>You can alternately [use role-based access control to grant access to the key vault](#use-role-based-access-control).
283+
```azurepowershell
284+
Set-AzKeyVaultAccessPolicy -VaultName <key_vault_name> `
285+
-ResourceGroupname <resource_group> `
286+
-ObjectId $userId.PrincipalId `
287+
-PermissionsToKeys get,encrypt,decrypt `
288+
-BypassObjectIdValidation
289+
```
290+
291+
>[!NOTE]
292+
>You can alternately [use role-based access control to grant access to the key vault](#use-role-based-access-control).
301293
302294
1. Assign the user-assigned identity to the NetApp account and update the key vault encryption.
303295
304-
```azurepowershell
305-
key_vault_uri=$(az keyvault show \
306-
--name <key-vault> \
307-
--resource-group <resource_group> \
308-
--query properties.vaultUri \
309-
--output tsv)
310-
user_assigned_identity=$(az identity show \
311-
--name <identity_name> \
312-
--resource-group <resource_group> \
313-
--query id \
314-
-output tsv)
315-
az netappfiles account update --name <storage-account> \
316-
--resource-group <resource_group> \
317-
--identity-type UserAssigned \
318-
--user-identity-id $user_assigned_identity \
319-
--key-source Microsoft.Keyvault \
320-
--key-vault-uri $key_vault_uri \
321-
--key-name <key> \
322-
--keyvault-resource-id <key-vault> \
323-
--user-assigned-identity $user_assigned_identity
324-
```
296+
```azurepowershell
297+
$netappAccount = Update-AzNetAppFilesAccount -ResourceGroupName <resource_group> `
298+
-Name <account_name> `
299+
-IdentityType UserAssigned `
300+
-UserAssignedIdentityId $userId.Id `
301+
-KeyVaultEncryption `
302+
-KeyVaultUri <keyVaultUri> `
303+
-KeyName <keyName> `
304+
-EncryptionUserAssignedIdentity $userId.Id
305+
```
325306
326307
## Use role-based access control
327308

0 commit comments

Comments
 (0)