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/tutorial-deploy-environments-in-cicd-azure-devops.md
+88-86Lines changed: 88 additions & 86 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,32 +1,31 @@
1
1
---
2
-
title: 'Tutorial: Deploy environments with Azure Pipelines'
3
-
description: Learn how to integrate Azure Deployment Environments into your Azure Pipelines CI/CD pipeline and streamline your software development process.
2
+
title: 'Tutorial: Deploy Environments with Azure Pipelines'
3
+
description: Learn how to integrate Azure Deployment Environments into your Azure Pipelines CI/CD pipeline to streamline your software development process.
4
4
author: RoseHJM
5
5
ms.author: rosemalcolm
6
6
ms.service: azure-deployment-environments
7
7
ms.topic: tutorial
8
-
ms.date: 02/26/2024
8
+
ms.date: 07/25/2025
9
9
10
-
# customer intent: As a developer, I want to use an Azure Pipeline to deploy an ADE deployment environment so that I can integrate it into a CI/CD development environment.
10
+
# customer intent: As a developer, I want to use Azure Pipelines to deploy an Azure Deployment Environments deployment environment so that I can integrate it into a CI/CD development environment.
11
11
---
12
12
13
13
# Tutorial: Deploy environments in CI/CD by using Azure Pipelines
14
14
15
-
In this tutorial, you learn how to integrate Azure Deployment Environments (ADE) into your Azure Pipelines CI/CD pipeline.
15
+
In this tutorial, you learn how to integrate Azure Deployment Environments into your Azure Pipelines CI/CD pipeline.
16
16
17
-
Continuous integration and continuous delivery (CI/CD) is a software development approach that helps teams to automate the process of building, testing, and deploying software changes. CI/CD enables you to release software changes more frequently and with greater confidence.
17
+
Continuous integration and continuous delivery (CI/CD) is a software development approach that helps teams automate the process of building, testing, and deploying software changes. CI/CD enables you to release software changes more frequently and with greater confidence.
18
18
19
-
Before beginning this tutorial, familiarize yourself with Deployment Environments resources and concepts by reviewing [Key concepts for Azure Deployment Environments](concept-environments-key-concepts.md).
19
+
Before starting this tutorial, familiarize yourself with Deployment Environments resources and concepts by reviewing [Key concepts for Azure Deployment Environments](concept-environments-key-concepts.md).
20
20
21
21
In this tutorial, you learn how to:
22
22
23
23
> [!div class="checklist"]
24
24
> * Create and configure an Azure Repos repository
25
-
> *Connect the catalog to your dev center
26
-
> * Configure service connection
25
+
> *Configure environment types
26
+
> * Configure a service connection
27
27
> * Create a pipeline
28
28
> * Create an environment
29
-
> * Test the CI/CD pipeline
30
29
31
30
## Prerequisites
32
31
@@ -36,150 +35,153 @@ In this tutorial, you learn how to:
36
35
- An Azure DevOps subscription.
37
36
-[Create an account for free](https://azure.microsoft.com/services/devops/?WT.mc_id=A261C142F).
38
37
- An Azure DevOps organization and project.
39
-
- Azure Deployment Environments.
40
-
-[Dev center and project](./quickstart-create-and-configure-devcenter.md).
38
+
-In Azure Deployment Environments:
39
+
-[A dev center and a project](./quickstart-create-and-configure-devcenter.md).
41
40
-[Sample catalog](https://github.com/Azure/deployment-environments) attached to the dev center.
42
41
43
42
## Create and configure an Azure Repos repository
44
43
45
-
1. Sign in to your Azure DevOps organization (`https://dev.azure.com/<your-organization>`), and select your project. Replace the `<your-organization>` text placeholder with your project identifier.
44
+
1. Sign in to your Azure DevOps organization (`https://dev.azure.com/<your-organization>`). Replace `<your-organization>` with your project identifier.
45
+
1. Select your project.
46
46
1. Select **Repos** > **Files**.
47
47
1. In **Import a repository**, select **Import**.
48
48
1. In **Import a Git repository**, select or enter the following:
Environment types define the different types of environments your development teams can deploy. You can apply different settings for each environment type. You create environment types at the dev center level and referenced at the project level.
54
+
Environment types define the types of environments that your development teams can deploy. You can apply different settings for each environment type. You can create environment types at the dev center level and at the project level.
56
55
57
-
Create dev center environment types:
56
+
To create dev center environment types:
58
57
59
58
1. Sign in to the [Azure portal](https://portal.azure.com).
60
59
1. In **Dev centers**, select your dev center.
61
-
1. In the left menu under **Environment configuration**, select **Environment types**, and then select **Create**.
62
-
1. Use the following steps to create three environment types: Sandbox, FunctionApp, WebApp.
63
-
In **Create environment type**, enter the following information, and then select **Add**.
60
+
1. In the left menu, under **Environment configuration**, select **Environment types**, and then select **Create**.
61
+
1. Use the following steps to create three environment types: Sandbox, FunctionApp, and WebApp.
62
+
63
+
1. In **Create environment type**, enter the following information, and then select **Add**.
64
64
65
-
|Name |Value |
66
-
|---------|----------|
67
-
|**Name**|Enter a name for the environment type.|
68
-
|**Tags**|Enter a tag name and a tag value.|
65
+
|Name |Value |
66
+
|---------|----------|
67
+
|**Name**|Enter a name for the environment type.|
68
+
|**Tags**|Enter a tag name and a tag value.|
69
69
70
-
1. Confirm that the environment type was added by checking your Azure portal notifications.
70
+
1. Confirm that the environment type appears in the list.
71
71
72
-
Create project environment types:
72
+
To create project environment types:
73
73
74
-
1. In the left menu under **Manage**, select **Projects**, and then select the project you want to use.
75
-
1. In the left menu under **Environment configuration**, select **Environment types**, and then select **Add**.
76
-
1. Use the following steps to add the three environment types: Sandbox, FunctionApp, WebApp.
77
-
In **Add environment type to \<project-name\>**, enter or select the following information:
74
+
1. In the left menu, under **Manage**, select **Projects**, and then select the project that you want to use.
75
+
1. In the left menu, under **Environment configuration**, select **Environment types**, and then select **Add**.
76
+
1. Use the following steps to add the three environment types: Sandbox, FunctionApp, and WebApp.
77
+
1.In **Add environment type to \<project-name\>**, enter or select the following information:
78
78
79
-
|Name |Value |
80
-
|---------|----------|
81
-
|**Type**| Select a dev center level environment type to enable for the specific project.|
82
-
|**Deployment subscription**| Select the subscription in which the environment is created.|
83
-
|**Deployment identity**| Select either a system-assigned identity or a user-assigned managed identity to perform deployments on behalf of the user.|
84
-
|**Permissions on environment resources** > **Environment creator role(s)**| Select the roles to give access to the environment resources.|
85
-
|**Permissions on environment resources** > **Additional access**| Select the users or Microsoft Entra groups to assign to specific roles on the environment resources.|
86
-
|**Tags**| Enter a tag name and a tag value. These tags are applied on all resources that are created as part of the environment.|
87
-
88
-
1. Confirm that the environment type was added by checking your Azure portal notifications.
79
+
|Name |Value |
80
+
|---------|----------|
81
+
|**Type**| Select a dev center-level environment type to enable for the specific project.|
82
+
|**Deployment subscription**| Select the subscription in which the environment is created.|
83
+
|**Deployment identity**| Select either a system-assigned or a user-assigned managed identity to perform deployments on behalf of the user.|
84
+
|**Permissions on environment resources** > **Environment creator role(s)**| Select the roles to give access to the environment resources.|
85
+
|**Permissions on environment resources** > **Additional access**| Select the users or Microsoft Entra groups to assign to specific roles on the environment resources.|
86
+
|**Tags**| Enter a tag name and a tag value. These tags are applied on all resources that are created as part of the environment.|
89
87
88
+
1. Confirm that the environment type appears in the list.
90
89
91
90
## Configure a service connection
92
91
93
-
In Azure Pipelines, you create a *service connection* in your Azure DevOps project to access resources in your Azure subscription. When you create the service connection, Azure DevOps creates a Microsoft Entra service principal object.
92
+
In Azure Pipelines, you create a *service connection* in your Azure DevOps project to access resources in your Azure subscription.
94
93
95
-
1. Sign in to your Azure DevOps organization (`https://dev.azure.com/<your-organization>`), and select your project. Replace the `<your-organization>` text placeholder with your project identifier.
96
-
1. Select **Project settings** > **Service connections** > **+ New service connection**.
97
-
1. In the **New service connection** pane, select the **Azure Resource Manager**, and then select **Next**.
98
-
1. Select the **Service Principal (automatic)** authentication method, and then select **Next**.
99
-
1. Enter the service connection details, and then select **Save** to create the service connection.
94
+
1. If you don't have a user-assigned managed identity for the project, [add one](/entra/identity/managed-identities-azure-resources/how-manage-user-assigned-managed-identities?pivots=identity-mi-methods-azp#create-a-user-assigned-managed-identity).
95
+
> [!NOTE]
96
+
> You can use one of three options for identity: app registration, user-assigned managed identity, and system-assigned managed identity. App registration is the most secure option. To use app registration, you need to have appropriate permissions. For more information see [Azure Resource Manager service connection special cases](/azure/devops/pipelines/library/azure-resource-manager-alternate-approaches).
97
+
1. Sign in to your Azure DevOps organization (`https://dev.azure.com/<your-organization>`). Replace `<your-organization>` with your project identifier.
1. In the **New service connection** pane, select **Azure Resource Manager**, and then select **Next**.
101
+
1. Enter the following service connection details, and then select **Save** to create the service connection.
100
102
101
103
| Field | Value |
102
104
| ----- | ----- |
103
-
|**Scope level**|*Subscription*. |
104
-
|**Subscription**| Select the Azure subscription that hosts your dev center resource. |
105
-
|**Resource group**| Select the resource group that contains your dev center resource. |
106
-
|**Service connection name**| Enter a unique name for the service connection. |
107
-
|**Grant access permission to all pipelines**| Checked. |
105
+
|**Identity type**|**Managed identity**|
106
+
|**Subscription for managed identity**|Enter the Azure subscription that contains the managed identity. |
107
+
|**Resource group for managed identity**|Enter the resource group that contains the managed identity.|
108
+
|**Managed identity**|Enter the name of the managed identity.|
109
+
|**Scope level for service connection**|**Subscription**|
110
+
|**Subscription for service connection**| Enter the ID of the Azure subscription that hosts your dev center resource. |
111
+
|**Service Connection Name**| Enter a unique name for the service connection. |
112
+
|**Grant access permission to all pipelines**| Select this checkbox. |
108
113
109
-
1. From the list of service connections, select the one you created earlier, and then select **Manage Service Principal**.
110
-
The Azure portal opens in a separate browser tab and shows the service principal details.
111
-
1. In the Azure portal, copy the **Display name** value.
112
-
You use this value in the next step to grant permissions for running load tests to the service principal.
114
+
1. Select **Save**.
113
115
114
-
### Grant the service connection access to the ADE project
116
+
### Grant the service connection access to the Deployment Environments project
115
117
116
-
Azure Deployment Environments uses role-based access control to grant permissions for performing specific activities on your ADE resource. To make changes from a CI/CD pipeline, you grant the Deployment Environments User role to the service principal.
118
+
Deployment Environments uses role-based access control to grant permissions for performing specific activities on your Deployment Environments resource. To make changes from a CI/CD pipeline, you grant the Deployment Environments User role to the managed identity.
117
119
118
-
1. In the [Azure portal](https://portal.azure.com/), go to your ADE project.
120
+
121
+
122
+
1. In the [Azure portal](https://portal.azure.com/), go to your Deployment Environments project.
119
123
1. Select **Access control (IAM)** > **Add** > **Add role assignment**.
120
-
1.In the **Role** tab, select **Deployment Environments User** in the list of job function roles.
121
-
1.In the **Members** tab, select **Select members**, and then use the display name you copied previously to search the service principal.
122
-
1. Select the service principal, and then select **Select**.
123
-
1.In the **Review + assign tab**, select **Review + assign** to add the role assignment.
124
+
1.On the **Role** tab, select **Deployment Environments User** in the list of job function roles.
125
+
1.On the **Members** tab, select **Managed identity** and **Select members**.
126
+
1.In the **Select managed identities** tab, under **Managed identity**, select the **Project** identity, select the project name, and then select **Select**.
127
+
1.On the **Review + assign** tab, select **Review + assign** to add the role assignment.
124
128
125
-
You can now use the service connection in your Azure Pipelines workflow definition to access your ADE environments.
129
+
You can now use the service connection in your Azure Pipelines workflow definition to access your Deployment Environments environments.
126
130
127
-
### Grant your account access to the ADE project
131
+
### Grant your account access to the Deployment Environments project
128
132
129
-
To view environments created by other users, including the service connection, you need to grant your account read access to the ADE project.
133
+
To view environments created by other users, including the service connection, you need to grant your account read access to the Deployment Environments project.
130
134
131
-
1. In the [Azure portal](https://portal.azure.com/), go to your ADE project.
135
+
1. In the [Azure portal](https://portal.azure.com/), go to your Deployment Environments project.
132
136
1. Select **Access control (IAM)** > **Add** > **Add role assignment**.
133
-
1.In the **Role** tab, select **Deployment Environments Reader** in the list of job function roles.
134
-
1.In the **Members** tab, select **Select members**, and then search for your own account.
137
+
1.On the **Role** tab, select **Deployment Environments Reader** in the list of job function roles.
138
+
1.On the **Members** tab, select **Select members**, and then search for your own account.
135
139
1. Select your account from the list, and then select **Select**.
136
-
1.In the **Review + assign tab**, select **Review + assign** to add the role assignment.
140
+
1.On the **Review + assign** tab, select **Review + assign** to add the role assignment.
137
141
138
142
You can now view the environments created by your Azure Pipelines workflow.
139
143
140
144
## Configure a pipeline
141
145
142
-
Edit the `azure-pipelines.yml` file in your Azure Repos repository to customize your pipeline.
146
+
Edit the *azure-pipelines.yml* file in your Azure Repos repository to customize your pipeline.
143
147
144
148
In the pipeline, you define the steps to create the environment. In this pipeline, you define the steps to create the environment as a job, which is a series of steps that run sequentially as a unit.
145
149
146
-
To customize the pipeline you:
147
-
- Specify the Service Connection to use, and The pipeline uses the Azure CLI to create the environment.
148
-
- Use an Inline script to run an Azure CLI command that creates the environment.
150
+
To customize the pipeline, you:
151
+
- Specify the service connection to use.
152
+
- Use an inline script to run an Azure CLI command that creates the environment.
149
153
150
-
The Azure CLI is a command-line tool that provides a set of commands for working with Azure resources. To discover more Azure CLI commands, see [az devcenter](/cli/azure/devcenter?view=azure-cli-latest&preserve-view=true).
154
+
Azure CLI is a command-line tool that provides a set of commands for working with Azure resources. To learn about more Azure CLI commands, see [az devcenter](/cli/azure/devcenter?view=azure-cli-latest&preserve-view=true).
151
155
152
156
1. In your Azure DevOps project, select **Repos** > **Files**.
153
-
1. In the **Files** pane, from the `.ado` folder, select `azure-pipelines.yml` file.
154
-
1. In the `azure-pipelines.yml` file, edit the existing content with the following code:
157
+
1. In the **Files** pane, in the **.ado** folder, select the **azure-pipelines.yml** file.
158
+
1. In the azure-pipelines.yml file, edit the existing content:
155
159
- Replace `<AzureServiceConnectionName>` with the name of the service connection you created earlier.
156
-
- In the `Inline script`, replace each of the following placeholders with values appropriate to your Azure environment:
160
+
- In the `Inline script` input, replace each of the following placeholders with values that are appropriate to your Azure environment:
157
161
158
162
| Placeholder | Value |
159
163
| ------------------------------- | ----- |
160
-
|`<dev-center-name>`| The name of your dev center. |
164
+
|`<DevCenterName>`| The name of your dev center. |
161
165
|`<project-name>`| The name of your project. |
162
166
|`<catalog-name>`| The name of your catalog. |
163
-
|`<environment-definition-name>`| Do not change. Defines the environment definition that is used. |
167
+
|`<environment-definition-name>`| Do not change. Defines the environment definition that's used. |
164
168
|`<environment-type>`| The environment type. |
165
169
|`<environment-name>`| Specify a name for your new environment. |
166
-
|`<parameters>`| Do not change. References the json file that defines parameters for the environment. |
170
+
|`<parameters>`| Do not change. References the JSON file that defines parameters for the environment. |
167
171
168
172
1. Select **Commit** to save your changes.
169
173
1. In the **Commit changes** pane, enter a commit message, and then select **Commit**.
170
174
175
+
## Create an environment by using a pipeline
171
176
172
-
## Create an environment using a pipeline
173
-
174
-
Next, you run the pipeline to create the ADE environment.
177
+
Next, you run the pipeline to create the Deployment Environments environment.
175
178
176
179
1. In your Azure DevOps project, select **Pipelines**.
177
180
1. Select the pipeline you created earlier, and then select **Run pipeline**.
178
-
1. You can check on the progress of the pipeline run by selecting the pipeline name, and then selecting **Runs**. Select the run to see the details of the pipeline run.
179
-
1. You can also check the progress of the environment creation in the Azure portal by selecting your dev center, selecting your project, and then selecting **Environments**.
180
-
181
+
1. You can check on the progress of the pipeline run by selecting the pipeline name and then selecting **Runs**. Select the run to see the details of the pipeline run.
182
+
1. You can also check the progress of the creation of the environment in the Azure portal by selecting your dev center, selecting your project, and then selecting **Environments**.
181
183
182
-
You can insert this job anywhere in a Continuous Integration (CI) and/or a Continuous Delivery (CD) pipeline. Get started with the [Azure Pipelines documentation](/azure/devops/pipelines/?view=azure-devops&preserve-view=true) to learn more about creating and managing pipelines.
184
+
You can insert this job anywhere in a CI and/or CD pipeline. See the [Azure Pipelines documentation](/azure/devops/pipelines/?view=azure-devops&preserve-view=true) to learn more about creating and managing pipelines.
0 commit comments