Skip to content

Commit

Permalink
[Storage] Fix issue 14769 (#14806)
Browse files Browse the repository at this point in the history
  • Loading branch information
blueww authored Apr 22, 2021
1 parent d9878cb commit cc2ea0b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/Storage/Storage.Management/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
- `New-AzStorageAccount`
* Fixed an issue that delete immutable blob will prompt incorrect message.
- `Remove-AzStorageAccount`
* Allowed update Storage Account KeyVault properties by cleanup Keyversion to enable key auto rotation [#14769]
- `Set-AzStorageAccount`
* Added breaking change warning message for upcoming cmdlet breaking change
- `Remove-AzRmStorageShare`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public SwitchParameter KeyvaultEncryption
[Parameter(HelpMessage = "Storage Account encryption keySource KeyVault KeyVersion",
Mandatory = false,
ParameterSetName = KeyvaultEncryptionParameterSet)]
[ValidateNotNullOrEmpty]
[ValidateNotNull]
public string KeyVersion { get; set; }

[Parameter(HelpMessage = "Storage Account encryption keySource KeyVault KeyVaultUri",
Expand Down
5 changes: 5 additions & 0 deletions src/Storage/Storage.Management/help/Set-AzStorageAccount.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,15 @@ PS C:\>$keyVault = New-AzKeyVault -VaultName "MyKeyVault" -ResourceGroupName "My
PS C:\>$key = Add-AzKeyVaultKey -VaultName "MyKeyVault" -Name "MyKey" -Destination 'Software'
PS C:\>Set-AzKeyVaultAccessPolicy -VaultName "MyKeyVault" -ObjectId $account.Identity.PrincipalId -PermissionsToKeys wrapkey,unwrapkey,get
# In case to enable key auto rotation, don't set KeyVersion
PS C:\>Set-AzStorageAccount -ResourceGroupName "MyResourceGroup" -AccountName "mystorageaccount" -KeyvaultEncryption -KeyName $key.Name -KeyVersion $key.Version -KeyVaultUri $keyVault.VaultUri
# In case to enable key auto rotation after set keyvault proeprites with KeyVersion, can update account by set KeyVersion to empty
PS C:\>Set-AzStorageAccount -ResourceGroupName "MyResourceGroup" -AccountName "mystorageaccount" -KeyvaultEncryption -KeyName $key.Name -KeyVersion "" -KeyVaultUri $keyVault.VaultUri
```

This command set Encryption KeySource with a new created Keyvault.
If want to enable key auto rotation, don't set keyversion when set Keyvault properties for the first time, or clean up it by set keyvault properties again with keyversion as empty.

### Example 6: Set Encryption KeySource to "Microsoft.Storage"
```
Expand Down

0 comments on commit cc2ea0b

Please sign in to comment.