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
{{ message }}
This repository was archived by the owner on Jan 21, 2026. It is now read-only.
Copy file name to clipboardExpand all lines: Instructions/Labs/AZ400_M07_Integrating_Azure_Key_Vault_with_Azure_DevOps.md
+57-30Lines changed: 57 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,7 +72,7 @@ In this task, you will create an **eShopOnWeb** Azure DevOps project to be used
72
72
73
73
In this task you will import the eShopOnWeb Git repository that will be used by several labs.
74
74
75
-
1. On your lab computer, in a browser window open your Azure DevOps organization and the previoulsy created **eShopOnWeb** project. Click on **Repos>Files** , **Import**. On the **Import a Git Repository** window, paste the following URL https://github.com/MicrosoftLearning/eShopOnWeb.git and click **Import**:
75
+
1. On your lab computer, in a browser window open your Azure DevOps organization and the previoulsy created **eShopOnWeb** project. Click on **Repos>Files** , **Import**. On the **Import a Git Repository** window, paste the following URL https://github.com/MicrosoftLearning/eShopOnWeb.git and click on **Import**:
76
76
77
77

78
78
@@ -102,7 +102,7 @@ You will need a service principal to deploy Azure resources from Azure Pipeline
102
102
A service principal is automatically created by Azure Pipeline when you connect to an Azure subscription from inside a pipeline definition or when you create a new service connection from the project settings page (automatic option). You can also manually create the service principal from the portal or using Azure CLI and re-use it across projects.
103
103
104
104
1. From the lab computer, start a web browser, navigate to the [**Azure Portal**](https://portal.azure.com), and sign in with the user account that has the Owner role in the Azure subscription you will be using in this lab and has the role of the Global Administrator in the Azure AD tenant associated with this subscription.
105
-
1. In the Azure portal, click the **Cloud Shell** icon, located directly to the right of the search textbox at the top of the page.
105
+
1. In the Azure portal, click on the **Cloud Shell** icon, located directly to the right of the search textbox at the top of the page.
106
106
1. If prompted to select either **Bash** or **PowerShell**, select **Bash**.
107
107
108
108
>**Note**: If this is the first time you are starting **Cloud Shell** and you are presented with the **You have no storage mounted** message, select the subscription you are using in this lab, and select **Create storage**.
@@ -151,11 +151,11 @@ From the lab computer, start a web browser, navigate to the Azure DevOps **eShop
151
151
152
152
1. On the **Where is your code?** window, select **Azure Repos Git (YAML)** and select the **eShopOnWeb** repository.
153
153
154
-
1. On the **Configure** section, choose **Existing Azure Pipelines YAML file**. Provide the following path **/.ado/main-ci-containers-compose.yml** and click **Continue**.
154
+
1. On the **Configure** section, choose **Existing Azure Pipelines YAML file**. Provide the following path **/.ado/main-ci-containers-compose.yml** and click on **Continue**.
1. In the YAML pipeline definition, customize your Resource Group name by replacing **NAME** on **att-az400-ewebshop-NAME** and replace **YOUR-SUBSCRIPTION-ID** with the your own Azure subscriptionId.
158
+
1. In the YAML pipeline definition, customize your Resource Group name by replacing **NAME** on **AZ400-EWebShop-NAME** and replace **YOUR-SUBSCRIPTION-ID** with the your own Azure subscriptionId.
159
159
160
160
1. Click on **Save and Run** and wait for the pipeline to execute succesfully.
161
161
@@ -164,64 +164,91 @@ From the lab computer, start a web browser, navigate to the Azure DevOps **eShop
164
164
- **PowerShell** task take the bicep output (acr login server) and creates pipeline variable.
165
165
- **DockerCompose** task builds and pushes the container images for eShopOnWeb.
166
166
167
-
1. Once the execution is finished, on the Azure Portal and defined Resource Group, you should find an Azure Container Registry with the created container images **eshoppublicapi** and **eshopwebmvc**. You will only use **eshopwebmvc** on the deploy phase.
167
+
1. Your pipeline will take a name based on the project name. Lets rename it for identifying the pipeline better. Go to **Pipelines>Pipelines** and click on the recently created pipeline. Click on the ellipsis and **Rename/Remove** option. Name it **main-ci-docker-compose** and click on **Save**.
168
+
169
+
170
+
1. Once the execution is finished, on the Azure Portal and defined Resource Group, you should find an Azure Container Registry (ACR) with the created container images **eshoppublicapi** and **eshopwebmvc**. You will only use **eshopwebmvc** on the deploy phase.
168
171
169
172

170
173
174
+
1. Click on **Access Keys** and copy the **password** value, it will be used in the following task, as we will keep it in Azure Key Vault.
175
+
176
+

177
+
171
178
172
179
#### Task 2: Create an Azure Key vault
173
180
174
181
In this task, you will create an Azure Key vault by using the Azure portal.
175
182
176
-
For this lab scenario, we have an app that connects to a MySQL database. We intend to store the password for the MySQL database as a secret in the key vault.
183
+
For this lab scenario, we will have a Azure Container Instance (ACI) that pull and runs a container image stored in Azure Container Registry (ACR). We intend to store the password for the ACR as a secret in the key vault.
177
184
178
-
1. In the Azure portal, in the **Search resources, services, and docs** text box, type **Key vaults** and press the **Enter** key.
179
-
1. On the **Key vaults** blade, click **+ Create**.
180
-
1. On the **Basics** tab of the **Create key vault** blade, specify the following settings and click **Next: Access policy**:
185
+
1. In the Azure portal, in the **Search resources, services, and docs** text box, type **Key vault** and press the **Enter** key.
186
+
1. Select **Key vault** blade, click on **Create>Key Vault**.
187
+
1. On the **Basics** tab of the **Create key vault** blade, specify the following settings and click on **Next**:
181
188
182
189
| Setting | Value |
183
190
| --- | --- |
184
191
| Subscription | the name of the Azure subscription you are using in this lab |
185
-
| Resource group | the name of a new resource group **az400m07l01-RG** |
186
-
| Key vault name | any unique valid name |
192
+
| Resource group | the name of a new resource group **AZ400-EWebShop-NAME** |
193
+
| Key vault name | any unique valid name, like **ewebshop-kv-NAME** (replace NAME) |
187
194
| Region | an Azure region close to the location of your lab environment |
1. On the **Access policy** tab of the **Create key vault** blade, click **+ Add Access Policy** to setup a new policy.
193
-
194
-
> **Note**: You need to secure access to your key vaults by allowing only authorized applications and users. To access the data from the vault, you will need to provide read (Get) permissions to the service principal that you will be using for authentication in the pipeline.
199
+
1. On the **Access policy** tab of the **Create key vault** blade, on the **Access Policy** section, click on **+ Create** to setup a new policy.
195
200
196
-
1. On the **Add access policy** blade, click the **None selected** link directly under the **Select principal** label.
197
-
1. On the **Principal** blade, search for the security principal that you created in the previous exercise, select it, and then click **Select**.
201
+
> **Note**: You need to secure access to your key vaults by allowing only authorized applications and users. To access the data from the vault, you will need to provide read (Get/List) permissions to the previously created service principal that you will be using for authentication in the pipeline.
198
202
199
-
> **Note**: You can search by name or ID of the principal.
203
+
1. On the **Permission** blade, check **Get** and **List** permissions below **Secret Permission**. Click on **Next**.
204
+
1. on the **Principal** blade, search for the previosly created Service Principal, either using the Id or Name given. Click on **Next** and **Next** again.
205
+
1. On the **Review + create** blade, click on **Create**
200
206
201
-
1. Back on the **Add access policy** blade, in the **Secret permissions** drop down list, select checkboxes next to the **Get** and **List** permissions and then click **Add**.
202
-
1. Back on the **Access policy** tab of the **Create key vault** blade, click **Review + create** and, on the **Review + create** blade, click **Create**.
207
+
1. Back on the **Create a Key Vault** blade, click on **Review + Create > Create**
203
208
204
209
> **Note**: Wait for the Azure Key vault to be provisioned. This should take less than 1 minute.
205
210
206
-
1. On the **Your deployment is complete** blade, click **Go to resource**.
207
-
1. On the Azure Key vault blade, in the vertical menu on the left side of the blade, in the **Settings** section, click **Secrets**.
208
-
1. On the **Secrets** blade, click **Generate/Import**.
209
-
1. On the **Create a secret** blade, specify the following settings and click **Create** (leave others with their default values):
211
+
1. On the **Your deployment is complete** blade, click on **Go to resource**.
212
+
1. On the Azure Key vault blade, in the vertical menu on the left side of the blade, in the **Objects** section, click on **Secrets**.
213
+
1. On the **Secrets** blade, click on **Generate/Import**.
214
+
1. On the **Create a secret** blade, specify the following settings and click on **Create** (leave others with their default values):
210
215
211
216
| Setting | Value |
212
217
| --- | --- |
213
218
| Upload options | **Manual** |
214
-
| Name | **sqldbpassword** |
215
-
| Value | any valid MySQL password value |
219
+
| Name | **acr-secret** |
220
+
| Value | ACR access password from previous task |
221
+
222
+
223
+
#### Task 3: Create a Variable Group connected to Azure Key Vault
224
+
225
+
In this task, you will create a Variable Group in Azure DevOps that will retrieve the ACR password secret from Key Vault using the Service Connection (Service Principal)
226
+
227
+
1. On your lab computer, start a web browser and navigate to the Azure DevOps project **eShopOnWeb**.
228
+
229
+
1. In the vertical navigational pane of the of the Azure DevOps portal, select **Pipelines>Library**. Click on **+ Variable Group**.
230
+
231
+
1. On the **New variable group** blade, specify the following settings:
1. Under **Variables**, click on **+ Add** and select the **acr-secret** secret. Click on **OK**.
241
+
1. Click on **Save**.
242
+
243
+

244
+
245
+
246
+
216
247
217
248
218
-
#### Task 3: Check the Azure Pipeline
219
249
220
-
In this task, you will configure the Azure Pipeline to retrieve the secret from the Azure Key vault.
221
250
222
-
1. On your lab computer, start a web browser and navigate to the Azure DevOps project **Integrating Azure Key Vault with Azure DevOps** you created in the previous exercise.
223
-
1. In the vertical navigational pane of the of the Azure DevOps portal, select **Pipelines** and verify that the **Pipelines** pane is displayed.
224
-
1. On the **Pipelines** pane, click the entry representing the **SmartHotel-CouponManagement-CI** pipeline. Click on **Edit**.
251
+
1. On the **Pipelines** pane, click on the entry representing the **SmartHotel-CouponManagement-CI** pipeline. Click on **Edit**.
225
252
2. On the pipeline definition, make sure the **Pipeline** > **Agent Specification** is **ubuntu 18.04**. Click **Save and Queue** > **Queue** > **Run** to trigger a build.
226
253
3. In the vertical navigational pane of the of the Azure DevOps portal, in the **Pipelines** section, select **Releases**.
227
254
4. On the **SmartHotel-CouponManagement-CD** pane, click **Edit** in the upper right corner.
0 commit comments