Skip to content

Commit 329e8c1

Browse files
authored
Merge pull request #283281 from RoseHJM/ade-private-repos
ADE - update extensibility model with private repo content.
2 parents 9f9de0c + 6770866 commit 329e8c1

File tree

4 files changed

+69
-7
lines changed

4 files changed

+69
-7
lines changed

articles/deployment-environments/how-to-configure-extensibility-generic-container-image.md

Lines changed: 69 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ ms.service: azure-deployment-environments
66
ms.custom: devx-track-azurecli
77
author: RoseHJM
88
ms.author: rosemalcolm
9-
ms.date: 05/28/2024
9+
ms.date: 08/01/2024
1010
ms.topic: how-to
1111
#customer intent: As a developer, I want to learn how to build and utilize custom images with my environment definitions for deployment environments.
1212
---
1313

1414
# Configure a container image to execute deployments
1515

16-
In this article, you learn how to build custom container images to deploy your environment definitions in Azure Deployment Environments (ADE).
16+
In this article, you learn how to build custom container images to deploy your [environment definitions](configure-environment-definition.md) in Azure Deployment Environments (ADE).
1717

1818
An environment definition comprises at least two files: a template file, like *azuredeploy.json*, and a manifest file named *environment.yaml*. ADE uses containers to deploy environment definitions, and natively supports the Azure Resource Manager (ARM) and Bicep IaC frameworks.
1919

20-
The ADE extensibility model enables you to create custom container images to use with your environment definitions. By using the extensibility model, you can create your own custom container images, and store them in a container registry like DockerHub. You can then reference these images in your environment definitions to deploy your environments.
20+
The ADE extensibility model enables you to create custom container images to use with your environment definitions. By using the extensibility model, you can create your own custom container images, and store them in a container registry like Azure Container Registry (ACR) or Docker Hub. You can then reference these images in your environment definitions to deploy your environments.
2121

2222
The ADE team provides a selection of images to get you started, including a core image, and an Azure Resource Manager (ARM)/Bicep image. You can access these sample images in the [Runner-Images](https://aka.ms/deployment-environments/runner-images) folder.
2323

@@ -112,7 +112,9 @@ RUN find /scripts/ -type f -iname "*.sh" -exec chmod +x {} \;
112112

113113
## Make the custom image accessible to ADE
114114

115-
You must build your Docker image and push it to your container registry to make it available for use in ADE. You can build your image using the Docker CLI, or by using a script provided by ADE.
115+
You must build your Docker image and push it to a container registry to make it available for use in ADE.
116+
117+
You can build your image using the Docker CLI, or by using a script provided by ADE.
116118

117119
Select the appropriate tab to learn more about each approach.
118120

@@ -132,11 +134,18 @@ docker build . -t {YOUR_REGISTRY}.azurecr.io/customImage:1.0.0
132134

133135
### Push the image to a registry
134136

135-
In order to use custom images, you need to set up a publicly accessible image registry with anonymous image pull enabled. This way, Azure Deployment Environments can access your custom image to execute in our container.
137+
In order to use custom images, you need to store them in a container registry. Azure Container Registry (ACR) is highly recommended for that. Due to its tight integration with ADE, the image can be published without allowing public anonymous pull access.
138+
139+
It's also possible to store the image in a different container registry such as Docker Hub, but in that case it needs to be publicly accessible.
140+
141+
> [!Caution]
142+
> Storing your container image in a registry with anonymous (unauthenticated) pull access makes it publicly accessible. Don't do that if your image contains any sensitive information. Instead, store it in Azure Container Registry (ACR) with anonymous pull access disabled.
143+
144+
To use a custom image stored in ACR, you need to ensure that ADE has appropriate permissions to access your image. When you create an ACR instance, it's secure by default and only allows authenticated users to gain access.
136145

137-
Azure Container Registry is an Azure offering that stores container images and similar artifacts.
146+
To create an instance of ACR, which can be done through the Azure CLI, the Azure portal, PowerShell commands, and more, follow one of the [quickstarts](/azure/container-registry/container-registry-get-started-azure-cli).
138147

139-
To create a registry, which can be done through the Azure CLI, the Azure portal, PowerShell commands, and more, follow one of the [quickstarts](/azure/container-registry/container-registry-get-started-azure-cli).
148+
#### Use a public registry with anonymous pull
140149

141150
To set up your registry to have anonymous image pull enabled, run the following commands in the Azure CLI:
142151

@@ -152,6 +161,59 @@ When you're ready to push your image to your registry, run the following command
152161
```docker
153162
docker push {YOUR_REGISTRY}.azurecr.io/{YOUR_IMAGE_LOCATION}:{YOUR_TAG}
154163
```
164+
#### Use ACR with secured access
165+
166+
By default, access to pull or push content from an Azure Container Registry is only available to authenticated users. You can further secure access to ACR by limiting access from certain networks and assigning specific roles.
167+
168+
##### Limit network access
169+
170+
To secure network access to your ACR, you can limit access to your own networks, or disable public network access entirely. If you limit network access, you must enable the firewall exception *Allow trusted Microsoft services to access this container registry*.
171+
172+
To disable access from public networks:
173+
174+
1. [Create an ACR instance](/azure/container-registry/container-registry-get-started-azure-cli) or use an existing one.
175+
1. In the Azure portal, go to the ACR that you want to configure.
176+
1. On the left menu, under **Settings**, select **Networking**.
177+
1. On the Networking page, on the **Public access** tab, under **Public network access**, select **Disabled**.
178+
179+
:::image type="content" source="media/how-to-configure-extensibility-generic-container-image/container-registry-network-settings.png" alt-text="Screenshot of the Azure portal, showing the ACR network settings, with Public access and Disabled highlighted.":::
180+
181+
1. Under **Firewall exception**, check that **Allow trusted Microsoft services to access this container registry** is selected, and then select **Save**.
182+
183+
:::image type="content" source="media/how-to-configure-extensibility-generic-container-image/container-registry-network-disable-public.png" alt-text="Screenshot of the ACR network settings, with Allow trusted Microsoft services to access this container registry and Save highlighted.":::
184+
185+
##### Assign the AcrPull role
186+
187+
Creating environments by using container images uses the ADE infrastructure, including projects and environment types. Each project has one or more project environment types, which need read access to the container image that defines the environment to be deployed. To access the images within your ACR securely, assign the AcrPull role to each project environment type.
188+
189+
To assign the AcrPull role to the Project Environment Type:
190+
191+
1. In the Azure portal, go to the ACR that you want to configure.
192+
1. On the left menu, select **Access Control (IAM)**.
193+
1. Select **Add** > **Add role assignment**.
194+
1. Assign the following role. For detailed steps, see [Assign Azure roles using the Azure portal](../role-based-access-control/role-assignments-portal.yml).
195+
196+
| Setting | Value |
197+
| --- | --- |
198+
| **Role** | Select **AcrPull**. |
199+
| **Assign access to** | Select **User, group, or service principal**. |
200+
| **Members** | Enter the name of the project environment type that needs to access the image in the container. |
201+
202+
The project environment type displays like the following example:
203+
204+
:::image type="content" source="media/how-to-configure-extensibility-generic-container-image/container-registry-access-control.png" alt-text="Screenshot of the Select members pane, showing a list of project environment types with part of the name highlighted.":::
205+
206+
In this configuration, ADE uses the Managed Identity for the PET, whether system assigned or user assigned.
207+
208+
> [!Tip]
209+
> This role assignment has to be made for every project environment type. It can be automated through the Azure CLI.
210+
211+
When you're ready to push your image to your registry, run the following command:
212+
213+
```docker
214+
docker push {YOUR_REGISTRY}.azurecr.io/{YOUR_IMAGE_LOCATION}:{YOUR_TAG}
215+
```
216+
155217
## [Build a container image with a script](#tab/build-a-container-image-with-a-script/)
156218

157219
[!INCLUDE [custom-image-script](includes/custom-image-script.md)]
Loading
Loading
Loading

0 commit comments

Comments
 (0)