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_M06_L12_Azure_Deployments_Using_Resource_Manager_Templates.md
+24-26Lines changed: 24 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,8 +10,6 @@ lab:
10
10
11
11
## Lab requirements
12
12
13
-
## Lab requirements
14
-
15
13
- This lab requires **Microsoft Edge** or an [Azure DevOps supported browser.](https://docs.microsoft.com/azure/devops/server/compatibility)
16
14
17
15
-**Set up an Azure DevOps organization:** If you don't already have an Azure DevOps organization that you can use for this lab, create one by following the instructions available at [Create an organization or project collection](https://docs.microsoft.com/azure/devops/organizations/accounts/create-organization).
@@ -57,7 +55,7 @@ In this task you will import the eShopOnWeb Git repository that will be used by
-**.devcontainer** folder container setup to develop using containers (either locally in VS Code or GitHub Codespaces).
63
61
-**.azure** folder contains Bicep&ARM infrastructure as code templates used in some lab scenarios.
@@ -73,28 +71,28 @@ In this lab, you will review an Azure Bicep template and simplify it using a reu
73
71
In this task, you will use Visual Studio Code to create an Azure Bicep template
74
72
75
73
1. In the browser tab you have your Azure DevOps project open, navigate to **Repos** and **Files**. Open the `.azure\bicep` folder and find the `simple-windows-vm.bicep` file.
1. Review the template to get a better understanding of its structure. There are some parameters with types, default values and validation, some variables, and quite a few resources with these types:
77
+
2. Review the template to get a better understanding of its structure. There are some parameters with types, default values and validation, some variables, and quite a few resources with these types:
80
78
81
79
- Microsoft.Storage/storageAccounts
82
80
- Microsoft.Network/publicIPAddresses
83
81
- Microsoft.Network/virtualNetworks
84
82
- Microsoft.Network/networkInterfaces
85
83
- Microsoft.Compute/virtualMachines
86
84
87
-
1. Pay attention to how simple the resource definitions are and the ability to implicitly reference symbolic names instead of explicit `dependsOn` throughout the template.
85
+
3. Pay attention to how simple the resource definitions are and the ability to implicitly reference symbolic names instead of explicit `dependsOn` throughout the template.
88
86
89
87
#### Task 2: Create a bicep module for storage resources
90
88
91
89
In this task, you will create a storage template module **storage.bicep** which will create a storage account only and will be imported by the main template. The storage template module needs to pass a value back to the main template, **main.bicep**, and this value will be defined in the outputs element of the storage template module.
92
90
93
91
1. First we need to remove the storage resource from our main template. From the top right corner of your browser window click the **Edit** button:
@@ -107,15 +105,15 @@ In this task, you will create a storage template module **storage.bicep** which
107
105
}
108
106
```
109
107
110
-
1. Commit the file, however, we're not done with it yet.
108
+
3. Commit the file, however, we're not done with it yet.
111
109
112
110

113
111
114
-
1. Next, hover your mouse over the bicep folder and click the elipsis icon, then select **New**, and **File**. Enter **storage.bicep** for the name and click **Create**.
112
+
4. Next, hover your mouse over the bicep folder and click the ellipsis icon, then select **New**, and **File**. Enter **storage.bicep** for the name and click **Create**.
115
113
116
114

117
115
118
-
1. Now copy the following code snippet into the file and commit your changes:
116
+
5. Now copy the following code snippet into the file and commit your changes:
119
117
120
118
```bicep
121
119
@description('Location for all resources.')
@@ -142,7 +140,7 @@ In this task, you will modify the main template to reference the template module
142
140
143
141
1. Navigate back to the `simple-windows-vm.bicep` file and click on the **Edit** button once again.
144
142
145
-
1. Next, add the following code after the variables:
143
+
2. Next, add the following code after the variables:
146
144
147
145
```bicep
148
146
module storageModule './storage.bicep' = {
@@ -154,7 +152,7 @@ In this task, you will modify the main template to reference the template module
154
152
}
155
153
```
156
154
157
-
1. We also need to modify the reference to the storage account blob URI in our virtual machine resource to use the output of the module instead. Find the virtual machine resource and replace the diagnosticsProfile section with the following:
155
+
3. We also need to modify the reference to the storage account blob URI in our virtual machine resource to use the output of the module instead. Find the virtual machine resource and replace the diagnosticsProfile section with the following:
158
156
159
157
```bicep
160
158
diagnosticsProfile: {
@@ -165,44 +163,44 @@ In this task, you will modify the main template to reference the template module
165
163
}
166
164
```
167
165
168
-
1. Review the following details in the main template:
166
+
4. Review the following details in the main template:
169
167
170
168
- A module in the main template is used to link to another template.
171
169
- The module has a symbolic name called `storageModule`. This name is used for configuring any dependencies.
172
170
- You can only use **Incremental** deployment mode when using template modules.
173
171
- A relative path is used for your template module.
174
172
- Use parameters to pass values from the main template to the template modules.
175
173
176
-
1. Commit the template.
174
+
5. Commit the template.
177
175
178
176
#### Task 4: Deploy resources to Azure by YAML pipelines
177
+
179
178
1. Navigate back to the **Pipelines** pane in of the **Pipelines** hub.
180
-
1. In the **Create your first Pipeline** window, click **Create pipeline**.
179
+
2. In the **Create your first Pipeline** window, click **Create pipeline**.
181
180
182
181
> **Note**: We will use the wizard to create a new YAML Pipeline definition based on our project.
183
182
184
-
1. On the **Where is your code?** pane, click **Azure Repos Git (YAML)** option.
185
-
1. On the **Select a repository** pane, click **eShopOnWeb_MultiStageYAML**.
186
-
1. On the **Configure your pipeline** pane, scroll down and select **Existing Azure Pipelines YAML File**.
187
-
1. In the **Selecting an existing YAML File** blade, specify the following parameters:
183
+
3. On the **Where is your code?** pane, click **Azure Repos Git (YAML)** option.
184
+
4. On the **Select a repository** pane, click **eShopOnWeb_MultiStageYAML**.
185
+
5. On the **Configure your pipeline** pane, scroll down and select **Existing Azure Pipelines YAML File**.
186
+
6. In the **Selecting an existing YAML File** blade, specify the following parameters:
188
187
- Branch: **main**
189
188
- Path: **.ado/eshoponweb-cd-windows-cm.yml**
190
-
1. Click **Continue** to save these settings.
191
-
1. In the variables section, choose a name for your resource group, set the desired location and replace the value of the service connection with one of your existing service connections you created earlier.
192
-
1. Click the **Save and run** button from the top right corder and when the commit dialog appeared, click **Save and run** again.
189
+
7. Click **Continue** to save these settings.
190
+
8. In the variables section, choose a name for your resource group, set the desired location and replace the value of the service connection with one of your existing service connections you created earlier.
191
+
9. Click the **Save and run** button from the top right corder and when the commit dialog appeared, click **Save and run** again.
193
192
194
193

195
194
196
-
1. Wait for the deploymemnt to finish and review the results.
195
+
10. Wait for the deploymemnt to finish and review the results.
197
196

198
197
199
198
#### Task 1: Remove the Azure lab resources
200
199
201
200
In this task, you will use Azure Cloud Shell to remove the Azure resources provisioned in this lab to eliminate unnecessary charges.
202
201
203
202
1. In the Azure portal, open the **Bash** shell session within the **Cloud Shell** pane.
204
-
205
-
1. Delete all resource groups you created throughout the labs of this module by running the following command (replace the resource gruop name with what you chose):
203
+
2. 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):
206
204
207
205
```bash
208
206
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'
0 commit comments