Skip to content

Commit 2d5a382

Browse files
Merge pull request #311234 from v-albemi/pipelines
Freshness Edit: Azure Container Apps
2 parents a865ba5 + d635f46 commit 2d5a382

2 files changed

Lines changed: 53 additions & 47 deletions

File tree

articles/container-apps/azure-pipelines.md

Lines changed: 41 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
---
2-
title: Publish revisions with Azure Pipelines in Azure Container Apps
3-
description: Learn to automatically create new revisions in Azure Container Apps using an Azure DevOps pipeline
2+
title: Publish Revisions by Using Azure Pipelines in Azure Container Apps
3+
description: Learn how to automatically create new revisions in Azure Container Apps by using an Azure DevOps pipeline.
44
services: container-apps
55
author: craigshoemaker
66
ms.service: azure-container-apps
77
ms.custom:
88
- devx-track-azurecli
99
- ignite-2023
1010
ms.topic: how-to
11-
ms.date: 10/20/2024
11+
ms.date: 02/02/2026
1212
ms.author: cshoe
1313
---
1414

1515
# Deploy to Azure Container Apps from Azure Pipelines
1616

17-
Azure Container Apps allows you to use Azure Pipelines to publish [revisions](revisions.md) to your container app. As commits are pushed to your [Azure DevOps repository](/azure/devops/repos/), a pipeline is triggered which updates the container image in the container registry. Azure Container Apps creates a new revision based on the updated container image.
17+
Azure Container Apps enables you to use Azure Pipelines to publish [revisions](revisions.md) to your container app. As commits are pushed to your [Azure DevOps repository](/azure/devops/repos/), a pipeline is triggered that updates the container image in the container registry. Container Apps creates a new revision based on the updated container image.
1818

1919
Commits to a specific branch in your repository trigger the pipeline. When creating the pipeline, you decide which branch is the trigger.
2020

2121
## Container Apps Azure Pipelines task
2222

2323
The task supports the following scenarios:
2424

25-
* Build from a Dockerfile and deploy to Container Apps
26-
* Build from source code without a Dockerfile and deploy to Container Apps. Supported languages include .NET, Java, Node.js, PHP, and Python
27-
* Deploy an existing container image to Container Apps
25+
* Build from a Dockerfile and deploy to Container Apps.
26+
* Build from source code without a Dockerfile and deploy to Container Apps. Supported languages include .NET, Java, Node.js, PHP, and Python.
27+
* Deploy an existing container image to Container Apps.
2828

29-
With the production release, this task comes with Azure DevOps and no longer requires explicit installation. For the complete documentation, see [AzureContainerApps@1 - Azure Container Apps Deploy v1 task](/azure/devops/pipelines/tasks/reference/azure-container-apps-v1).
29+
With the production release, this task comes with Azure DevOps and doesn't require explicit installation. For the complete documentation, see [AzureContainerApps@1 - Azure Container Apps Deploy v1 task](/azure/devops/pipelines/tasks/reference/azure-container-apps-v1).
3030

3131
### Usage examples
3232

33-
Here are some common scenarios for using the task. For more information, see the [task's documentation](https://github.com/Azure/container-apps-deploy-pipelines-task/blob/main/README.md).
33+
Following are some common scenarios for using the task. For more information, see the [task's documentation](https://github.com/Azure/container-apps-deploy-pipelines-task/blob/main/README.md).
3434

3535
#### Build and deploy to Container Apps
3636

@@ -47,11 +47,11 @@ steps:
4747
resourceGroup: 'my-container-app-rg'
4848
```
4949
50-
The task uses the Dockerfile in `appSourcePath` to build the container image. If no Dockerfile is found, the task attempts to build the container image from source code in `appSourcePath`.
50+
The task uses the Dockerfile at `appSourcePath` to build the container image. If no Dockerfile is found, the task attempts to build the container image from source code in `appSourcePath`.
5151

5252
#### Deploy an existing container image to Container Apps
5353

54-
The following snippet shows how to deploy an existing container image to Container Apps. The task authenticates with the registry using the service connection. If the service connection's identity isn't assigned the `AcrPush` role for the registry, supply the registry's admin credentials using the `acrUsername` and `acrPassword` input parameters.
54+
The following snippet shows how to deploy an existing container image to Container Apps. The task authenticates with the registry by using the service connection. If the service connection's identity isn't assigned the `AcrPush` role for the registry, supply the registry's admin credentials by using the `acrUsername` and `acrPassword` input parameters.
5555

5656
```yaml
5757
steps:
@@ -64,57 +64,57 @@ steps:
6464
```
6565

6666
> [!IMPORTANT]
67-
> If you're building a container image in a separate step, make sure you use a unique tag such as the build ID instead of a stable tag like `latest`. For more information, see [Image tag best practices](/azure/container-registry/container-registry-image-tag-version).
67+
> If you're building a container image in a separate step, be sure to use a unique tag such as the build ID instead of a stable tag like `latest`. For more information, see [Image tag best practices](/azure/container-registry/container-registry-image-tag-version).
6868

6969
### Authenticate with Azure Container Registry
7070

71-
The Azure Container Apps task needs to authenticate with your Azure Container Registry to push the container image. The container app also needs to authenticate with your Azure Container Registry to pull the container image.
71+
The Container Apps task needs to authenticate with your Azure Container Registry to push the container image. The container app also needs to authenticate with your container registry to pull the container image.
7272

73-
To push images, the task automatically authenticates with the container registry specified in `acrName` using the service connection provided in `azureSubscription`. If the service connection's identity isn't assigned the `AcrPush` role for the registry, supply the registry's admin credentials using `acrUsername` and `acrPassword`.
73+
To push images, the task automatically authenticates with the container registry specified in `acrName` by using the service connection provided in `azureSubscription`. If the service connection's identity isn't assigned the `AcrPush` role for the registry, supply the registry's admin credentials by using `acrUsername` and `acrPassword`.
7474

75-
To pull images, Azure Container Apps uses either managed identity (recommended) or admin credentials to authenticate with the Azure Container Registry. To use managed identity, the target container app for the task must be [configured to use managed identity](managed-identity-image-pull.md). To authenticate with the registry's admin credentials, set the task's `acrUsername` and `acrPassword` inputs.
75+
To pull images, Container Apps uses either managed identity (recommended) or admin credentials to authenticate with the container registry. To use managed identity, the target container app for the task must be [configured to use managed identity](managed-identity-image-pull.md). To authenticate with the registry's admin credentials, set the task's `acrUsername` and `acrPassword` inputs.
7676

7777
## Configuration
7878

79-
Take the following steps to configure an Azure DevOps pipeline to deploy to Azure Container Apps.
79+
Complete the following steps to configure an Azure DevOps pipeline to deploy to Container Apps.
8080

8181
> [!div class="checklist"]
8282
> * Create an Azure DevOps repository for your app
8383
> * Create a container app with managed identity enabled
84-
> * Assign the `AcrPull` role for the Azure Container Registry to the container app's managed identity
85-
> * Install the Azure Container Apps task from the Azure DevOps Marketplace
84+
> * Assign the `AcrPull` role for the container registry to the container app's managed identity
8685
> * Configure an Azure DevOps service connection for your Azure subscription
8786
> * Create an Azure DevOps pipeline
8887

8988
### Prerequisites
9089

9190
| Requirement | Instructions |
9291
|--|--|
93-
| Azure account | If you don't have one, [create an account for free](https://azure.microsoft.com/pricing/purchase-options/azure-account?cid=msft_learn). You need the *Contributor* or *Owner* permission on the Azure subscription to proceed. Refer to [Assign Azure roles using the Azure portal](/azure/role-based-access-control/role-assignments-portal?tabs=current) for details. |
94-
| Azure DevOps project | Go to [Azure DevOps](https://azure.microsoft.com/services/devops/) and select *Start free*. Then create a new project. |
92+
| Azure account | If you don't have one, [create an account for free](https://azure.microsoft.com/pricing/purchase-options/azure-account?cid=msft_learn). You need the *Contributor* or *Owner* permission on the Azure subscription to complete the procedures in this article. For more information, see [Assign Azure roles using the Azure portal](/azure/role-based-access-control/role-assignments-portal?tabs=current). |
93+
| Azure DevOps project | Go to [Azure DevOps](https://azure.microsoft.com/services/devops/) and select **Get started with Azure**. Then create a new project. |
9594
| Azure CLI | Install the [Azure CLI](/cli/azure/install-azure-cli).|
9695

9796
### Create an Azure DevOps repository and clone the source code
9897

99-
Before creating a pipeline, the source code for your app must be in a repository.
98+
Before you create a pipeline, the source code for your app must be in a repository.
10099

101-
1. Sign in to [Azure DevOps](https://dev.azure.com/) and navigate to your project.
100+
1. Sign in to [Azure DevOps](https://dev.azure.com/) and go to your project.
102101

103-
1. Open the **Repos** page.
102+
1. Select **Repos** in the left pane.
104103

105-
1. In the top navigation bar, select the repositories dropdown and select **Import repository**.
104+
1. Select **Import a repository**.
106105

107-
1. Enter the following information and select **Import**:
106+
1. Enter the following values, and then select **Import**:
108107

109108
| Field | Value |
110109
|--|--|
111-
| **Repository type** | Git |
112-
| **Clone URL** | `https://github.com/Azure-Samples/containerapps-albumapi-csharp.git` |
113-
| **Name** | `my-container-app` |
110+
| **Repository type**| **Git**|
111+
| **Clone URL** | **https://github.com/Azure-Samples/containerapps-albumapi-csharp.git** |
112+
113+
1. Select **Import**.
114114

115115
1. Select **Clone** to view the repository URL and copy it.
116116

117-
1. Open a terminal and run the following command:
117+
1. Open a command prompt and run the following command:
118118

119119
```bash
120120
git clone <REPOSITORY_URL> my-container-app
@@ -124,7 +124,7 @@ Before creating a pipeline, the source code for your app must be in a repository
124124

125125
### Create a container app and configure managed identity
126126

127-
Create your container app using the `az containerapp up` command with the following steps. This command creates Azure resources, builds the container image, stores the image in a registry, and deploys to a container app.
127+
Create your container app by completing the following steps. The `az containerapp up` command creates Azure resources, builds the container image, stores the image in a registry, and deploys a container app.
128128

129129
After your app is created, you can add a managed identity to your app and assign the identity the `AcrPull` role to allow the identity to pull images from the registry.
130130

@@ -133,19 +133,19 @@ After your app is created, you can add a managed identity to your app and assign
133133

134134
### Create an Azure DevOps service connection
135135

136-
To deploy to Azure Container Apps, you need to create an Azure DevOps service connection for your Azure subscription.
136+
To deploy to Container Apps, you need to create an Azure DevOps service connection for your Azure subscription.
137137

138138
1. In Azure DevOps, select **Project settings**.
139139

140140
1. Select **Service connections**.
141141

142-
1. Select **New service connection**.
142+
1. Select **Create service connection**.
143143

144-
1. Select **Azure Resource Manager**.
144+
1. Select **Azure Resource Manager**, and then select **Next**.
145145

146-
1. Select **Service principal (automatic)** and select **Next**.
146+
1. Select **App registration (automatic)**, and then select **Next**.
147147

148-
1. Enter the following information and select **Save**:
148+
1. Provide the following values, and then select **Save**:
149149

150150
| Field | Value |
151151
|--|--|
@@ -159,10 +159,13 @@ To learn more about service connections, see [Connect to Microsoft Azure](/azure
159159

160160
1. In your Azure DevOps project, select **Pipelines**.
161161

162-
1. Select **New pipeline**.
162+
1. Select **Create pipeline**.
163163

164164
1. Select **Azure Repos Git**.
165165

166+
> [!NOTE]
167+
> If you don't see **Azure Repos Git** as an option, make sure your source code is pushed to a Git repository in your Azure DevOps project.
168+
166169
1. Select the repo that contains your source code (`my-container-app`).
167170

168171
1. Select **Starter pipeline**.
@@ -188,10 +191,10 @@ To learn more about service connections, see [Connect to Microsoft Azure](/azure
188191
resourceGroup: 'my-container-app-rg'
189192
```
190193

191-
Replace `<AZURE_SUBSCRIPTION_SERVICE_CONNECTION>` with the name of the Azure DevOps service connection (`my-subscription-service-connection`) you created in the previous step and `<ACR_NAME>` with the name of your Azure Container Registry.
194+
Replace `<AZURE_SUBSCRIPTION_SERVICE_CONNECTION>` with the name of the Azure DevOps service connection (`my-subscription-service-connection`) you created in the previous step. Replace `<ACR_NAME>` with the name of your Azure container registry.
192195

193196
1. Select **Save and run**.
194197

195-
An Azure Pipelines run starts to build and deploy your container app. To check its progress, navigate to *Pipelines* and select the run. During the first pipeline run, you might be prompted to authorize the pipeline to use your service connection.
198+
An Azure Pipelines run starts to build and deploy your container app. To check its progress, go to **Pipelines** and select the run. During the first pipeline run, you might be prompted to authorize the pipeline to use your service connection.
196199

197200
To deploy a new revision of your app, push a new commit to the *main* branch.

includes/container-apps-github-devops-setup.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ ms.date: 11/09/2022
66
author: v1212
77
ms.author: wujia
88
---
9-
1. Change into the *src* folder of the cloned repository.
9+
1. Switch to the *src* folder of the cloned repository:
1010

1111
```bash
1212
cd my-container-app
1313
cd src
1414
```
1515

16-
1. Create Azure resources and deploy a container app with the [`az containerapp up` command](../articles/container-apps/containerapp-up.md).
16+
1. Create Azure resources and deploy a container app by using the [`az containerapp up` command](../articles/container-apps/containerapp-up.md):
1717

1818
```azurecli
1919
az containerapp up \
@@ -22,17 +22,20 @@ ms.author: wujia
2222
--ingress external
2323
```
2424

25-
1. In the command output, note the name of the Azure Container Registry.
25+
> [!TIP]
26+
> If the build fails with a Debian repository error, make sure you're using the latest Azure CLI version and containerapp extension by running `az extension add --name containerapp --upgrade`. Alternatively, add a Dockerfile to your project for more control over the build.
2627
27-
1. Get the full resource ID of the container registry.
28+
1. In the command output, note the name of the Azure container registry.
29+
30+
1. Get the full resource ID of the container registry:
2831
2932
```azurecli
3033
az acr show --name <ACR_NAME> --query id --output tsv
3134
```
3235
3336
Replace `<ACR_NAME>` with the name of your registry.
3437
35-
1. Enable managed identity for the container app.
38+
1. Enable managed identity for the container app:
3639
3740
```azurecli
3841
az containerapp identity assign \
@@ -43,7 +46,7 @@ ms.author: wujia
4346
4447
Note the principal ID of the managed identity in the command output.
4548
46-
1. Assign the `AcrPull` role for the Azure Container Registry to the container app's managed identity.
49+
1. Assign the `AcrPull` role for the Container Registry to the container app's managed identity:
4750

4851
```azurecli
4952
az role assignment create \
@@ -52,9 +55,9 @@ ms.author: wujia
5255
--scope <ACR_RESOURCE_ID>
5356
```
5457

55-
Replace `<MANAGED_IDENTITY_PRINCIPAL_ID>` with the principal ID of the managed identity and `<ACR_RESOURCE_ID>` with the resource ID of the Azure Container Registry.
58+
Replace `<MANAGED_IDENTITY_PRINCIPAL_ID>` with the principal ID of the managed identity and `<ACR_RESOURCE_ID>` with the resource ID of the Container Registry.
5659

57-
1. Configure the container app to use the managed identity to pull images from the Azure Container Registry.
60+
1. Configure the container app to use the managed identity to pull images from the container registry:
5861

5962
```azurecli
6063
az containerapp registry set \
@@ -64,4 +67,4 @@ ms.author: wujia
6467
--identity system
6568
```
6669

67-
Replace `<ACR_NAME>` with the name of your Azure Container Registry.
70+
Replace `<ACR_NAME>` with the name of your Azure container registry.

0 commit comments

Comments
 (0)