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
Copy file name to clipboardExpand all lines: articles/deployment-environments/how-to-configure-extensibility-pulumi-container-image.md
+69-4Lines changed: 69 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,8 @@ description: Learn how to use the ADE extensibility model to build and utilize c
5
5
ms.service: azure-deployment-environments
6
6
ms.custom: build-2024, devx-track-azurecli
7
7
author: MikhailShilkov
8
-
ms.date: 05/10/2024
8
+
ms.author: rosemalcolm
9
+
ms.date: 08/02/2024
9
10
ms.topic: how-to
10
11
#customer intent: As a developer, I want to learn how to build and utilize custom images with my environment definitions for deployment environments.
11
12
---
@@ -14,9 +15,9 @@ ms.topic: how-to
14
15
15
16
In this article, you learn how to utilize [Pulumi](https://pulumi.com) for deployments in Azure Deployment Environments (ADE). You learn how to use a standard image provided by Pulumi or how to configure a custom image to provision infrastructure using the Pulumi Infrastructure-as-Code (IaC) framework.
16
17
17
-
ADE supports an extensibility model that enables you to create custom images that you can use in your environment definitions. To use this extensibility model, you can create your own custom images, and store them in a public container registry. You can then reference these images in your environment definitions to deploy your environments.
18
+
ADE supports an extensibility model that enables you to create custom images that you can use in your environment definitions. To use this extensibility model, you can create your own custom 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.
18
19
19
-
An environment definition comprises at least two files: a Pulumi project file, *Pulumi.yaml*, and a manifest file named *environment.yaml*. It may also contain a user program written in your preferred programming language: C#, TypeScript, Python, etc. ADE uses containers to deploy environment definitions.
20
+
An [environment definition](configure-environment-definition.md) comprises at least two files: a Pulumi project file, *Pulumi.yaml*, and a manifest file named *environment.yaml*. It may also contain a user program written in your preferred programming language: C#, TypeScript, Python, etc. ADE uses containers to deploy environment definitions.
20
21
21
22
## Prerequisites
22
23
@@ -193,7 +194,18 @@ You can use Pulumi to create an Azure Container Registry and publish your image
193
194
194
195
#### Create an Azure Container Registry and publish your image manually via CLI
195
196
196
-
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).
197
+
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.
198
+
199
+
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.
200
+
201
+
> [!Caution]
202
+
> Enabling anonymous (unauthenticated) pull access makes all registry content publicly available for read (pull) actions.
203
+
204
+
To use a custom image stored in the 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. With this configuration, you don't have to enable anonymous pull access.
205
+
206
+
To create an instance of the 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).
207
+
208
+
#### Use a public registry with anonymous pull
197
209
198
210
To set up your registry to have anonymous image pull enabled, run the following commands in the Azure CLI:
199
211
@@ -210,6 +222,59 @@ 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.
228
+
229
+
##### Limit network access
230
+
231
+
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*.
232
+
233
+
To disable access from public networks:
234
+
235
+
1. [Create an ACR instance](/azure/container-registry/container-registry-get-started-azure-cli) or use an existing one.
236
+
1. In the Azure portal, go to the ACR that you want to configure.
237
+
1. On the left menu, under **Settings**, select**Networking**.
238
+
1. On the Networking page, on the **Public access** tab, under **Public network access**, select**Disabled**.
239
+
240
+
:::image type="content" source="media/how-to-configure-extensibility-pulumi-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.":::
241
+
242
+
1. Under **Firewall exception**, check that **Allow trusted Microsoft services to access this container registry** is selected, and thenselect**Save**.
243
+
244
+
:::image type="content" source="media/how-to-configure-extensibility-pulumi-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.":::
245
+
246
+
##### Assign the AcrPull role
247
+
248
+
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.
249
+
250
+
To assign the AcrPull role to the Project Environment Type:
251
+
252
+
1. In the Azure portal, go to the ACR that you want to configure.
253
+
1. On the left menu, select**Access Control (IAM)**.
254
+
1. Select **Add**>**Add role assignment**.
255
+
1. Assign the following role. For detailed steps, see [Assign Azure roles using the Azure portal](../role-based-access-control/role-assignments-portal.yml).
256
+
257
+
| Setting | Value |
258
+
| --- | --- |
259
+
|**Role**| Select **AcrPull**. |
260
+
|**Assign access to**| Select **User, group, or service principal**. |
261
+
|**Members**| Enter the name of the project environment type that needs to access the image in the container. |
262
+
263
+
The project environment type displays like the following example:
264
+
265
+
:::image type="content" source="media/how-to-configure-extensibility-pulumi-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.":::
266
+
267
+
In this configuration, ADE uses the Managed Identity for the PET, whether system assigned or user assigned.
268
+
269
+
> [!Tip]
270
+
> This role assignment has to be made for every project environment type. It can be automated through the Azure CLI.
271
+
272
+
When you're ready to push your image to your registry, run the following command:
### Connect the image to your environment definition
214
279
215
280
When authoring environment definitions to use your custom image in their deployment, edit the `runner` property on the manifest file (environment.yaml or manifest.yaml).
0 commit comments