Skip to content

Commit 059bc7d

Browse files
authored
Merge pull request #283459 from RoseHJM/ade-private-repos-arm
ADE - Updates for private repos (Bicep)
2 parents 148e156 + f4de67e commit 059bc7d

File tree

4 files changed

+67
-5
lines changed

4 files changed

+67
-5
lines changed

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

Lines changed: 67 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ ms.topic: how-to
1313

1414
# Configure container image to execute deployments with ARM and Bicep
1515

16-
In this article, you learn how to build custom Azure Resource Manager (ARM) and Bicep container images to deploy your environment definitions in Azure Deployment Environments (ADE).
16+
In this article, you learn how to build custom Azure Resource Manager (ARM) and Bicep 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* or *main.bicep*, and a manifest file named *environment.yaml*. ADE uses containers to deploy environment definitions, and natively supports the 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

@@ -214,7 +214,9 @@ echo "{\"outputs\": $deploymentOutput}" > $ADE_OUTPUTS
214214

215215
## Make the custom image accessible to ADE
216216

217-
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.
217+
You must build your Docker image and push it to your container registry to make it available for use in ADE.
218+
219+
You can build your image using the Docker CLI, or by using a script provided by ADE.
218220

219221
Select the appropriate tab to learn more about each approach.
220222

@@ -234,12 +236,19 @@ docker build . -t {YOUR_REGISTRY}.azurecr.io/customImage:1.0.0
234236

235237
### Push the Docker image to a registry
236238

237-
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.
239+
In order to use custom images, you need to store them in a container registry. Azure Container Instances (ACR) is highly recommended for that. Due to its tight integration with ADE, the image can be published without allowing public anonymous pull access.
240+
241+
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.
238242

239-
Azure Container Registry is an Azure offering that stores container images and similar artifacts.
243+
> [!Caution]
244+
> Enabling anonymous (unauthenticated) pull access makes all registry content publicly available for read (pull) actions.
245+
246+
To use a custom image stored in ACR, you need to ensure that ADE has appropriate permissions to access your image. Anonymous pull access is disabled by default in ACR.
240247

241248
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).
242249

250+
#### Use a public registry with anonymous pull
251+
243252
To set up your registry to have anonymous image pull enabled, run the following commands in the Azure CLI:
244253

245254
```azurecli
@@ -255,6 +264,59 @@ When you're ready to push your image to your registry, run the following command
255264
docker push {YOUR_REGISTRY}.azurecr.io/{YOUR_IMAGE_LOCATION}:{YOUR_TAG}
256265
```
257266

267+
#### Use ACR with secured access
268+
269+
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.
270+
271+
##### Limit network access
272+
273+
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*.
274+
275+
To disable access from public networks:
276+
277+
1. [Create an ACR instance](/azure/container-registry/container-registry-get-started-azure-cli) or use an existing one.
278+
1. In the Azure portal, go to the ACR that you want to configure.
279+
1. On the left menu, under **Settings**, select **Networking**.
280+
1. On the Networking page, on the **Public access** tab, under **Public network access**, select **Disabled**.
281+
282+
:::image type="content" source="media/how-to-configure-extensibility-bicep-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.":::
283+
284+
1. Under **Firewall exception**, check that **Allow trusted Microsoft services to access this container registry** is selected, and then select **Save**.
285+
286+
:::image type="content" source="media/how-to-configure-extensibility-bicep-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.":::
287+
288+
##### Assign the AcrPull role
289+
290+
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.
291+
292+
To assign the AcrPull role to the Project Environment Type:
293+
294+
1. In the Azure portal, go to the ACR that you want to configure.
295+
1. On the left menu, select **Access Control (IAM)**.
296+
1. Select **Add** > **Add role assignment**.
297+
1. Assign the following role. For detailed steps, see [Assign Azure roles using the Azure portal](../role-based-access-control/role-assignments-portal.yml).
298+
299+
| Setting | Value |
300+
| --- | --- |
301+
| **Role** | Select **AcrPull**. |
302+
| **Assign access to** | Select **User, group, or service principal**. |
303+
| **Members** | Enter the name of the project environment type that needs to access the image in the container. |
304+
305+
The project environment type displays like the following example:
306+
307+
:::image type="content" source="media/how-to-configure-extensibility-bicep-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.":::
308+
309+
In this configuration, ADE uses the Managed Identity for the PET, whether system assigned or user assigned.
310+
311+
> [!Tip]
312+
> This role assignment has to be made for every project environment type. It can be automated through the Azure CLI.
313+
When you're ready to push your image to your registry, run the following command:
314+
315+
```docker
316+
docker push {YOUR_REGISTRY}.azurecr.io/{YOUR_IMAGE_LOCATION}:{YOUR_TAG}
317+
```
318+
319+
258320
## [Build a container image with a script](#tab/build-a-container-image-with-a-script/)
259321

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

0 commit comments

Comments
 (0)