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
You can build your image using the Docker CLI. Ensure the [Docker Engine is installed](https://docs.docker.com/desktop/) on your computer. Then, navigate to the directory of your Dockerfile, and run the following command:
For example, if you want to save your image under a repository within your registry named `customImage`, and upload with the tag version of `1.0.0`, you would run:
In order to use custom images, you need to store them in a container registry. You can use a public container registry or a private container registry. Azure Container Registry (ACR) is highly recommended, due to its tight integration with ADE, the image can be published without allowing public anonymous pull access. You must build your custom container image and push it to a container registry to make it available for use in ADE.
@@ -468,27 +482,15 @@ It's also possible to store the image in a different container registry such as
468
482
469
483
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.
470
484
471
-
::: zone pivot="arm-bicep,terraform"
485
+
::: zone pivot="pulumi"
486
+
You can use Pulumi to create an Azure Container Registry and publish your image to it. Refer to the [Provisioning/custom-image](https://github.com/pulumi/azure-deployment-environments/tree/main/Provisioning/custom-image) example for a self-contained Pulumi project that creates all the required resources in your Azure account.
487
+
::: zone-end
472
488
473
489
Select the appropriate tab to learn more about each approach.
474
490
475
491
### [Public registry](#tab/public-registry/)
476
492
477
-
**1. Build the image**
478
-
479
-
You can build your image using the Docker CLI. Ensure the [Docker Engine is installed](https://docs.docker.com/desktop/) on your computer. Then, navigate to the directory of your Dockerfile, and run the following command:
For example, if you want to save your image under a repository within your registry named `customImage`, and upload with the tag version of `1.0.0`, you would run:
You can build your image using the Docker CLI. Ensure the [Docker Engine is installed](https://docs.docker.com/desktop/) on your computer. Then, navigate to the directory of your Dockerfile, and run the following command:
For example, if you want to save your image under a repository within your registry named `customImage`, and upload with the tag version of `1.0.0`, you would run:
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.
526
514
527
515
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).
528
516
529
-
**2.1 Limit network access**
517
+
**1. Limit network access**
530
518
531
519
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*.
532
520
@@ -543,7 +531,7 @@ To disable access from public networks:
543
531
544
532
:::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.":::
545
533
546
-
**2.2 Assign the AcrPull role**
534
+
**2. Assign the AcrPull role**
547
535
548
536
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.
## [Build a container image with a script](#tab/build-a-container-image-with-a-script/)
567
+
::: zone pivot="arm-bicep,terraform"
568
+
### Build a container image with a script
580
569
581
570
Rather than building your custom image and pushing it to a container registry yourself, you can use a script to build and push it to a specified container registry.
Before you build the image to be pushed to your registry, ensure the [Docker Engine is installed](https://docs.docker.com/desktop/) on your computer. Then, navigate to the directory of your Dockerfile, and run the following command:
For example, if you want to save your image under a repository within your registry named `customImage`, and upload with the tag version of `1.0.0`, you would run:
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.
605
-
606
-
#### Create an Azure Container Registry and publish your image with Pulumi
607
-
608
-
Azure Container Registry is an Azure offering that stores container images and similar artifacts.
609
-
610
-
You can use Pulumi to create an Azure Container Registry and publish your image to it. Refer to the [Provisioning/custom-image](https://github.com/pulumi/azure-deployment-environments/tree/main/Provisioning/custom-image) example for a self-contained Pulumi project that creates all the required resources in your Azure account.
611
-
612
-
#### Create an Azure Container Registry and publish your image manually via CLI
613
-
614
-
In order to use custom images, you need to store them in a container registry. Azure Container Registry (ACR) is highly recommended, due to its tight integration with ADE, the image can be published without allowing public anonymous pull access.
615
-
616
-
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.
617
-
618
-
> [!Caution]
619
-
> 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.
620
-
621
-
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.
622
-
623
-
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).
624
-
625
-
#### Use a public registry with anonymous pull
626
-
627
-
To set up your registry to have anonymous image pull enabled, run the following commands in the Azure CLI:
628
-
629
-
```azurecli
630
-
az login
631
-
az acr login -n {YOUR_REGISTRY}
632
-
az acr update -n {YOUR_REGISTRY} --public-network-enabled true
633
-
az acr update -n {YOUR_REGISTRY} --anonymous-pull-enabled true
634
-
```
635
-
636
-
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.
645
-
646
-
##### Limit network access
647
-
648
-
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*.
649
-
650
-
To disable access from public networks:
651
-
652
-
1. [Create an ACR instance](/azure/container-registry/container-registry-get-started-azure-cli) or use an existing one.
653
-
1. In the Azure portal, go to the ACR that you want to configure.
654
-
1. On the left menu, under **Settings**, select **Networking**.
655
-
1. On the Networking page, on the **Public access** tab, under **Public network access**, select **Disabled**.
656
-
657
-
:::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.":::
658
-
659
-
1. Under **Firewall exception**, check that **Allow trusted Microsoft services to access this container registry** is selected, and then select **Save**.
660
-
661
-
:::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.":::
662
-
663
-
##### Assign the AcrPull role
664
-
665
-
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.
666
-
667
-
To assign the AcrPull role to the Project Environment Type:
668
-
669
-
1. In the Azure portal, go to the ACR that you want to configure.
670
-
1. On the left menu, select **Access Control (IAM)**.
671
-
1. Select **Add** > **Add role assignment**.
672
-
1. Assign the following role. For detailed steps, see [Assign Azure roles using the Azure portal](../role-based-access-control/role-assignments-portal.yml).
673
-
674
-
| Setting | Value |
675
-
| --- | --- |
676
-
| **Role** | Select **AcrPull**. |
677
-
| **Assign access to** | Select **User, group, or service principal**. |
678
-
| **Members** | Enter the name of the project environment type that needs to access the image in the container. |
679
-
680
-
The project environment type displays like the following example:
681
-
682
-
:::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.":::
683
-
684
-
In this configuration, ADE uses the Managed Identity for the PET, whether system assigned or user assigned.
685
-
686
-
> [!Tip]
687
-
> This role assignment has to be made for every project environment type. It can be automated through the Azure CLI.
688
-
689
-
When you're ready to push your image to your registry, run the following command:
## Connect the image to your environment definition
696
576
697
577
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).
@@ -708,4 +588,4 @@ To learn more about how to create environment definitions that use the ADE conta
0 commit comments