You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/container-instances/container-instances-encrypt-data.md
+75-40Lines changed: 75 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,7 @@ This article reviews two flows for encrypting data with a customer-managed key:
36
36
1. Encrypt data with a customer-managed key stored in a standard Azure Key Vault
37
37
2. Encrypt data with a customer-managed key stored in a network-proteted Azure Key Vault with [Trusted Services](../key-vault/general/network-security.md) enabled.
38
38
39
-
## Encrypt data with a customer-managed key in a network-proected Azure Key Vault with Trusted Services enabled
39
+
## Encrypt data with a customer-managed key stored in a standard Azure Key Vault
40
40
41
41
### Create Service Principal for ACI
42
42
@@ -243,31 +243,11 @@ az deployment group create --resource-group myResourceGroup --template-file depl
243
243
244
244
Within a few seconds, you should receive an initial response from Azure. Once the deployment completes, all data related to it persisted by the ACI service will be encrypted with the key you provided.
245
245
246
-
## Encrypt data with a customer-managed key in a standard Azure Key Vault
247
-
248
-
### Create Service Principal for ACI
249
-
250
-
The first step is to ensure that your [Azure tenant](../active-directory/develop/quickstart-create-new-tenant.md) has a service principal assigned for granting permissions to the Azure Container Instances service.
251
-
252
-
> [!IMPORTANT]
253
-
> In order to run the following command and create a service principal successfully, confirm that you have permissions to create service principals in your tenant.
254
-
>
255
-
256
-
The following CLI command will set up the ACI SP in your Azure environment:
257
-
258
-
```azurecli-interactive
259
-
az ad sp create --id 6bb8e274-af5d-4df2-98a3-4fd78b4cafd9
260
-
```
261
-
262
-
The output from running this command should show you a service principal that has been set up with "displayName": "Azure Container Instance Service."
263
-
264
-
In case you are unable to successfully create the service principal:
265
-
* confirm that you have permissions to do so in your tenant
266
-
* check to see if a service principal already exists in your tenant for deploying to ACI. You can do that by running `az ad sp show --id 6bb8e274-af5d-4df2-98a3-4fd78b4cafd9` and use that service principal instead
246
+
## Encrypt data with a customer-managed key in a network protected Azure Key Vault with Trusted Services enabled
267
247
268
248
### Create a Key Vault resource
269
249
270
-
Create an Azure Key Vault using [Azure portal](../key-vault/general/quick-create-portal.md), [Azure CLI](../key-vault/general/quick-create-cli.md), or [Azure PowerShell](../key-vault/general/quick-create-powershell.md).
250
+
Create an Azure Key Vault using [Azure portal](../key-vault/general/quick-create-portal.md), [Azure CLI](../key-vault/general/quick-create-cli.md), or [Azure PowerShell](../key-vault/general/quick-create-powershell.md). To start, do not apply any network-limitations so we can add necessary keys to the vault. In subsequent steps, we will add network-limitations and enable trusted services.
271
251
272
252
For the properties of your key vault, use the following guidelines:
273
253
* Name: A unique name is required.
@@ -285,33 +265,74 @@ Once your key vault is created, navigate to the resource in Azure portal. On the
285
265
286
266

287
267
268
+
### Create a user-assigned managed identity for your container group
269
+
Create an identity in your subscription using the [az identity create](/cli/azure/identity#az-identity-create) command. You can use the same resource group used to create the key vault, or use a different one.
270
+
271
+
```azurecli-interactive
272
+
az identity create \
273
+
--resource-group myResourceGroup \
274
+
--name myACIId
275
+
```
276
+
277
+
To use the identity in the following steps, use the [az identity show](/cli/azure/identity#az-identity-show) command to store the identity's service principal ID and resource ID in variables.
278
+
279
+
```azurecli-interactive
280
+
# Get service principal ID of the user-assigned identity
281
+
spID=$(az identity show \
282
+
--resource-group myResourceGroup \
283
+
--name myACIId \
284
+
--query principalId --output tsv)
285
+
```
286
+
288
287
### Set access policy
289
288
290
-
Create a new access policy for allowing the ACI service to access your Key.
289
+
Create a new access policy for allowing the user-assigned identity to access your Key.
291
290
292
-
* Once your key has been generated, back in your key vault resource blade, under Settings, click **Access Policies**.
293
-
* On the "Access Policies" page for your key vault, click **Add Access Policy**.
294
-
* Set the *Key Permissions* to include **Get** and **Unwrap Key**
The following commands set up an Azure Firewall for your Azure Key Vault and allow Azure Trusted Services such as ACI access.
305
+
306
+
```azurecli-interactive
307
+
az keyvault update \
308
+
--name mykeyvault \
309
+
--resource-group myResourceGroup \
310
+
--default-action Deny
311
+
```
312
+
313
+
```azurecli-interactive
314
+
az keyvault update \
315
+
--name mykeyvault \
316
+
--resource-group myResourceGroup \
317
+
--bypass AzureServices
318
+
```
319
+
303
320
### Modify your JSON deployment template
304
321
305
322
> [!IMPORTANT]
306
-
> Encrypting deployment data with a customer-managed key is available in the latest API version (2019-12-01) that is currently rolling out. Specify this API version in your deployment template. If you have any issues with this, please reach out to Azure Support.
323
+
> Encrypting deployment data with a customer-managed key is available in the latest API version (2022-09-01) that is currently rolling out. This API version is only available via ARM or REST. If you have any issues with this, please reach out to Azure Support.
307
324
308
325
Once the key vault key and access policy are set up, add the following properties to your ACI deployment template. Learn more about deploying ACI resources with a template in the [Tutorial: Deploy a multi-container group using a Resource Manager template](./container-instances-multi-container-group.md).
309
-
* Under `resources`, set `apiVersion` to `2019-12-01`.
326
+
* Under `resources`, set `apiVersion` to `2022-09-01`.
310
327
* Under the container group properties section of the deployment template, add an `encryptionProperties`, which contains the following values:
311
328
*`vaultBaseUrl`: the DNS Name of your key vault, can be found on the overview blade of the key vault resource in Portal
312
329
*`keyName`: the name of the key generated earlier
313
330
*`keyVersion`: the current version of the key. This can be found by clicking into the key itself (under "Keys" in the Settings section of your key vault resource)
314
-
* Under the container group properties, add a `sku` property with value `Standard`. The `sku` property is required in API version 2019-12-01.
331
+
*`identity`: this is the resource URI of the Managed Identity instance created earlier
332
+
* Under the container group properties, add a `sku` property with value `Standard`. The `sku` property is required in API version 2022-09-01.
333
+
* Under resources, add the `identity` object required to use Managed Identity with ACI, whichcontainsthe following values:
334
+
*`type`: the type of the identity being used (either user-assigned or system-assigned). This case will be set to "UserAssigned"
335
+
*`userAssignedIdentities`: the resourceURI of the same user-assigned identity used above in the `encryptionProperties` object.
315
336
316
337
The following template snippet shows these additional properties to encrypt deployment data:
317
338
@@ -323,11 +344,18 @@ The following template snippet shows these additional properties to encrypt depl
0 commit comments