Skip to content

Commit a3b37b0

Browse files
edits
1 parent 5dedef8 commit a3b37b0

File tree

6 files changed

+69
-12
lines changed

6 files changed

+69
-12
lines changed

.openpublishing.redirection.container-service.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
{
22
"redirections": [
3-
{
4-
"source_path_from_root": "/articles/container-service/container-registry-auth-aci.md",
5-
"redirect_url": "/azure/container-service/container-registry-authentication",
6-
"redirect_document_id": false
7-
},
83
{
94
"source_path_from_root": "/articles/container-service/dcos-swarm/container-service-application-specific-marathon.md",
105
"redirect_url": "/previous-versions/azure/container-service/dcos-swarm/container-service-application-specific-marathon",

.openpublishing.redirection.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3919,11 +3919,6 @@
39193919
"redirect_url": "/azure/batch/monitor-batch",
39203920
"redirect_document_id": false
39213921
},
3922-
{
3923-
"source_path_from_root": "/articles/container-registry/container-registry-auth-aci.md",
3924-
"redirect_url": "/azure/container-registry/container-registry-authentication",
3925-
"redirect_document_id": false
3926-
},
39273922
{
39283923
"source_path_from_root": "/articles/event-hubs/move-cluster-across-regions.md",
39293924
"redirect_url": "/azure/operational-excellence/relocation-event-hub-cluster",

articles/container-instances/container-instances-tutorial-deploy-app.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ In this section, you use the Azure CLI to deploy the image built in the [first t
3333

3434
When you deploy an image that's hosted in a private Azure container registry like the one created in the [second tutorial](container-instances-tutorial-prepare-acr.md), you must supply credentials to access the registry.
3535

36-
A best practice for many scenarios is to create and configure a Microsoft Entra service principal with *pull* permissions to your registry. Take note of the *service principal ID* and *service principal password*. You use these credentials to access the registry when you deploy the container.
36+
A best practice for many scenarios is to create and configure a Microsoft Entra service principal with *pull* permissions to your registry. See [Authenticate with Azure Container Registry from Azure Container Instances](../container-registry/container-registry-auth-aci.md) for sample scripts to create a service principal with the necessary permissions. Take note of the *service principal ID* and *service principal password*. You use these credentials to access the registry when you deploy the container.
3737

3838
You also need the full name of the container registry login server (replace `<acrName>` with the name of your registry):
3939

articles/container-registry/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@
178178
href: container-registry-authentication-managed-identity.md
179179
- name: Authenticate with token
180180
href: container-registry-repository-scoped-permissions.md
181+
- name: Authenticate from Azure Container Instances
182+
href: container-registry-auth-aci.md
181183
- name: Authenticate from Kubernetes
182184
items:
183185
- name: Kubernetes scenarios

articles/container-registry/buffer-gate-public-content.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ Expanding on image import, set up an [Azure Container Registry task](container-r
126126
For a detailed example, see [How to consume and maintain public content with Azure Container Registry Tasks](tasks-consume-public-content.md).
127127

128128
> [!NOTE]
129-
> A single preconfigured task can automatically rebuild every application image that references a dependent base image.
129+
> A single pre configured task can automatically rebuild every application image that references a dependent base image.
130130
131131
## Next steps
132132
* Learn more about [ACR Tasks](container-registry-tasks-overview.md) to build, run, push, and patch container images in Azure.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
title: Access from Container Instances
3+
description: Learn how to provide access to images in your private container registry from Azure Container Instances by using a Microsoft Entra service principal.
4+
ms.topic: article
5+
ms.custom: devx-track-azurecli
6+
ms.service: container-registry
7+
author: tejaswikolli-web
8+
ms.author: tejaswikolli
9+
ms.date: 10/31/2023
10+
---
11+
12+
# Authenticate with Azure Container Registry from Azure Container Instances
13+
14+
You can use a Microsoft Entra service principal to provide access to your private container registries in Azure Container Registry.
15+
16+
In this article, you learn to create and configure a Microsoft Entra service principal with *pull* permissions to your registry. Then, you start a container in Azure Container Instances (ACI) that pulls its image from your private registry, using the service principal for authentication.
17+
18+
## When to use a service principal
19+
20+
You should use a service principal for authentication from ACI in **headless scenarios**, such as in applications or services that create container instances in an automated or otherwise unattended manner.
21+
22+
For example, if you have an automated script that runs nightly and creates a [task-based container instance](../container-instances/container-instances-restart-policy.md) to process some data, it can use a service principal with pull-only permissions to authenticate to the registry. You can then rotate the service principal's credentials or revoke its access completely without affecting other services and applications.
23+
24+
Service principals should also be used when the registry [admin user](container-registry-authentication.md#admin-account) is disabled.
25+
26+
[!INCLUDE [container-registry-service-principal](../../includes/container-registry-service-principal.md)]
27+
28+
## Authenticate using the service principal
29+
30+
To launch a container in Azure Container Instances using a service principal, specify its ID for `--registry-username`, and its password for `--registry-password`.
31+
32+
```azurecli-interactive
33+
az container create \
34+
--resource-group myResourceGroup \
35+
--name mycontainer \
36+
--image mycontainerregistry.azurecr.io/myimage:v1 \
37+
--registry-login-server mycontainerregistry.azurecr.io \
38+
--registry-username <service-principal-ID> \
39+
--registry-password <service-principal-password>
40+
```
41+
42+
>[!Note]
43+
> We recommend running the commands in the most recent version of the Azure Cloud Shell. Set `export MSYS_NO_PATHCONV=1` for running on-perm bash environment.
44+
45+
## Sample scripts
46+
47+
You can find the preceding sample scripts for Azure CLI on GitHub, as well versions for Azure PowerShell:
48+
49+
* [Azure CLI][acr-scripts-cli]
50+
* [Azure PowerShell][acr-scripts-psh]
51+
52+
## Next steps
53+
54+
The following articles contain additional details on working with service principals and ACR:
55+
56+
* [Azure Container Registry authentication with service principals](container-registry-auth-service-principal.md)
57+
* [Authenticate with Azure Container Registry from Azure Kubernetes Service (AKS)](../aks/cluster-container-registry-integration.md)
58+
59+
<!-- IMAGES -->
60+
61+
<!-- LINKS - External -->
62+
[acr-scripts-cli]: https://github.com/Azure/azure-docs-cli-python-samples/tree/master/container-registry/create-registry/create-registry-service-principal-assign-role.sh
63+
[acr-scripts-psh]: https://github.com/Azure/azure-docs-powershell-samples/tree/master/container-registry
64+
65+
<!-- LINKS - Internal -->

0 commit comments

Comments
 (0)