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_M05_L12_Deployments_using_Azure_Bicep_templates.md
+7-72Lines changed: 7 additions & 72 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,19 +33,19 @@ After you complete this lab, you will be able to:
33
33
34
34
## Instructions
35
35
36
-
### Exercise 0: Configure the lab prerequisites
36
+
### Exercise 0: (skip if done) Configure the lab prerequisites
37
37
38
38
In this exercise, you will set up the prerequisites for the lab, which consist of a new Azure DevOps project with a repository based on the [eShopOnWeb](https://github.com/MicrosoftLearning/eShopOnWeb).
39
39
40
-
#### Task 1: (skip if done) Create and configure the team project
40
+
#### Task 1: (skip if done) Create and configure the team project
41
41
42
42
In this task, you will create an **eShopOnWeb** Azure DevOps project to be used by several labs.
43
43
44
44
1. On your lab computer, in a browser window open your Azure DevOps organization. Click on **New Project**. Give your project the name **eShopOnWeb** and leave the other fields with defaults. Click on **Create**.
45
45
46
46

47
47
48
-
#### Task 2: (skip if done) Import eShopOnWeb Git Repository
48
+
#### Task 2: (skip if done) Import eShopOnWeb Git Repository
49
49
50
50
In this task you will import the eShopOnWeb Git repository that will be used by several labs.
51
51
@@ -179,64 +179,9 @@ In this task, you will modify the main template to reference the template module
179
179
180
180
### Exercise 2: Deploying the templates to Azure using YAML pipelines
181
181
182
-
In this lab, you will create a service connection and use it in an Azure DevOps YAML pipeline to deploy your template to your Azure environment.
182
+
In this lab, you will use an Azure DevOps YAML pipeline to deploy your template to your Azure environment.
183
183
184
-
#### Task 1: (skip if done) Create a Service Connection for deployment
185
-
186
-
In this task, you will create a Service Principal by using the Azure CLI, which will allow Azure DevOps to:
187
-
188
-
- Deploy resources on your Azure subscription.
189
-
- Have read access on the later created Key Vault secrets.
190
-
191
-
> **Note**: If you do already have a Service Principal, you can proceed directly to the next task.
192
-
193
-
You will need a Service Principal to deploy Azure resources from Azure Pipelines. Since we are going to retrieve secrets in a pipeline, we will need to grant permission to the service when we create the Azure Key Vault.
194
-
195
-
A Service Principal is automatically created by Azure Pipelines, 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.
196
-
197
-
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 Microsoft Entra tenant associated with this subscription.
198
-
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.
199
-
1. If prompted to select either **Bash** or **PowerShell**, select **Bash**.
200
-
201
-
> **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**.
202
-
203
-
1. From the **Bash** prompt, in the **Cloud Shell** pane, run the following commands to retrieve the values of the Azure subscription ID and subscription name attributes:
204
-
205
-
```bash
206
-
az account show --query id --output tsv
207
-
az account show --query name --output tsv
208
-
```
209
-
210
-
>**Note**: Copy both values to a text file. You will need them later in this lab.
211
-
212
-
1. From the **Bash** prompt, in the **Cloud Shell** pane, run the following command to create a Service Principal (replace the **myServicePrincipalName** with any unique string of characters consisting of letters and digits) and **mySubscriptionID** with your Azure subscriptionId :
213
-
214
-
```bash
215
-
az ad sp create-for-rbac --name myServicePrincipalName \
216
-
--role contributor \
217
-
--scopes /subscriptions/mySubscriptionID
218
-
```
219
-
220
-
>**Note**: The command will generate a JSON output. Copy the output to text file. You will need it later in this lab.
221
-
222
-
1. Next, from the lab computer, start a web browser, navigate to the Azure DevOps **eShopOnWeb** project. Click on **Project Settings > Service Connections (under Pipelines)** and **New Service Connection**.
223
-
224
-

225
-
226
-
1. On the **New service connection** blade, select**Azure Resource Manager** and **Next** (may need to scroll down).
227
-
228
-
1. The choose **Service Principal (manual)** and click on **Next**.
229
-
230
-
1. Fill in the empty fields using the information gathered during previous steps:
231
-
- Subscription Id and Name.
232
-
- Service Principal Id (appId), Service principal key (password) and Tenant ID (tenant).
233
-
- In **Service connection name**type**`azure subs`**. This name will be referenced in YAML pipelines when needing an Azure DevOps Service Connection to communicate with your Azure subscription.
234
-
235
-

236
-
237
-
1. Click on **Verify and Save**.
238
-
239
-
#### Task 2: Deploy resources to Azure by YAML pipelines
184
+
#### Task 1: Deploy resources to Azure by YAML pipelines
240
185
241
186
1. Navigate back to the **Pipelines** pane in of the **Pipelines** hub.
242
187
1. In the **Create your first Pipeline** window, click **Create pipeline**.
@@ -258,18 +203,8 @@ A Service Principal is automatically created by Azure Pipelines, when you connec
258
203
1. Wait for the deployment to finish and review the results.
259
204

260
205
261
-
#### Task 3: Remove the Azure lab resources
262
-
263
-
In this task, you will use Azure Cloud Shell to remove the Azure resources provisioned in this lab to eliminate unnecessary charges.
264
-
265
-
1. In the Azure portal, open the **Bash** shell session within the **Cloud Shell** pane.
266
-
1. Delete all resource groups you created throughout the labs of this module by running the following command (replace the resource group name with what you chose):
267
-
268
-
```bash
269
-
az group list --query "[?starts_with(name,'AZ400-EWebShop-NAME')].[name]" --output tsv | xargs -L1 bash -c 'az group delete --name $0 --no-wait --yes'
270
-
```
271
-
272
-
>**Note**: The command executes asynchronously (as determined by the --nowait parameter), so while you will be able to run another Azure CLI command immediately afterwards within the same Bash session, it will take a few minutes before the resource groups are actually removed.
206
+
> [!IMPORTANT]
207
+
> Remember to delete the resources created in the Azure portal to avoid unnecessary charges.
0 commit comments