Skip to content

Commit 550f57e

Browse files
committed
fix PS examples
1 parent fce9718 commit 550f57e

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

articles/storage/common/customer-managed-keys-configure-existing-account.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ When you configure customer-managed keys with the Azure portal, you can select a
4747

4848
#### [PowerShell](#tab/powershell)
4949

50-
To authorize access to the key vault with a user-assigned managed identity, you will need the resource ID and principal ID of the user-assigned managed identity. Call [Get-AzUserAssignedIdentity](/powershell/module/az.managedserviceidentity/get-azuserassignedidentity) to get the user-assigned managed identity, then save the resource ID and principal ID to variables. You will need these values in subsequent steps:
50+
To authorize access to the key vault with a user-assigned managed identity, you will need the resource ID and principal ID of the user-assigned managed identity. Call [Get-AzUserAssignedIdentity](/powershell/module/az.managedserviceidentity/get-azuserassignedidentity) to get the user-assigned managed identity and assign it to a variable that you will reference in subsequent steps:
5151

5252
```azurepowershell
53-
$userIdentityId = Get-AzUserAssignedIdentity -Name <user-assigned-identity> -ResourceGroupName <resource-group>
53+
$userIdentity = Get-AzUserAssignedIdentity -Name <user-assigned-identity> -ResourceGroupName <resource-group>
5454
$principalId = $userIdentity.PrincipalId
5555
```
5656

@@ -200,8 +200,8 @@ To configure customer-managed keys for an existing account with automatic updati
200200
Next, call [Set-AzStorageAccount](/powershell/module/az.storage/set-azstorageaccount) to update the storage account's encryption settings, omitting the key version. Include the **-KeyvaultEncryption** option to enable customer-managed keys for the storage account.
201201

202202
```azurepowershell
203-
Set-AzStorageAccount -ResourceGroupName $storageAccount.ResourceGroupName `
204-
-AccountName $storageAccount.StorageAccountName `
203+
Set-AzStorageAccount -ResourceGroupName <resource-group> `
204+
-AccountName <storage-account> `
205205
-KeyvaultEncryption `
206206
-KeyName $key.Name `
207207
-KeyVaultUri $keyVault.VaultUri
@@ -258,8 +258,8 @@ To configure customer-managed keys with manual updating of the key version, expl
258258
Remember to replace the placeholder values in brackets with your own values and to use the variables defined in the previous examples.
259259

260260
```azurepowershell
261-
Set-AzStorageAccount -ResourceGroupName $storageAccount.ResourceGroupName `
262-
-AccountName $storageAccount.StorageAccountName `
261+
Set-AzStorageAccount -ResourceGroupName <resource-group> `
262+
-AccountName <storage-account> `
263263
-KeyvaultEncryption `
264264
-KeyName $key.Name `
265265
-KeyVersion $key.Version `

articles/storage/common/customer-managed-keys-configure-new-account.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,10 @@ When you configure customer-managed keys with the Azure portal, you can select a
4545

4646
### [PowerShell](#tab/powershell)
4747

48-
To authorize access to the key vault with a user-assigned managed identity, you will need the resource ID and principal ID of the user-assigned managed identity. Call [Get-AzUserAssignedIdentity](/powershell/module/az.managedserviceidentity/get-azuserassignedidentity) to get the user-assigned managed identity, then save the resource ID and principal ID to variables. You will need these values in subsequent steps:
48+
To authorize access to the key vault with a user-assigned managed identity, you will need the resource ID and principal ID of the user-assigned managed identity. Call [Get-AzUserAssignedIdentity](/powershell/module/az.managedserviceidentity/get-azuserassignedidentity) to get the user-assigned managed identity and assign it to a variable that you will reference in subsequent steps:
4949

5050
```azurepowershell
51-
$userIdentityId = Get-AzUserAssignedIdentity -Name <user-assigned-identity> -ResourceGroupName <resource-group>
52-
$principalId = $userIdentity.PrincipalId
51+
$userIdentity = Get-AzUserAssignedIdentity -Name <user-assigned-identity> -ResourceGroupName <resource-group>
5352
```
5453

5554
### [Azure CLI](#tab/azure-cli)
@@ -78,7 +77,7 @@ To configure the key vault access policy with PowerShell, call [Set-AzKeyVaultAc
7877
```azurepowershell
7978
Set-AzKeyVaultAccessPolicy `
8079
-VaultName $keyVault.VaultName `
81-
-ObjectId $principalId `
80+
-ObjectId $userIdentity.PrincipalId `
8281
-PermissionsToKeys wrapkey,unwrapkey,get
8382
```
8483

@@ -141,10 +140,10 @@ New-AzStorageAccount -ResourceGroupName <resource-group> `
141140
-SkuName Standard_LRS `
142141
-Location $location `
143142
-IdentityType SystemAssignedUserAssigned `
144-
-UserIdentityId $userIdentityId `
143+
-UserAssignedIdentityId $userIdentity.Id `
145144
-KeyVaultUri $keyVault.VaultUri `
146145
-KeyName $key.Name `
147-
-KeyVaultUserAssignedIdentityId $userIdentityId
146+
-KeyVaultUserAssignedIdentityId $userIdentity.Id
148147
```
149148

150149
### [Azure CLI](#tab/azure-cli)
@@ -208,11 +207,11 @@ New-AzStorageAccount -ResourceGroupName <resource-group> `
208207
-SkuName Standard_LRS `
209208
-Location $location `
210209
-IdentityType SystemAssignedUserAssigned `
211-
-UserIdentityId $userIdentityId `
210+
-UserAssignedIdentityId $userIdentity.Id `
212211
-KeyVaultUri $keyVault.VaultUri `
213212
-KeyName $key.Name `
214213
-KeyVersion $key.Version `
215-
-KeyVaultUserAssignedIdentityId $userIdentityId
214+
-KeyVaultUserAssignedIdentityId $userIdentity.Id
216215
```
217216

218217

0 commit comments

Comments
 (0)