Skip to content

Commit 0d53995

Browse files
authored
Merge pull request #112835 from mumian/0427-deployment
update the deployment procedures
2 parents 0a9bc1f + 2c46874 commit 0d53995

10 files changed

+197
-108
lines changed

articles/azure-resource-manager/templates/deployment-script-template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ In addition to inline scripts, you can also use external script files. Only prim
185185

186186
To see an example, select [here](https://github.com/Azure/azure-docs-json-samples/blob/master/deployment-script/deploymentscript-helloworld-primaryscripturi.json).
187187

188-
The external script files must be accessible. To secure your script files that are stored in Azure storage accounts, see [Tutorial: Secure artifacts in Azure Resource Manager template deployments](./template-tutorial-secure-artifacts.md).
188+
The external script files must be accessible. To secure your script files that are stored in Azure storage accounts, see [Deploy private ARM template with SAS token](./secure-template-with-sas-token.md).
189189

190190
You are responsible for ensuring the integrity of the scripts that are referenced by deployment script, either **PrimaryScriptUri** or **SupportingScriptUris**. Reference only scripts that you trust.
191191

Loading

articles/azure-resource-manager/templates/template-tutorial-create-multiple-instances.md

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Create multiple resource instances
33
description: Learn how to create an Azure Resource Manager template to create multiple Azure resource instances.
44
author: mumian
5-
ms.date: 04/08/2020
5+
ms.date: 04/23/2020
66
ms.topic: tutorial
77
ms.author: jgao
88
---
@@ -16,7 +16,7 @@ Learn how to iterate in your Azure Resource Manager (ARM) template to create mul
1616
This tutorial covers the following tasks:
1717

1818
> [!div class="checklist"]
19-
> * Open a QuickStart template
19+
> * Open a Quickstart template
2020
> * Edit the template
2121
> * Deploy the template
2222
@@ -30,7 +30,7 @@ To complete this article, you need:
3030

3131
## Open a Quickstart template
3232

33-
[Azure QuickStart Templates](https://azure.microsoft.com/resources/templates/) is a repository for ARM templates. Instead of creating a template from scratch, you can find a sample template and customize it. The template used in this quickstart is called [Create a standard storage account](https://azure.microsoft.com/resources/templates/101-storage-account-create/). The template defines an Azure Storage account resource.
33+
[Azure Quickstart Templates](https://azure.microsoft.com/resources/templates/) is a repository for ARM templates. Instead of creating a template from scratch, you can find a sample template and customize it. The template used in this quickstart is called [Create a standard storage account](https://azure.microsoft.com/resources/templates/101-storage-account-create/). The template defines an Azure Storage account resource.
3434

3535
1. From Visual Studio Code, select **File**>**Open File**.
3636
2. In **File name**, paste the following URL:
@@ -107,9 +107,40 @@ For more information about creating multiple instances, see [Deploy multiple ins
107107
108108
## Deploy the template
109109
110-
Refer to the [Deploy the template](quickstart-create-templates-use-visual-studio-code.md#deploy-the-template) section in the Visual Studio Code quickstart for the deployment procedure.
110+
1. Sign in to the [Azure Cloud Shell](https://shell.azure.com)
111111
112-
[!INCLUDE [updated-for-az](../../../includes/updated-for-az.md)]
112+
1. Choose your preferred environment by selecting either **PowerShell** or **Bash** (for CLI) on the upper left corner. Restarting the shell is required when you switch.
113+
114+
![Azure portal Cloud Shell upload file](./media/template-tutorial-use-template-reference/azure-portal-cloud-shell-upload-file.png)
115+
116+
1. Select **Upload/download files**, and then select **Upload**. See the previous screenshot. Select the file you saved in the previous section. After uploading the file, you can use the **ls** command and the **cat** command to verify the file is uploaded successfully.
117+
118+
1. From the Cloud Shell, run the following commands. Select the tab to show the PowerShell code or the CLI code.
119+
120+
# [CLI](#tab/CLI)
121+
122+
```azurecli
123+
echo "Enter a project name that is used to generate resource group name:" &&
124+
read projectName &&
125+
echo "Enter the location (i.e. centralus):" &&
126+
read location &&
127+
resourceGroupName="${projectName}rg" &&
128+
az group create --name $resourceGroupName --location "$location" &&
129+
az deployment group create --resource-group $resourceGroupName --template-file "$HOME/azuredeploy.json"
130+
```
131+
132+
# [PowerShell](#tab/PowerShell)
133+
134+
```azurepowershell
135+
$projectName = Read-Host -Prompt "Enter a project name that is used to generate resource group name"
136+
$location = Read-Host -Prompt "Enter the location (i.e. centralus)"
137+
$resourceGroupName = "${projectName}rg"
138+
139+
New-AzResourceGroup -Name $resourceGroupName -Location "$location"
140+
New-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateFile "$HOME/azuredeploy.json"
141+
```
142+
143+
---
113144
114145
To list all three storage accounts, omit the --name parameter:
115146
@@ -128,6 +159,7 @@ echo "Press [ENTER] to continue ..."
128159
```azurepowershell
129160
$projectName = Read-Host -Prompt "Enter a project name that is used to generate resource group name"
130161
$resourceGroupName = "${projectName}rg"
162+
131163
Get-AzStorageAccount -ResourceGroupName $resourceGroupName
132164
Write-Host "Press [ENTER] to continue ..."
133165
```

articles/azure-resource-manager/templates/template-tutorial-create-templates-with-dependent-resources.md

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Template with dependent resources
33
description: Learn how to create an Azure Resource Manager template with multiple resources, and how to deploy it using the Azure portal
44
author: mumian
5-
ms.date: 04/10/2020
5+
ms.date: 04/23/2020
66
ms.topic: tutorial
77
ms.author: jgao
88
---
@@ -18,7 +18,7 @@ In this tutorial, you create a storage account, a virtual machine, a virtual net
1818
This tutorial covers the following tasks:
1919

2020
> [!div class="checklist"]
21-
> * Open a QuickStart template
21+
> * Open a Quickstart template
2222
> * Explore the template
2323
> * Deploy the template
2424
@@ -39,7 +39,7 @@ To complete this article, you need:
3939

4040
## Open a Quickstart template
4141

42-
Azure QuickStart Templates is a repository for ARM templates. Instead of creating a template from scratch, you can find a sample template and customize it. The template used in this tutorial is called [Deploy a simple Windows VM](https://azure.microsoft.com/resources/templates/101-vm-simple-windows/).
42+
Azure Quickstart Templates is a repository for ARM templates. Instead of creating a template from scratch, you can find a sample template and customize it. The template used in this tutorial is called [Deploy a simple Windows VM](https://azure.microsoft.com/resources/templates/101-vm-simple-windows/).
4343

4444
1. From Visual Studio Code, select **File**>**Open File**.
4545
2. In **File name**, paste the following URL:
@@ -113,10 +113,34 @@ By specifying the dependencies, Resource Manager efficiently deploys the solutio
113113

114114
## Deploy the template
115115

116-
1. Follow the instructions in [Deploy the template](./template-tutorial-create-templates-with-dependent-resources.md#deploy-the-template) to open the Cloud Shell and upload the revised template.
116+
1. Sign in to the [Azure Cloud Shell](https://shell.azure.com)
117+
118+
1. Choose your preferred environment by selecting either **PowerShell** or **Bash** (for CLI) on the upper left corner. Restarting the shell is required when you switch.
119+
120+
![Azure portal Cloud Shell upload file](./media/template-tutorial-use-template-reference/azure-portal-cloud-shell-upload-file.png)
121+
122+
1. Select **Upload/download files**, and then select **Upload**. See the previous screenshot. Select the file you saved earlier. After uploading the file, you can use the **ls** command and the **cat** command to verify the file is uploaded successfully.
117123

118124
1. Run the following PowerShell script to deploy the template.
119125

126+
# [CLI](#tab/CLI)
127+
128+
```azurecli
129+
echo "Enter a project name that is used to generate resource group name:" &&
130+
read projectName &&
131+
echo "Enter the location (i.e. centralus):" &&
132+
read location &&
133+
echo "Enter the virtual machine admin username:" &&
134+
read adminUsername &&
135+
echo "Enter the DNS label prefix:" &&
136+
read dnsLabelPrefix &&
137+
resourceGroupName="${projectName}rg" &&
138+
az group create --name $resourceGroupName --location $location &&
139+
az deployment group create --resource-group $resourceGroupName --template-file "$HOME/azuredeploy.json" --parameters adminUsername=$adminUsername dnsLabelPrefix=$dnsLabelPrefix
140+
```
141+
142+
# [PowerShell](#tab/PowerShell)
143+
120144
```azurepowershell
121145
$projectName = Read-Host -Prompt "Enter a project name that is used to generate resource group name"
122146
$location = Read-Host -Prompt "Enter the location (i.e. centralus)"
@@ -136,19 +160,7 @@ By specifying the dependencies, Resource Manager efficiently deploys the solutio
136160
Write-Host "Press [ENTER] to continue ..."
137161
```
138162

139-
1. Run the following PowerShell command to list the newly created virtual machine:
140-
141-
```azurepowershell
142-
$projectName = Read-Host -Prompt "Enter a project name that is used to generate resource group name"
143-
$resourceGroupName = "${projectName}rg"
144-
$vmName = "SimpleWinVM"
145-
146-
Get-AzVM -Name $vmName -ResourceGroupName $resourceGroupName
147-
148-
Write-Host "Press [ENTER] to continue ..."
149-
```
150-
151-
The virtual machine name is hard-coded as **SimpleWinVM** inside the template.
163+
---
152164

153165
1. RDP to the virtual machine to verify the virtual machine has been created successfully.
154166

articles/azure-resource-manager/templates/template-tutorial-deploy-vm-extensions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Deploy VM extensions with template
33
description: Learn how to deploy virtual machine extensions with Azure Resource Manager templates
44
author: mumian
5-
ms.date: 04/16/2020
5+
ms.date: 04/23/2020
66
ms.topic: tutorial
77
ms.author: jgao
88
---

articles/azure-resource-manager/templates/template-tutorial-deployment-script.md

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ms.service: azure-resource-manager
1111
ms.workload: multiple
1212
ms.tgt_pltfrm: na
1313
ms.devlang: na
14-
ms.date: 04/07/2020
14+
ms.date: 04/23/2020
1515
ms.topic: tutorial
1616
ms.author: jgao
1717
---
@@ -280,35 +280,43 @@ The deployment script adds a certificate to the key vault. Configure the key vau
280280
281281
## Deploy the template
282282
283-
Refer to the [Deploy the template](./quickstart-create-templates-use-visual-studio-code.md?tabs=PowerShell#deploy-the-template) section in the Visual Studio Code quickstart for opening the Cloud shell and upload the template file to the shell. And then run the following PowerShell script:
283+
1. Sign in to the [Azure Cloud Shell](https://shell.azure.com)
284284
285-
```azurepowershell-interactive
286-
$projectName = Read-Host -Prompt "Enter a project name that is used to generate resource names"
287-
$location = Read-Host -Prompt "Enter the location (i.e. centralus)"
288-
$upn = Read-Host -Prompt "Enter your email address used to sign in to Azure"
289-
$identityId = Read-Host -Prompt "Enter the user-assigned managed identity ID"
285+
1. Choose your preferred environment by selecting either **PowerShell** or **Bash** (for CLI) on the upper left corner. Restarting the shell is required when you switch.
290286
291-
$adUserId = (Get-AzADUser -UserPrincipalName $upn).Id
292-
$resourceGroupName = "${projectName}rg"
293-
$keyVaultName = "${projectName}kv"
287+
![Azure portal Cloud Shell upload file](./media/template-tutorial-use-template-reference/azure-portal-cloud-shell-upload-file.png)
294288
295-
New-AzResourceGroup -Name $resourceGroupName -Location $location
289+
1. Select **Upload/download files**, and then select **Upload**. See the previous screenshot. Select the file you saved in the previous section. After uploading the file, you can use the **ls** command and the **cat** command to verify the file is uploaded successfully.
296290
297-
New-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateFile "$HOME/azuredeploy.json" -identityId $identityId -keyVaultName $keyVaultName -objectId $adUserId
291+
1. Run the following PowerShell script to deploy the template.
298292
299-
Write-Host "Press [ENTER] to continue ..."
300-
```
293+
```azurepowershell-interactive
294+
$projectName = Read-Host -Prompt "Enter a project name that is used to generate resource names"
295+
$location = Read-Host -Prompt "Enter the location (i.e. centralus)"
296+
$upn = Read-Host -Prompt "Enter your email address used to sign in to Azure"
297+
$identityId = Read-Host -Prompt "Enter the user-assigned managed identity ID"
301298
302-
The deployment script service needs to create additional deployment script resources for script execution. The preparation and the cleanup process can take up to one minute to complete in addition to the actual script execution time.
299+
$adUserId = (Get-AzADUser -UserPrincipalName $upn).Id
300+
$resourceGroupName = "${projectName}rg"
301+
$keyVaultName = "${projectName}kv"
303302
304-
The deployment is failed because of the invalid command, **Write-Output1** is used in the script. You shall get an error saying:
303+
New-AzResourceGroup -Name $resourceGroupName -Location $location
305304
306-
```error
307-
The term 'Write-Output1' is not recognized as the name of a cmdlet, function, script file, or operable
308-
program.\nCheck the spelling of the name, or if a path was included, verify that the path is correct and try again.\n
309-
```
305+
New-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateFile "$HOME/azuredeploy.json" -identityId $identityId -keyVaultName $keyVaultName -objectId $adUserId
310306
311-
The deployment script execution result is stored in the deployment script resources for the troubleshooting purpose.
307+
Write-Host "Press [ENTER] to continue ..."
308+
```
309+
310+
The deployment script service needs to create additional deployment script resources for script execution. The preparation and the cleanup process can take up to one minute to complete in addition to the actual script execution time.
311+
312+
The deployment is failed because of the invalid command, **Write-Output1** is used in the script. You shall get an error saying:
313+
314+
```error
315+
The term 'Write-Output1' is not recognized as the name of a cmdlet, function, script file, or operable
316+
program.\nCheck the spelling of the name, or if a path was included, verify that the path is correct and try again.\n
317+
```
318+
319+
The deployment script execution result is stored in the deployment script resources for the troubleshooting purpose.
312320
313321
## Debug the failed script
314322

articles/azure-resource-manager/templates/template-tutorial-troubleshoot.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,45 +21,45 @@ Both types of errors return an error code that you use to troubleshoot the deplo
2121
This tutorial covers the following tasks:
2222

2323
> [!div class="checklist"]
24-
> * Create a problematic template
25-
> * Troubleshoot validation errors
26-
> * Troubleshoot deployment errors
27-
> * Clean up resources
24+
> - Create a problematic template
25+
> - Troubleshoot validation errors
26+
> - Troubleshoot deployment errors
27+
> - Clean up resources
2828
2929
If you don't have an Azure subscription, [create a free account](https://azure.microsoft.com/free/) before you begin.
3030

31-
[!INCLUDE [updated-for-az](../../../includes/updated-for-az.md)]
32-
3331
## Prerequisites
3432

3533
To complete this article, you need:
3634

37-
* Visual Studio Code with Resource Manager Tools extension. See [Use Visual Studio Code to create ARM templates](use-vs-code-to-create-template.md).
35+
- Visual Studio Code with Resource Manager Tools extension. See [Use Visual Studio Code to create ARM templates](use-vs-code-to-create-template.md).
3836

3937
## Create a problematic template
4038

41-
Open a template called [Create a standard storage account](https://azure.microsoft.com/resources/templates/101-storage-account-create/) from [Azure QuickStart Templates](https://azure.microsoft.com/resources/templates/), and setup two template issues.
39+
Open a template called [Create a standard storage account](https://azure.microsoft.com/resources/templates/101-storage-account-create/) from [Azure Quickstart Templates](https://azure.microsoft.com/resources/templates/), and setup two template issues.
4240

4341
1. From Visual Studio Code, select **File**>**Open File**.
4442
2. In **File name**, paste the following URL:
4543

4644
```url
4745
https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-storage-account-create/azuredeploy.json
4846
```
47+
4948
3. Select **Open** to open the file.
5049
4. Change the **apiVersion** line to the following line:
5150

5251
```json
5352
"apiVersion1": "2018-07-02",
5453
```
54+
5555
- **apiVersion1** is invalid element name. It is a validation error.
5656
- The API version shall be "2018-07-01". It is a deployment error.
5757

5858
5. Select **File**>**Save As** to save the file as **azuredeploy.json** to your local computer.
5959

6060
## Troubleshoot the validation error
6161

62-
Refer to the [Deploy the template](quickstart-create-templates-use-visual-studio-code.md#deploy-the-template) section to deploy the template.
62+
Refer to the [Deploy the template](template-tutorial-create-multiple-instances.md#deploy-the-template) section to deploy the template.
6363

6464
You shall get an error from the shell similar to:
6565

@@ -73,7 +73,7 @@ Use Visual Studio Code to correct the problem by changing **apiVersion1** to **a
7373
7474
## Troubleshoot the deployment error
7575
76-
Refer to the [Deploy the template](quickstart-create-templates-use-visual-studio-code.md#deploy-the-template) section to deploy the template.
76+
Refer to the [Deploy the template](template-tutorial-create-multiple-instances.md#deploy-the-template) section to deploy the template.
7777
7878
You shall get an error from the shell similar to:
7979

0 commit comments

Comments
 (0)