Skip to content

Commit 194ae95

Browse files
authored
Merge pull request #114643 from jlichwa/patch-19
Update overview-storage-keys-powershell.md
2 parents 00c86c3 + 2f2e149 commit 194ae95

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

articles/key-vault/secrets/overview-storage-keys-powershell.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,18 @@ $resourceGroupName = <YourResourceGroupName>
8080
$storageAccountName = <YourStorageAccountName>
8181
$keyVaultName = <YourKeyVaultName>
8282
$keyVaultSpAppId = "cfa8b339-82a2-471a-a3c9-0fc0be7a4093"
83-
$storageAccountKey = "key1"
83+
$storageAccountKey = "key1" #(key1 or key2 are allowed)
8484
8585
# Get your User Id
8686
$userId = (Get-AzContext).Account.Id
8787
8888
# Get a reference to your Azure storage account
8989
$storageAccount = Get-AzStorageAccount -ResourceGroupName $resourceGroupName -StorageAccountName $storageAccountName
90+
9091
```
92+
>[!Note]
93+
> For Classic Storage Account use "primary" and "secondary" for $storageAccountKey <br>
94+
> Use 'Get-AzResource -Name "ClassicStorageAccountName" -ResourceGroupName $resourceGroupName' instead of'Get-AzStorageAccount' for Classic Storage Account
9195
9296
### Give Key Vault access to your storage account
9397

@@ -156,7 +160,7 @@ Tags :
156160

157161
### Enable key regeneration
158162

159-
If you want Key Vault to regenerate your storage account keys periodically, you can use the Azure PowerShell [Add-AzKeyVaultManagedStorageAccount](/powershell/module/az.keyvault/add-azkeyvaultmanagedstorageaccount?view=azps-2.6.0) cmdlet to set a regeneration period. In this example, we set a regeneration period of three days. After three days, Key Vault will regenerate 'key2' and swap the active key from 'key2' to 'key1'.
163+
If you want Key Vault to regenerate your storage account keys periodically, you can use the Azure PowerShell [Add-AzKeyVaultManagedStorageAccount](/powershell/module/az.keyvault/add-azkeyvaultmanagedstorageaccount?view=azps-2.6.0) cmdlet to set a regeneration period. In this example, we set a regeneration period of three days. After three days, Key Vault will regenerate 'key2' and swap the active key from 'key2' to 'key1' (replace with 'primary' and 'secondary' for Classic Storage Accounts).
160164

161165
```azurepowershell-interactive
162166
$regenPeriod = [System.Timespan]::FromDays(3)
@@ -201,7 +205,7 @@ We will also use the Azure PowerShell [New-AzStorageContext](/powershell/module/
201205
$storageAccountName = <YourStorageAccountName>
202206
$keyVaultName = <YourKeyVaultName>
203207
204-
$storageContext = New-AzStorageContext -StorageAccountName $storageAccountName -Protocol Https -StorageAccountKey Key1
208+
$storageContext = New-AzStorageContext -StorageAccountName $storageAccountName -Protocol Https -StorageAccountKey Key1 #(or "Primary" for Classic Storage Account)
205209
```
206210

207211
### Create a shared access signature token

0 commit comments

Comments
 (0)