Skip to content
This repository was archived by the owner on Nov 14, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ In this task, you will use Visual Studio Code to create a Resource Manager templ
- **C:\\templates**
- **C:\\templates\\storage**

1. Switch back to Visual Studio Code window with our azuredeploy.json template, click the **File** top level menu, in the dropdown menu, click **Save as**, and save the template as **azuredeploy.json** in the newly created local folder.
1. Switch back to Visual Studio Code window with our azuredeploy.json template, click the **File** top level menu, in the dropdown menu, click **Save as**, and save the template as **azuredeploy.json** in the newly created local folder **C:\\templates**.
1. Review the template to get a better understanding of its structure. There are five resource types included in the template:

- Microsoft.Storage/storageAccounts
Expand Down Expand Up @@ -178,19 +178,19 @@ In this task, you will modify the templates you saved in the previous task such

1. Last, update the template schema version from 2015-01-01 to 2019-04-01, by updating the first few lines in the template definition file as follows:

```json
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageAccountName":{
"type": "string",
"metadata": {
"description": "Azure Storage account name."
}
```
```json
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageAccountName":{
"type": "string",
"metadata": {
"description": "Azure Storage account name."
}
```

1. Save the storage.json template. The linked storage template should now look as follows:
1. Save the storage.json template. The linked storage template should now look as follows:

```json
{
Expand Down Expand Up @@ -249,17 +249,18 @@ In this task, you will upload the linked template you created in the previous ta

>**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**.

1. From a PowerShell session in the Cloud Shell pane, run the following to create a blob storage container, upload the template file you created in the previous task, and generate a SAS token that we you will reference in the main template to access the linked template:

>**Note**: Make sure to record the final output generated by the script. You will need it later in the lab.
1. From a **PowerShell** session in the Cloud Shell pane, run the following to create a blob storage container, upload the template file you created in the previous task, and generate a SAS token that you will reference in the main template to access the linked template.
1. First, copy and paste the following lines of code to set a value for the Azure region you want to deploy to. The command will wait for your input as shown in the prompt.

```powershell
# Provide the name of the closest Azure region in which you can provision Azure VMs
$location = Read-Host -Prompt 'Enter the name of Azure region (i.e. centralus)'
```
1. Second, copy and paste the following code into the same Cloud Shell session to create a blob storage container, upload the template file you created in the previous task, and generate a SAS token that you will reference in the main template to access the linked template:

```powershell
# This is a random string used to assign the name to the Azure storage account
$suffix = Get-Random

$resourceGroupName = 'az400m13l01-RG'
$storageAccountName = 'az400m13blob' + $suffix

Expand Down Expand Up @@ -309,10 +310,11 @@ In this task, you will upload the linked template you created in the previous ta
"Resource Group Name: $resourceGroupName"
"Linked template URI with SAS token: $templateURI"
```

>**Note**: Make sure to record the final output generated by the script. You will need it later in the lab.

>**Note**: The output values should resemble the following:

```powershell
```
Resource Group Name: az400m13l01-RG
Linked template URI with SAS token: https://az400m13blob1677205310.blob.core.windows.net/linktempblobcntr/storage.json?sv=2018-03-28&sr=b&sig=B4hDLt9rFaWHZXToJlMwMjejAQGT7x0INdDR9bHBQnI%3D&se=2020-11-23T21%3A54%3A53Z&sp=r
```
Expand Down Expand Up @@ -428,10 +430,11 @@ In this task, you will modify the main template to account for remaining depende
> **Note**: To use Azure Cloud Shell, you will upload the main deployment template, azuredeploy.json into your Cloud Shell's home directory. Alternatively, you could also upload it to Azure Blob Storage, just as you did upload the linked template, and reference it by using its URI rather than local file system path.

1. On the lab computer, in the web browser displaying the Azure Portal, click the **Cloud Shell** icon to open Cloud Shell.
> **Note**: If you have the PowerShell session from earlier in this exercise still active, you can use this without switching to Bash (next step). The following steps can be run in both a PowerShell and Bash session of Cloud Shell. If you are opening a new Cloud Shell session, follow the instructions.
1. In the Cloud Shell pane, click **PowerShell**, in the dropdown menu, click **Bash** and, when prompted, click **Confirm**.
1. In the Cloud Shell pane, click the **Upload/download files** icon and, in the dropdown menu, click **Upload**.
1. In the **Open** dialog box, navigate to and select **C:\\templates\\azuredeploy.json** and click **Open**.
1. From a Bash session in the Cloud Shell pane, run the following to perform a deployment by using a newly uploaded template:
1. From a **Bash** session in the Cloud Shell pane, run the following to perform a deployment by using a newly uploaded template:

```bash
az deployment group create --name az400m13l01deployment --resource-group az400m13l01-RG --template-file azuredeploy.json
Expand All @@ -445,9 +448,9 @@ In this task, you will modify the main template to account for remaining depende
- If you have multiple Azure subscriptions ensure you have set the subscription context to the correct one where the resource group is deployed.
- Ensure that the linked template is accessible via the URI you specified.

> **Note**: As a next step, you could now modularize the remaining resource definitions in the main deployment template, such as the network and virtual machine resource definitions.
> **Note**: As a next step, you could now modularize the remaining resource definitions in the main deployment template, such as the network and virtual machine resource definitions.

> **Note**: If you are not planning on using the deployed resources, you should delete them to avoid associated charges. You can do so simply by deleting the resource group **az400m13l01-RG**.
> **Note**: If you are not planning on using the deployed resources, you should delete them to avoid associated charges. You can do so simply by deleting the resource group **az400m13l01-RG**.

### Exercise 2: Remove the Azure lab resources

Expand All @@ -462,13 +465,13 @@ In this task, you will use Azure Cloud Shell to remove the Azure resources provi
1. In the Azure portal, open the **Bash** shell session within the **Cloud Shell** pane.
1. List all resource groups created throughout the labs of this module by running the following command:

```sh
```bash
az group list --query "[?starts_with(name,'az400m13l01-RG')].name" --output tsv
```

1. Delete all resource groups you created throughout the labs of this module by running the following command:

```sh
```bash
az group list --query "[?starts_with(name,'az400m13l01-RG')].[name]" --output tsv | xargs -L1 bash -c 'az group delete --name $0 --no-wait --yes'
```

Expand Down