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
#customer intent: As a developer, I want to learn how to build and utilize custom images within my environment definitions for deployment environments.
12
12
---
13
13
14
14
# Configure a container image to execute deployments with Terraform
15
15
16
-
In this article, you learn how to build custom Terraform container images to deploy your environment definitions in Azure Deployment Environments (ADE). You learn how to configure a custom image to provision infrastructure using the Terraform Infrastructure-as-Code (IaC) framework.
16
+
In this article, you learn how to build custom Terraform container images to deploy your [environment definitions](configure-environment-definition.md) in Azure Deployment Environments (ADE). You learn how to configure a custom image to provision infrastructure using the Terraform Infrastructure-as-Code (IaC) framework.
17
17
18
18
An environment definition comprises at least two files: a template file, like *main.tf*, and a manifest file named *environment.yaml*. You use a container to deploy environment definition that uses Terraform.
19
19
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 DockerHub. You can then reference these images in your environment definitions to deploy your environments.
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.
161
+
You must build your Docker image and push it to your container registry to make it available for use in ADE.
162
+
163
+
You can build your image using the Docker CLI, or by using a script provided by ADE.
162
164
163
165
Select the appropriate tab to learn more about each approach.
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.
183
+
In order to use custom images, you need to store them in a registry like Azure Container Registry (ACR) or Docker Hub.
184
+
185
+
To use a custom image stored in a public registry, you need to enable anonymous image pull. This way, Azure Deployment Environments can access your custom image to execute in our container.
186
+
187
+
> [!Caution]
188
+
> Enabling anonymous (unauthenticated) pull access makes all registry content publicly available for read (pull) actions.
189
+
190
+
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.
182
191
183
-
Azure Container Registry is an Azure offering that stores container images and similar artifacts.
192
+
#### Use a public registry with anonymous pull
184
193
185
194
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).
186
195
@@ -199,6 +208,58 @@ When you're ready to push your image to your registry, run the following command
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.
214
+
215
+
##### Limit network access
216
+
217
+
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*.
218
+
219
+
To disable access from public networks:
220
+
221
+
1.[Create an ACR instance](/azure/container-registry/container-registry-get-started-portal?tabs=azure-cli) or use an existing one.
222
+
1. In the Azure portal, go to the ACR that you want to configure.
223
+
1. On the left menu, under **Settings**, select **Networking**.
224
+
1. On the Networking page, on the **Public access** tab, under **Public network access**, select **Disabled**.
225
+
226
+
:::image type="content" source="media/how-to-configure-extensibility-terraform-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.":::
227
+
228
+
1. Under **Firewall exception**, check that **Allow trusted Microsoft services to access this container registry** is selected, and then select **Save**.
229
+
230
+
:::image type="content" source="media/how-to-configure-extensibility-terraform-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.":::
231
+
232
+
##### Assign the AcrPull role
233
+
234
+
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.
235
+
236
+
To assign the AcrPull role to the Project Environment Type:
237
+
238
+
1. In the Azure portal, go to the ACR that you want to configure.
239
+
1. On the left menu, select **Access Control (IAM)**.
240
+
1. Select **Add** > **Add role assignment**.
241
+
1. Assign the following role. For detailed steps, see [Assign Azure roles using the Azure portal](../role-based-access-control/role-assignments-portal.yml).
242
+
243
+
| Setting | Value |
244
+
| --- | --- |
245
+
|**Role**| Select **AcrPull**. |
246
+
|**Assign access to**| Select **User, group, or service principal**. |
247
+
|**Members**| Enter the name of the project environment type that needs to access the image in the container. |
248
+
249
+
The project environment type displays like the following example:
250
+
251
+
:::image type="content" source="media/how-to-configure-extensibility-terraform-container-image/container-registry-access-control-pet.png" alt-text="Screenshot of the Select members pane, showing a list of project environment types with part of the name highlighted.":::
252
+
253
+
In this configuration, ADE uses the Managed Identity for the PET, whether system assigned or user assigned.
254
+
255
+
> [!Tip]
256
+
> This role assignment has to be made for every project environment type. It can be automated through the Azure CLI.
257
+
When you're ready to push your image to your registry, run the following command:
0 commit comments