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/container-apps/azure-pipelines.md
+41-38Lines changed: 41 additions & 38 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,36 +1,36 @@
1
1
---
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.
4
4
services: container-apps
5
5
author: craigshoemaker
6
6
ms.service: azure-container-apps
7
7
ms.custom:
8
8
- devx-track-azurecli
9
9
- ignite-2023
10
10
ms.topic: how-to
11
-
ms.date: 10/20/2024
11
+
ms.date: 02/02/2026
12
12
ms.author: cshoe
13
13
---
14
14
15
15
# Deploy to Azure Container Apps from Azure Pipelines
16
16
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.
18
18
19
19
Commits to a specific branch in your repository trigger the pipeline. When creating the pipeline, you decide which branch is the trigger.
20
20
21
21
## Container Apps Azure Pipelines task
22
22
23
23
The task supports the following scenarios:
24
24
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.
28
28
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).
30
30
31
31
### Usage examples
32
32
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).
34
34
35
35
#### Build and deploy to Container Apps
36
36
@@ -47,11 +47,11 @@ steps:
47
47
resourceGroup: 'my-container-app-rg'
48
48
```
49
49
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`.
51
51
52
52
#### Deploy an existing container image to Container Apps
53
53
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.
55
55
56
56
```yaml
57
57
steps:
@@ -64,57 +64,57 @@ steps:
64
64
```
65
65
66
66
> [!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).
68
68
69
69
### Authenticate with Azure Container Registry
70
70
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.
72
72
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`.
74
74
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.
76
76
77
77
## Configuration
78
78
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.
80
80
81
81
> [!div class="checklist"]
82
82
> * Create an Azure DevOps repository for your app
83
83
> * 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
86
85
> * Configure an Azure DevOps service connection for your Azure subscription
87
86
> * Create an Azure DevOps pipeline
88
87
89
88
### Prerequisites
90
89
91
90
| Requirement | Instructions |
92
91
|--|--|
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. |
95
94
| Azure CLI | Install the [Azure CLI](/cli/azure/install-azure-cli).|
96
95
97
96
### Create an Azure DevOps repository and clone the source code
98
97
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.
100
99
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.
102
101
103
-
1. Open the **Repos** page.
102
+
1. Select **Repos** in the left pane.
104
103
105
-
1. In the top navigation bar, select the repositories dropdown and select **Import repository**.
104
+
1. Select **Import a repository**.
106
105
107
-
1. Enter the following information and select **Import**:
106
+
1. Enter the following values, and then select **Import**:
1. Select **Clone** to view the repository URL and copy it.
116
116
117
-
1. Open a terminal and run the following command:
117
+
1. Open a command prompt and run the following command:
118
118
119
119
```bash
120
120
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
124
124
125
125
### Create a container app and configure managed identity
126
126
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.
128
128
129
129
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.
130
130
@@ -133,19 +133,19 @@ After your app is created, you can add a managed identity to your app and assign
133
133
134
134
### Create an Azure DevOps service connection
135
135
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.
137
137
138
138
1. In Azure DevOps, select **Project settings**.
139
139
140
140
1. Select **Service connections**.
141
141
142
-
1. Select **New service connection**.
142
+
1. Select **Create service connection**.
143
143
144
-
1. Select **Azure Resource Manager**.
144
+
1. Select **Azure Resource Manager**, and then select **Next**.
145
145
146
-
1. Select **Service principal (automatic)** and select **Next**.
146
+
1. Select **App registration (automatic)**, and then select **Next**.
147
147
148
-
1. Enter the following information and select **Save**:
148
+
1. Provide the following values, and then select **Save**:
149
149
150
150
| Field | Value |
151
151
|--|--|
@@ -159,10 +159,13 @@ To learn more about service connections, see [Connect to Microsoft Azure](/azure
159
159
160
160
1. In your Azure DevOps project, select **Pipelines**.
161
161
162
-
1. Select **New pipeline**.
162
+
1. Select **Create pipeline**.
163
163
164
164
1. Select **Azure Repos Git**.
165
165
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
+
166
169
1. Select the repo that contains your source code (`my-container-app`).
167
170
168
171
1. Select **Starter pipeline**.
@@ -188,10 +191,10 @@ To learn more about service connections, see [Connect to Microsoft Azure](/azure
188
191
resourceGroup: 'my-container-app-rg'
189
192
```
190
193
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.
192
195
193
196
1. Select **Save and run**.
194
197
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.
196
199
197
200
To deploy a new revision of your app, push a new commit to the *main* branch.
Copy file name to clipboardExpand all lines: includes/container-apps-github-devops-setup.md
+12-9Lines changed: 12 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,14 +6,14 @@ ms.date: 11/09/2022
6
6
author: v1212
7
7
ms.author: wujia
8
8
---
9
-
1.Change into the *src* folder of the cloned repository.
9
+
1.Switch to the *src* folder of the cloned repository:
10
10
11
11
```bash
12
12
cd my-container-app
13
13
cd src
14
14
```
15
15
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):
17
17
18
18
```azurecli
19
19
az containerapp up \
@@ -22,17 +22,20 @@ ms.author: wujia
22
22
--ingress external
23
23
```
24
24
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.
26
27
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:
28
31
29
32
```azurecli
30
33
az acr show --name <ACR_NAME> --query id --output tsv
31
34
```
32
35
33
36
Replace `<ACR_NAME>` with the name of your registry.
34
37
35
-
1. Enable managed identity for the container app.
38
+
1. Enable managed identity for the container app:
36
39
37
40
```azurecli
38
41
az containerapp identity assign \
@@ -43,7 +46,7 @@ ms.author: wujia
43
46
44
47
Note the principal ID of the managed identity in the command output.
45
48
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:
47
50
48
51
```azurecli
49
52
az role assignment create \
@@ -52,9 +55,9 @@ ms.author: wujia
52
55
--scope <ACR_RESOURCE_ID>
53
56
```
54
57
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.
56
59
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:
58
61
59
62
```azurecli
60
63
az containerapp registry set \
@@ -64,4 +67,4 @@ ms.author: wujia
64
67
--identity system
65
68
```
66
69
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