Skip to content

Commit 29f0cab

Browse files
authored
Merge pull request #214212 from tamram/tamram22-1011
xtenant CMK: add CLI samples
2 parents a491f34 + e992173 commit 29f0cab

5 files changed

+198
-109
lines changed

articles/storage/blobs/TOC.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -398,13 +398,13 @@ items:
398398
href: ../common/storage-encryption-key-model-get.md?toc=/azure/storage/blobs/toc.json
399399
- name: Configure customer-managed keys in Azure Key Vault
400400
items:
401-
- name: Configure customer-managed keys in the same tenant
401+
- name: Configure keys and storage account in the same tenant
402402
items:
403-
- name: Configure customer-managed keys for a new account
403+
- name: Configure keys for a new account
404404
href: ../common/customer-managed-keys-configure-new-account.md?toc=/azure/storage/blobs/toc.json
405-
- name: Configure customer-managed keys for an existing account
405+
- name: Configure keys for an existing account
406406
href: ../common/customer-managed-keys-configure-existing-account.md?toc=/azure/storage/blobs/toc.json
407-
- name: Configure customer-managed keys in a different tenant
407+
- name: Configure keys and storage account in different tenants
408408
items:
409409
- name: Configure customer-managed keys for a new account
410410
href: ../common/customer-managed-keys-configure-cross-tenant-new-account.md?toc=/azure/storage/blobs/toc.json

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

Lines changed: 3 additions & 3 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: 10/04/2022
10+
ms.date: 10/14/2022
1111
ms.author: tamram
1212
ms.reviewer: ozgun
1313
ms.subservice: common
@@ -119,7 +119,7 @@ After you've specified the key from the key vault in the customer's tenant, the
119119

120120
### [PowerShell](#tab/azure-powershell)
121121

122-
To configure cross-tenant customer-managed keys for a new storage account in PowerShell, first install the [Az.Storage PowerShell module](https://www.powershellgallery.com/packages/Az.Storage/4.4.2-preview), version 4.4.2-preview.
122+
To configure cross-tenant customer-managed keys for a new storage account with PowerShell, first install the [Az.Storage PowerShell module](https://www.powershellgallery.com/packages/Az.Storage/4.4.2-preview), version 4.4.2-preview.
123123

124124
Next, call [Set-AzStorageAccount](/powershell/module/az.storage/set-azstorageaccount), providing the resource ID for the user-assigned managed identity that you configured previously in the ISV's subscription, and the application (client) ID for the multi-tenant application that you configured previously in the ISV's subscription. Provide the key vault URI and key name from the customer's key vault.
125125

@@ -128,7 +128,7 @@ Remember to replace the placeholder values in brackets with your own values and
128128
```azurepowershell
129129
$accountName = "<storage-account>"
130130
$kvUri = "<key-vault-uri>"
131-
$keyName = "<keyName>"
131+
$keyName = "<key-name>"
132132
$multiTenantAppId = "<multi-tenant-app-id>"
133133
134134
Set-AzStorageAccount -ResourceGroupName $rgName `

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

Lines changed: 33 additions & 2 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: 10/04/2022
10+
ms.date: 10/14/2022
1111
ms.author: tamram
1212
ms.reviewer: ozgun
1313
ms.subservice: common
@@ -141,7 +141,38 @@ New-AzStorageAccount -ResourceGroupName $rgName `
141141

142142
### [Azure CLI](#tab/azure-cli)
143143

144-
To configure cross-tenant customer-managed keys for a new storage account in Azure CLI, call [New-AzStorageAccount](/powershell/module/az.storage/new-azstorageaccount), providing the resource ID for the user-assigned managed identity that you configured previously in the ISV's subscription, and the application (client) ID for the multi-tenant application that you configured previously in the ISV's subscription. Remember to replace the placeholder values in brackets with your own values and to use the variables defined in the previous examples.
144+
To configure cross-tenant customer-managed keys for a new storage account with Azure CLI, first install the [storage-preview](https://github.com/Azure/azure-cli-extensions/tree/main/src/storage-preview) extension. For more information about installing Azure CLI extensions, see [How to install and manage Azure CLI extensions](/cli/azure/azure-cli-extensions-overview).
145+
146+
Next, call [az storage account create](/cli/azure/storage/account#az-storage-account-create), providing the resource ID for the user-assigned managed identity that you configured previously in the ISV's subscription, and the application (client) ID for the multi-tenant application that you configured previously in the ISV's subscription. Provide the key vault URI and key name from the customer's key vault.
147+
148+
Remember to replace the placeholder values in brackets with your own values and to use the variables defined in the previous examples.
149+
150+
```azurecli
151+
accountName="<storage-account>"
152+
kvUri="<key-vault-uri>"
153+
keyName="<key-name>"
154+
multiTenantAppId="<multi-tenant-app-id>"
155+
156+
# Get the resource ID for the user-assigned managed identity.
157+
identityResourceId=$(az identity show --name $managedIdentity \
158+
--resource-group $isvRgName \
159+
--query id \
160+
--output tsv)
161+
162+
az storage account create \
163+
--name $accountName \
164+
--resource-group $isvRgName \
165+
--location $isvLocation \
166+
--sku Standard_LRS \
167+
--kind StorageV2 \
168+
--identity-type SystemAssigned,UserAssigned \
169+
--user-identity-id $identityResourceId \
170+
--encryption-key-vault $kvUri \
171+
--encryption-key-name $keyName \
172+
--encryption-key-source Microsoft.Keyvault \
173+
--key-vault-user-identity-id $identityResourceId \
174+
--key-vault-federated-client-id $multiTenantAppId
175+
```
145176

146177
---
147178

0 commit comments

Comments
 (0)