From 50c7f2472c780cf1d66d1a356351dd2983eb5b65 Mon Sep 17 00:00:00 2001 From: Michael Kenntenich <37703728+mkennten@users.noreply.github.com> Date: Wed, 13 Jan 2021 08:33:55 +0100 Subject: [PATCH 1/4] Corrected indention for Task 2 Step 7 was shown as a new step 1. --- ...yments_Using_Resource_Manager_Templates.md | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Instructions/Labs/AZ400_M13_Azure_Deployments_Using_Resource_Manager_Templates.md b/Instructions/Labs/AZ400_M13_Azure_Deployments_Using_Resource_Manager_Templates.md index 2a76018ea..426663f19 100644 --- a/Instructions/Labs/AZ400_M13_Azure_Deployments_Using_Resource_Manager_Templates.md +++ b/Instructions/Labs/AZ400_M13_Azure_Deployments_Using_Resource_Manager_Templates.md @@ -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 { From 84aa05a775041122ad15c7e1c9757a4084c0b8b4 Mon Sep 17 00:00:00 2001 From: Michael Kenntenich <37703728+mkennten@users.noreply.github.com> Date: Wed, 13 Jan 2021 08:42:16 +0100 Subject: [PATCH 2/4] Added folder name to clarify where to store the JSON file Added folder name "C:\templates" to clarify where to store the JSON file --- ...00_M13_Azure_Deployments_Using_Resource_Manager_Templates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Instructions/Labs/AZ400_M13_Azure_Deployments_Using_Resource_Manager_Templates.md b/Instructions/Labs/AZ400_M13_Azure_Deployments_Using_Resource_Manager_Templates.md index 426663f19..092b6db9f 100644 --- a/Instructions/Labs/AZ400_M13_Azure_Deployments_Using_Resource_Manager_Templates.md +++ b/Instructions/Labs/AZ400_M13_Azure_Deployments_Using_Resource_Manager_Templates.md @@ -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 From 7d1c985440d40b9bf9ba1368e00dd2aa2184f808 Mon Sep 17 00:00:00 2001 From: Michael Kenntenich <37703728+mkennten@users.noreply.github.com> Date: Wed, 13 Jan 2021 10:59:50 +0100 Subject: [PATCH 3/4] Clarify Cloud Shell usage Added a note and changed the formatting to avoid confusing about the switch from PowerShell to Bash session (it is not required when the previous PowerShell session is still active as PowerShell supports AZ CLI too. --- ..._Deployments_Using_Resource_Manager_Templates.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Instructions/Labs/AZ400_M13_Azure_Deployments_Using_Resource_Manager_Templates.md b/Instructions/Labs/AZ400_M13_Azure_Deployments_Using_Resource_Manager_Templates.md index 092b6db9f..5eb928eef 100644 --- a/Instructions/Labs/AZ400_M13_Azure_Deployments_Using_Resource_Manager_Templates.md +++ b/Instructions/Labs/AZ400_M13_Azure_Deployments_Using_Resource_Manager_Templates.md @@ -249,7 +249,7 @@ 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: +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. @@ -428,10 +428,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 @@ -445,9 +446,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 @@ -462,13 +463,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' ``` From 4374d74347f82453bc0cce4c0b95bebd034ea786 Mon Sep 17 00:00:00 2001 From: Michael Kenntenich <37703728+mkennten@users.noreply.github.com> Date: Wed, 13 Jan 2021 11:20:06 +0100 Subject: [PATCH 4/4] Ex 1 Task 3 Split PowerShell code into two part The copy and pasting of the PowerShell code was not working because the Read-Host did not stop for the user's input, instead the next lines were used as input and the resource group could not get created. For most users in the Cloud Shell that caused issues, on a local computer with normal copy and paste it seemed to work. Have split this to avoid an issue here. --- ...Deployments_Using_Resource_Manager_Templates.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Instructions/Labs/AZ400_M13_Azure_Deployments_Using_Resource_Manager_Templates.md b/Instructions/Labs/AZ400_M13_Azure_Deployments_Using_Resource_Manager_Templates.md index 5eb928eef..910076f62 100644 --- a/Instructions/Labs/AZ400_M13_Azure_Deployments_Using_Resource_Manager_Templates.md +++ b/Instructions/Labs/AZ400_M13_Azure_Deployments_Using_Resource_Manager_Templates.md @@ -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 @@ -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 ```