Skip to content

Commit 41fa45b

Browse files
committed
CLI samples
1 parent a19e9e5 commit 41fa45b

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

articles/storage/blobs/TOC.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ items:
404404
href: ../common/customer-managed-keys-configure-new-account.md?toc=/azure/storage/blobs/toc.json
405405
- 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 keys and storage account 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-new-account.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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)