Skip to content

Commit a734bbd

Browse files
authored
Merge pull request #99460 from dlepow/acifresh6
[ACI Freshness] Using ACR
2 parents 77bc7ca + e9e2415 commit a734bbd

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

articles/container-instances/container-instances-using-azure-container-registry.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Deploy container image from Azure Container Registry
33
description: Learn how to deploy containers in Azure Container Instances using container images in an Azure container registry.
44
services: container-instances
55
ms.topic: article
6-
ms.date: 01/04/2019
6+
ms.date: 12/30/2019
77
ms.author: danlep
88
ms.custom: mvc
99
---
@@ -20,15 +20,19 @@ ms.custom: mvc
2020

2121
## Configure registry authentication
2222

23-
In any production scenario, access to an Azure container registry should be provided by using [service principals](../container-registry/container-registry-auth-service-principal.md). Service principals allow you to provide [role-based access control](../container-registry/container-registry-roles.md) to your container images. For example, you can configure a service principal with pull-only access to a registry.
23+
In a production scenario where you provide access to "headless" services and applications, it's recommended to configure registry access by using a [service principal](../container-registry/container-registry-auth-service-principal.md). A service principal allows you to provide [role-based access control](../container-registry/container-registry-roles.md) to your container images. For example, you can configure a service principal with pull-only access to a registry.
24+
25+
Azure Container Registry provides additional [authentication options](../container-registry/container-registry-authentication.md).
2426

2527
In the following section, you create an Azure key vault and a service principal, and store the service principal's credentials in the vault.
2628

2729
### Create key vault
2830

2931
If you don't already have a vault in [Azure Key Vault](../key-vault/key-vault-overview.md), create one with the Azure CLI using the following commands.
3032

31-
Update the `RES_GROUP` variable with the name of an existing resource group in which to create the key vault, and `ACR_NAME` with the name of your container registry. Specify a name for your new key vault in `AKV_NAME`. The vault name must be unique within Azure and must be 3-24 alphanumeric characters in length, begin with a letter, end with a letter or digit, and cannot contain consecutive hyphens.
33+
Update the `RES_GROUP` variable with the name of an existing resource group in which to create the key vault, and `ACR_NAME` with the name of your container registry. For brevity, commands in this article assume that your registry, key vault, and container instances are all created in the same resource group.
34+
35+
Specify a name for your new key vault in `AKV_NAME`. The vault name must be unique within Azure and must be 3-24 alphanumeric characters in length, begin with a letter, end with a letter or digit, and cannot contain consecutive hyphens.
3236

3337
```azurecli
3438
RES_GROUP=myresourcegroup # Resource Group name
@@ -40,12 +44,12 @@ az keyvault create -g $RES_GROUP -n $AKV_NAME
4044

4145
### Create service principal and store credentials
4246

43-
You now need to create a service principal and store its credentials in your key vault.
47+
Now create a service principal and store its credentials in your key vault.
4448

4549
The following command uses [az ad sp create-for-rbac][az-ad-sp-create-for-rbac] to create the service principal, and [az keyvault secret set][az-keyvault-secret-set] to store the service principal's **password** in the vault.
4650

4751
```azurecli
48-
# Create service principal, store its password in AKV (the registry *password*)
52+
# Create service principal, store its password in vault (the registry *password*)
4953
az keyvault secret set \
5054
--vault-name $AKV_NAME \
5155
--name $ACR_NAME-pull-pwd \
@@ -62,14 +66,14 @@ The `--role` argument in the preceding command configures the service principal
6266
Next, store the service principal's *appId* in the vault, which is the **username** you pass to Azure Container Registry for authentication.
6367

6468
```azurecli
65-
# Store service principal ID in AKV (the registry *username*)
69+
# Store service principal ID in vault (the registry *username*)
6670
az keyvault secret set \
6771
--vault-name $AKV_NAME \
6872
--name $ACR_NAME-pull-usr \
6973
--value $(az ad sp show --id http://$ACR_NAME-pull --query appId --output tsv)
7074
```
7175

72-
You've created an Azure Key Vault and stored two secrets in it:
76+
You've created an Azure key vault and stored two secrets in it:
7377

7478
* `$ACR_NAME-pull-usr`: The service principal ID, for use as the container registry **username**.
7579
* `$ACR_NAME-pull-pwd`: The service principal password, for use as the container registry **password**.
@@ -111,18 +115,22 @@ Once the container has started successfully, you can navigate to its FQDN in you
111115

112116
## Deploy with Azure Resource Manager template
113117

114-
You can specify the properties of your Azure Container Registry in an Azure Resource Manager template by including the `imageRegistryCredentials` property in the container group definition:
118+
You can specify the properties of your Azure container registry in an Azure Resource Manager template by including the `imageRegistryCredentials` property in the container group definition. For example, you can specify the registry credentials directly:
115119

116120
```JSON
121+
[...]
117122
"imageRegistryCredentials": [
118123
{
119124
"server": "imageRegistryLoginServer",
120125
"username": "imageRegistryUsername",
121126
"password": "imageRegistryPassword"
122127
}
123128
]
129+
[...]
124130
```
125131

132+
For complete container group settings, see the [Resource Manager template reference](/azure/templates/Microsoft.ContainerInstance/2018-10-01/containerGroups).
133+
126134
For details on referencing Azure Key Vault secrets in a Resource Manager template, see [Use Azure Key Vault to pass secure parameter value during deployment](../azure-resource-manager/resource-manager-keyvault-parameter.md).
127135

128136
## Deploy with Azure portal
21.7 KB
Loading

0 commit comments

Comments
 (0)