Skip to content

Commit 395380f

Browse files
authored
Merge pull request #103469 from tamram/tamram-0129
add PS commands for using account encryption key
2 parents 31a189a + 255c643 commit 395380f

File tree

2 files changed

+114
-20
lines changed

2 files changed

+114
-20
lines changed

articles/storage/common/account-encryption-key-create.md

Lines changed: 113 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ author: tamram
77

88
ms.service: storage
99
ms.topic: how-to
10-
ms.date: 01/10/2020
10+
ms.date: 02/05/2020
1111
ms.author: tamram
1212
ms.reviewer: cbrooks
1313
ms.subservice: common
@@ -31,42 +31,94 @@ You can create a storage account that relies on the account encryption key for Q
3131

3232
### Register to use the account encryption key
3333

34-
To register with Azure CLI, call the [az feature register](/cli/azure/feature#az-feature-register) command.
34+
To register to use the account encryption key with Queue or Table storage, use PowerShell or Azure CLI.
3535

36-
To register to use the account encryption key with Queue storage:
36+
# [PowerShell](#tab/powershell)
3737

38-
```azurecli
39-
az feature register --namespace Microsoft.Storage --name AllowAccountEncryptionKeyForQueues
38+
To register with PowerShell, call the [Get-AzProviderFeature](/powershell/module/az.resources/get-azproviderfeature) command.
39+
40+
```powershell
41+
Register-AzProviderFeature -ProviderNamespace Microsoft.Storage `
42+
-FeatureName AllowAccountEncryptionKeyForQueues
43+
Register-AzProviderFeature -ProviderNamespace Microsoft.Storage `
44+
-FeatureName AllowAccountEncryptionKeyForTables
4045
```
4146

42-
To register to use the account encryption key with Table storage:
47+
# [Azure CLI](#tab/azure-cli)
48+
49+
To register with Azure CLI, call the [az feature register](/cli/azure/feature#az-feature-register) command.
4350

4451
```azurecli
45-
az feature register --namespace Microsoft.Storage --name AllowAccountEncryptionKeyForTables
52+
az feature register --namespace Microsoft.Storage \
53+
--name AllowAccountEncryptionKeyForQueues
54+
az feature register --namespace Microsoft.Storage \
55+
--name AllowAccountEncryptionKeyForTables
4656
```
4757

58+
# [Template](#tab/template)
59+
60+
N/A
61+
62+
---
63+
4864
### Check the status of your registration
4965

50-
To check the status of your registration for Queue storage:
66+
To check the status of your registration for Queue or Table storage, use PowerShell or Azure CLI.
5167

52-
```azurecli
53-
az feature show --namespace Microsoft.Storage --name AllowAccountEncryptionKeyForQueues
68+
# [PowerShell](#tab/powershell)
69+
70+
To check the status of your registration with PowerShell, call the [Get-AzProviderFeature](/powershell/module/az.resources/get-azproviderfeature) command.
71+
72+
```powershell
73+
Get-AzProviderFeature -ProviderNamespace Microsoft.Storage `
74+
-FeatureName AllowAccountEncryptionKeyForQueues
75+
Get-AzProviderFeature -ProviderNamespace Microsoft.Storage `
76+
-FeatureName AllowAccountEncryptionKeyForTables
5477
```
5578

56-
To check the status of your registration for Table storage:
79+
# [Azure CLI](#tab/azure-cli)
80+
81+
To check the status of your registration with Azure CLI, call the [az feature](/cli/azure/feature#az-feature-show) command.
5782

5883
```azurecli
59-
az feature show --namespace Microsoft.Storage --name AllowAccountEncryptionKeyForTables
84+
az feature show --namespace Microsoft.Storage \
85+
--name AllowAccountEncryptionKeyForQueues
86+
az feature show --namespace Microsoft.Storage \
87+
--name AllowAccountEncryptionKeyForTables
6088
```
6189

90+
# [Template](#tab/template)
91+
92+
N/A
93+
94+
---
95+
6296
### Re-register the Azure Storage resource provider
6397

64-
After your registration is approved, you must re-register the Azure Storage resource provider. Call the [az provider register](/cli/azure/provider#az-provider-register) command:
98+
After your registration is approved, you must re-register the Azure Storage resource provider. Use PowerShell or Azure CLI to re-register the resource provider.
99+
100+
# [PowerShell](#tab/powershell)
101+
102+
To re-register the resource provider with PowerShell, call the [Register-AzResourceProvider](/powershell/module/az.resources/register-azresourceprovider) command.
103+
104+
```powershell
105+
Register-AzResourceProvider -ProviderNamespace 'Microsoft.Storage'
106+
```
107+
108+
# [Azure CLI](#tab/azure-cli)
109+
110+
To re-register the resource provider with Azure CLI, call the [az provider register](/cli/azure/provider#az-provider-register) command.
65111

66112
```azurecli
67113
az provider register --namespace 'Microsoft.Storage'
68114
```
69115

116+
# [Template](#tab/template)
117+
118+
N/A
119+
120+
---
121+
70122
## Create an account that uses the account encryption key
71123

72124
You must configure a new storage account to use the account encryption key for queues and tables at the time that you create the storage account. The scope of the encryption key cannot be changed after the account is created.
@@ -76,7 +128,28 @@ The storage account must be of type general-purpose v2. You can create the stora
76128
> [!NOTE]
77129
> Only Queue and Table storage can be optionally configured to encrypt data with the account encryption key when the storage account is created. Blob storage and Azure Files always use the account encryption key to encrypt data.
78130
79-
### [Azure CLI](#tab/azure-cli)
131+
# [PowerShell](#tab/powershell)
132+
133+
To use PowerShell to create a storage account that relies on the account encryption key, make sure you have installed the Azure PowerShell module, version 3.4.0 or later. For more information, see [Install the Azure PowerShell module](/powershell/azure/install-az-ps).
134+
135+
Next, create a general-purpose v2 storage account by calling the [New-AzStorageAccount](/powershell/module/az.storage/new-azstorageaccount) command, with the appropriate parameters:
136+
137+
- Include the `-EncryptionKeyTypeForQueue` option and set its value to `Account` to use the account encryption key to encrypt data in Queue storage.
138+
- Include the `-EncryptionKeyTypeForTable` option and set its value to `Account` to use the account encryption key to encrypt data in Table storage.
139+
140+
The following example shows how to create a general-purpose v2 storage account that is configured for read-access geo-redundant storage (RA-GRS) and that uses the account encryption key to encrypt data for both Queue and Table storage. Remember to replace the placeholder values in brackets with your own values:
141+
142+
```powershell
143+
New-AzStorageAccount -ResourceGroupName <resource_group> `
144+
-AccountName <storage-account> `
145+
-Location <location> `
146+
-SkuName "Standard_RAGRS" `
147+
-Kind StorageV2 `
148+
-EncryptionKeyTypeForTable Account `
149+
-EncryptionKeyTypeForQueue Account
150+
```
151+
152+
# [Azure CLI](#tab/azure-cli)
80153

81154
To use Azure CLI to create a storage account that relies on the account encryption key, make sure you have installed Azure CLI version 2.0.80 or later. For more information, see [Install the Azure CLI](/cli/azure/install-azure-cli).
82155

@@ -85,22 +158,22 @@ Next, create a general-purpose v2 storage account by calling the [az storage acc
85158
- Include the `--encryption-key-type-for-queue` option and set its value to `Account` to use the account encryption key to encrypt data in Queue storage.
86159
- Include the `--encryption-key-type-for-table` option and set its value to `Account` to use the account encryption key to encrypt data in Table storage.
87160

88-
The following example shows how to create a general-purpose v2 storage account that is configured for LRS and that uses the account encryption key to encrypt data for both Queue and Table storage. Remember to replace the placeholder values in brackets with your own values:
161+
The following example shows how to create a general-purpose v2 storage account that is configured for read-access geo-redundant storage (RA-GRS) and that uses the account encryption key to encrypt data for both Queue and Table storage. Remember to replace the placeholder values in brackets with your own values:
89162

90163
```azurecli
91164
az storage account create \
92165
--name <storage-account> \
93166
--resource-group <resource-group> \
94167
--location <location> \
95-
--sku Standard_LRS \
168+
--sku Standard_RAGRS \
96169
--kind StorageV2 \
97170
--encryption-key-type-for-table Account \
98171
--encryption-key-type-for-queue Account
99172
```
100173

101-
### [Template](#tab/template)
174+
# [Template](#tab/template)
102175

103-
The following JSON example creates a general-purpose v2 storage account that is configured for LRS and that uses the account encryption key to encrypt data for both Queue and Table storage. Remember to replace the placeholder values in angle brackets with your own values:
176+
The following JSON example creates a general-purpose v2 storage account that is configured for read-access geo-redundant storage (RA-GRS) and that uses the account encryption key to encrypt data for both Queue and Table storage. Remember to replace the placeholder values in angle brackets with your own values:
104177

105178
```json
106179
"resources": [
@@ -112,7 +185,7 @@ The following JSON example creates a general-purpose v2 storage account that is
112185
"dependsOn": [],
113186
"tags": {},
114187
"sku": {
115-
"name": "[parameters('Standard_LRS')]"
188+
"name": "[parameters('Standard_RAGRS')]"
116189
},
117190
"kind": "[parameters('StorageV2')]",
118191
"properties": {
@@ -147,12 +220,33 @@ After you have created an account that relies on the account encryption key, see
147220

148221
To verify that a service in a storage account is using the account encryption key, call the Azure CLI [az storage account](/cli/azure/storage/account#az-storage-account-show) command. This command returns a set of storage account properties and their values. Look for the `keyType` field for each service within the encryption property and verify that it is set to `Account`.
149222

223+
# [PowerShell](#tab/powershell)
224+
225+
To verify that a service in a storage account is using the account encryption key, call the [Get-AzStorageAccount](/powershell/module/az.storage/get-azstorageaccount) command. This command returns a set of storage account properties and their values. Look for the `KeyType` field for each service within the `Encryption` property and verify that it is set to `Account`.
226+
227+
```powershell
228+
$account = Get-AzStorageAccount -ResourceGroupName <resource-group> `
229+
-StorageAccountName <storage-account>
230+
$account.Encryption.Services.Queue
231+
$account.Encryption.Services.Table
232+
```
233+
234+
# [Azure CLI](#tab/azure-cli)
235+
236+
To verify that a service in a storage account is using the account encryption key, call the [az storage account](/cli/azure/storage/account#az-storage-account-show) command. This command returns a set of storage account properties and their values. Look for the `keyType` field for each service within the encryption property and verify that it is set to `Account`.
237+
150238
```azurecli
151239
az storage account show /
152240
--name <storage-account> /
153241
--resource-group <resource-group>
154242
```
155243

244+
# [Template](#tab/template)
245+
246+
N/A
247+
248+
---
249+
156250
## Next steps
157251

158252
- [Azure Storage encryption for data at rest](storage-service-encryption.md)

articles/storage/common/storage-service-encryption.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services: storage
55
author: tamram
66

77
ms.service: storage
8-
ms.date: 01/10/2020
8+
ms.date: 02/05/2020
99
ms.topic: conceptual
1010
ms.author: tamram
1111
ms.reviewer: cbrooks

0 commit comments

Comments
 (0)