Skip to content

Commit 494160c

Browse files
authored
Merge pull request #200656 from sheisanchez/first-arm-template
first arm tutorial review and new images
2 parents 16a7d96 + b56746d commit 494160c

File tree

7 files changed

+46
-37
lines changed

7 files changed

+46
-37
lines changed
10.4 KB
Loading
30.1 KB
Loading
Loading
Loading
Loading
Loading

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

Lines changed: 46 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
---
2-
title: Tutorial - Create & deploy template
2+
title: Tutorial - Create and deploy template
33
description: Create your first Azure Resource Manager template (ARM template). In the tutorial, you learn about the template file syntax and how to deploy a storage account.
4-
author: mumian
5-
ms.date: 12/01/2021
4+
author: sheila
5+
ms.date: 06/07/2022
66
ms.topic: tutorial
77
ms.author: jgao
88
ms.custom: devx-track-azurepowershell
99

10-
#Customer intent: As a developer new to Azure deployment, I want to learn how to use Visual Studio Code to create and edit Resource Manager templates, so I can use the templates to deploy Azure resources.
10+
#Customer intent: As a developer new to Azure deployment, I want to learn how to use Visual Studio Code to create and edit Azure Resource Manager templates, so I can use them to deploy Azure resources.
1111

1212
---
1313

1414
# Tutorial: Create and deploy your first ARM template
1515

16-
This tutorial introduces you to Azure Resource Manager templates (ARM templates). It shows you how to create a starter template and deploy it to Azure. You'll learn about the structure of the template and the tools you'll need for working with templates. It takes about **12 minutes** to complete this tutorial, but the actual time will vary based on how many tools you need to install.
16+
This tutorial introduces you to Azure Resource Manager templates (ARM templates). It shows you how to create a starter template and deploy it to Azure. It teaches you about the template structure and the tools you need to work with templates. It takes about **12 minutes** to complete this tutorial, but the actual time varies based on how many tools you need to install.
1717

18-
This tutorial is the first of a series. As you progress through the series, you modify the starting template step by step until you've explored all of the core parts of an ARM template. These elements are the building blocks for much more complex templates. We hope by the end of the series you're confident creating your own templates and ready to automate your deployments with templates.
18+
This tutorial is the first of a series. As you progress through the series, you modify the starting template, step by step, until you've explored all of the core parts of an ARM template. These elements are the building blocks for more complex templates. We hope by the end of the series you're confident in creating your own templates and ready to automate your deployments with templates.
1919

20-
If you want to learn about the benefits of using templates and why you should automate deployment with templates, see [ARM template overview](overview.md). To learn about ARM templates through a guided set of modules on Microsoft Learn, see [Deploy and manage resources in Azure by using ARM templates](/learn/paths/deploy-manage-resource-manager-templates/).
20+
If you want to learn about the benefits of using templates and why you should automate deployments with templates, see [ARM template overview](overview.md). To learn about ARM templates through a guided set of modules on [Microsoft Learn](/learn), see [Deploy and manage resources in Azure by using JSON ARM templates](/learn/paths/deploy-manage-resource-manager-templates.md).
2121

22-
If you don't have an Azure subscription, [create a free account](https://azure.microsoft.com/free/) before you begin.
22+
If you don't have a Microsoft Azure subscription, [create a free account](https://azure.microsoft.com/free/) before you begin.
2323

2424
> [!TIP]
25-
> If you're new to ARM templates, you might consider learning Bicep instead. Bicep is a new language that offers the same capabilities as ARM templates but with a syntax that's easier to use. To start learning Bicep, see [Quickstart: Create Bicep files with Visual Studio Code](../bicep/quickstart-create-bicep-use-visual-studio-code.md).
25+
> If you're new to ARM templates, you might consider learning Bicep instead. Bicep is a new language that offers the same capabilities as ARM templates but with an easier-to-use syntax. To start learning Bicep, see [Quickstart: Create Bicep files with Visual Studio Code](../bicep/quickstart-create-bicep-use-visual-studio-code.md).
2626
2727
## Get tools
2828

2929
Let's start by making sure you have the tools you need to create and deploy templates. Install these tools on your local machine.
3030

3131
### Editor
3232

33-
Templates are JSON files. To create templates, you need a good JSON editor. We recommend Visual Studio Code with the Resource Manager Tools extension. If you need to install these tools, see [Quickstart: Create ARM templates with Visual Studio Code](quickstart-create-templates-use-visual-studio-code.md).
33+
Templates are JavaScript Object Notation (JSON) files. To create templates, you need a good JSON editor. We recommend Visual Studio Code with the Azure Resource Manager Tools extension. If you need to install these tools, see [Quickstart: Create ARM templates with Visual Studio Code](quickstart-create-templates-use-visual-studio-code.md).
3434

3535
### Command-line deployment
3636

37-
You also need either Azure PowerShell or Azure CLI to deploy the template. If you use Azure CLI, you must have the latest version. For the installation instructions, see:
37+
You also need either Azure PowerShell or Azure Command-Line Interface (CLI) to deploy the template. If you use Azure CLI, you need to have version 2.37.0 or later. For the installation instructions, see:
3838

3939
- [Install Azure PowerShell](/powershell/azure/install-az-ps)
4040
- [Install Azure CLI on Windows](/cli/azure/install-azure-cli-windows)
@@ -44,17 +44,17 @@ You also need either Azure PowerShell or Azure CLI to deploy the template. If yo
4444
After installing either Azure PowerShell or Azure CLI, make sure you sign in for the first time. For help, see [Sign in - PowerShell](/powershell/azure/install-az-ps#sign-in) or [Sign in - Azure CLI](/cli/azure/get-started-with-azure-cli#sign-in).
4545

4646
> [!IMPORTANT]
47-
> If you're using Azure CLI, make sure you have version 2.6 or later. The commands shown in this tutorial will not work if you're using earlier versions. To check your installed version, use: `az --version`.
47+
> If you're using Azure CLI, make sure you have version 2.37.0 or later. If you're using Azure PowerShell, make sure you have version 7.2.4 or later. The commands shown in this tutorial don't work if you're using earlier versions. To check your installed version, use: `az --version`.
4848
4949
Okay, you're ready to start learning about templates.
5050

5151
## Create your first template
5252

53-
1. Open Visual Studio Code with the Resource Manager Tools extension installed.
53+
1. Open Visual Studio Code with the installed ARM processor Tools extension.
5454
1. From the **File** menu, select **New File** to create a new file.
55-
1. From the **File** menu, select **Save as**.
55+
1. From the **File** menu, select **Save As**.
5656
1. Name the file _azuredeploy_ and select the _json_ file extension. The complete name of the file is _azuredeploy.json_.
57-
1. Save the file to your workstation. Select a path that is easy to remember because you'll provide that path later when deploying the template.
57+
1. Save the file to your workstation. Select a path that's easy to remember because you need to provide that path later when deploying the template.
5858
1. Copy and paste the following JSON into the file:
5959

6060
```json
@@ -67,25 +67,25 @@ Okay, you're ready to start learning about templates.
6767

6868
Here's what your Visual Studio Code environment looks like:
6969

70-
![ARM template Visual Studio Code first template](./media/template-tutorial-create-first-template/resource-manager-visual-studio-code-first-template.png)
70+
:::image type="content" source="./media/template-tutorial-create-first-template/resource-manager-visual-studio-code-first-template.png" alt-text="ARM template Visual Studio Code first template.":::
7171

7272
This template doesn't deploy any resources. We're starting with a blank template so you can get familiar with the steps to deploy a template while minimizing the chance of something going wrong.
7373

7474
The JSON file has these elements:
7575

76-
- `$schema`: Specifies the location of the JSON schema file. The schema file describes the properties that are available within a template. For example, the schema defines `resources` as one of the valid properties for a template. Don't worry that the date for the schema is 2019-04-01. This schema version is up to date and includes all of the latest features. The schema date hasn't been changed because there have been no breaking changes since its introduction.
77-
- `contentVersion`: Specifies the version of the template (such as 1.0.0.0). You can provide any value for this element. Use this value to document significant changes in your template. When deploying resources using the template, this value can be used to make sure that the right template is being used.
78-
- `resources`: Contains the resources you want to deploy or update. Currently, it's empty, but you'll add resources later.
76+
- `$schema`: Specifies the location of the JSON schema file. The schema file describes the properties that are available within a template. The schema, for example, defines `resources` as one of the valid properties for a template. Don't worry that the date for the schema is 2019-04-01. This schema version is up to date and includes all of the latest features. The schema date hasn't been changed because there have been no breaking changes since its introduction.
77+
- `contentVersion`: Specifies the version of the template, such as 1.0.0.0. You can provide any value for this element. Use this value to document significant changes in your template. When you deploy resources using the template, you can use this value to make sure you're using the right template.
78+
- `resources`: Contains the resources you want to deploy or update. Currently, it's empty, but you can add resources later.
7979

8080
1. Save the file.
8181

8282
Congratulations, you've created your first template.
8383

8484
## Sign in to Azure
8585

86-
To start working with Azure PowerShell/Azure CLI, sign in with your Azure credentials.
86+
To start working with Azure PowerShell or Azure CLI, sign in with your Azure credentials.
8787

88-
Select the tabs in the following code sections to choose between Azure PowerShell and Azure CLI. The CLI examples in this article are written for the Bash shell.
88+
Select the tabs in the following code sections to pick between Azure PowerShell and Azure CLI. The CLI examples in this article are written for the Bash shell.
8989

9090
# [PowerShell](#tab/azure-powershell)
9191

@@ -101,7 +101,7 @@ az login
101101

102102
---
103103

104-
If you have multiple Azure subscriptions, select the subscription you want to use. Replace `SubscriptionName` with your subscription name. You can also use the subscription ID instead of the subscription name.
104+
If you have multiple Azure subscriptions, choose the subscription you want to use. Replace `SubscriptionName` with your subscription name. You can also use your subscription ID instead of your subscription name.
105105

106106
# [PowerShell](#tab/azure-powershell)
107107

@@ -119,7 +119,12 @@ az account set --subscription SubscriptionName
119119

120120
## Create resource group
121121

122-
When you deploy a template, you specify a resource group that will contain the resources. Before running the deployment command, create the resource group with either Azure CLI or Azure PowerShell.
122+
When you deploy a template, you can specify a resource group to contain the resources. Before running the deployment command, create the resource group with either the Bash Azure CLI or Azure PowerShell.
123+
124+
> [!NOTE]
125+
> Samples for the Azure CLI are written for the bash shell. To run this sample in Windows PowerShell or the Command Prompt, you may need to remove the back slashes and write the command as one line such as:
126+
127+
```az group create --name myResourceGroup --location "Central US"```
123128

124129
# [PowerShell](#tab/azure-powershell)
125130

@@ -155,7 +160,7 @@ New-AzResourceGroupDeployment `
155160

156161
# [Azure CLI](#tab/azure-cli)
157162

158-
To run this deployment command, you must have the [latest version](/cli/azure/install-azure-cli) of Azure CLI.
163+
To run this deployment command, you need to have the [latest version](/cli/azure/install-azure-cli) of Azure CLI.
159164

160165
```azurecli
161166
templateFile="{provide-the-path-to-the-template-file}"
@@ -171,11 +176,11 @@ The deployment command returns results. Look for `ProvisioningState` to see whet
171176

172177
# [PowerShell](#tab/azure-powershell)
173178

174-
![PowerShell deployment provisioning state](./media/template-tutorial-create-first-template/resource-manager-deployment-provisioningstate.png)
179+
:::image type="content" source="./media/template-tutorial-create-first-template/resource-manager-deployment-provisioningstate.png" alt-text="PowerShell deployment provisioning state.":::
175180

176181
# [Azure CLI](#tab/azure-cli)
177182

178-
![Azure CLI deployment provisioning state](./media/template-tutorial-create-first-template/azure-cli-provisioning-state.png)
183+
:::image type="content" source="./media/template-tutorial-create-first-template/azure-cli-provisioning-state.png" alt-text="Azure CLI deployment provisioning state.":::
179184

180185
---
181186

@@ -190,34 +195,38 @@ You can verify the deployment by exploring the resource group from the Azure por
190195

191196
1. From the left menu, select **Resource groups**.
192197

193-
1. Select the resource group deploy in the last procedure. The default name is **myResourceGroup**. You shall see no resource deployed within the resource group.
198+
1. Check the box to the left of **myResourceGroup** and select **myResourceGroup**.
194199

195-
1. Notice in the upper right of the overview, the status of the deployment is displayed. Select **1 Succeeded**.
200+
1. Select the resource group you created in the earlier procedure. The default name is **myResourceGroup**. The resource group doesn't have any resources yet because you deployed a blank template.
196201

197-
![View deployment status](./media/template-tutorial-create-first-template/deployment-status.png)
202+
1. Notice in the middle of the overview, in the **Essentials** section, the page displays the deployment status next to **Deployments**. Select **1 Succeeded**.
198203

199-
1. You see a history of deployment for the resource group. Select **blanktemplate**.
204+
:::image type="content" source="./media/template-tutorial-create-first-template/deployment-status.png" alt-text="See deployment status.":::
200205

201-
![Select deployment](./media/template-tutorial-create-first-template/select-from-deployment-history.png)
206+
1. You see a history of deployment for the resource group. Check the box to the left of **blanktemplate** and select **blanktemplate**.
202207

203-
1. You see a summary of the deployment. In this case, there's not a lot to see because no resources were deployed. Later in this series you might find it helpful to review the summary in the deployment history. Notice on the left you can view inputs, outputs, and the template used during deployment.
208+
:::image type="content" source="./media/template-tutorial-create-first-template/select-from-deployment-history.png" alt-text="Select deployment.":::
204209

205-
![View deployment summary](./media/template-tutorial-create-first-template/view-deployment-summary.png)
210+
1. You see a summary of the deployment. In this case, there's not a lot to see because no resources are deployed. Later in this series you might find it helpful to review the summary in the deployment history. Notice on the left you can see inputs, outputs, and the template that the deployment used.
211+
212+
:::image type="content" source="./media/template-tutorial-create-first-template/view-deployment-summary.png" alt-text="See deployment summary.":::
206213

207214
## Clean up resources
208215

209216
If you're moving on to the next tutorial, you don't need to delete the resource group.
210217

211218
If you're stopping now, you might want to delete the resource group.
212219

213-
1. From the Azure portal, select **Resource group** from the left menu.
214-
2. Enter the resource group name in the **Filter by name** field.
215-
3. Select the resource group name.
220+
1. From the Azure portal, select **Resource groups** from the left menu.
221+
2. Type the resource group name in the **Filter for any field...**.
222+
3. Check the box next to **myResourceGroup** and select **myResourceGroup** or the resource group name you chose.
216223
4. Select **Delete resource group** from the top menu.
217224

225+
:::image type="content" source="./media/template-tutorial-create-first-template/resource-deletion.png" alt-text="See deletion.":::
226+
218227
## Next steps
219228

220-
You created a simple template to deploy to Azure. In the next tutorial, you'll add a storage account to the template and deploy it to your resource group.
229+
You created a simple template to deploy to Azure. In the next tutorial, you can learn how to add a storage account to the template and deploy it to your resource group.
221230

222231
> [!div class="nextstepaction"]
223232
> [Add resource](template-tutorial-add-resource.md)

0 commit comments

Comments
 (0)