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
# Tutorial: Use parameter files to deploy your ARM template
13
13
14
-
In this tutorial, you learn how to use [parameter files](parameter-files.md) to store the values you pass in during deployment. In the previous tutorials, you used inline parameters with your deployment command. This approach worked for testing your Azure Resource Manager template (ARM template), but when automating deployments it can be easier to pass a set of values for your environment. Parameter files make it easier to package parameter values for a specific environment. In this tutorial, you'll create parameter files for development and production environments. It takes about**12 minutes** to complete.
14
+
In this tutorial, you learn how to use [parameter files](parameter-files.md) to store the values you pass in during deployment. In the previous tutorials, you used inline parameters with your deployment command. This approach worked for testing your Azure Resource Manager template (ARM template), but when automating deployments it can be easier to pass a set of values for your environment. Parameter files make it easier to package parameter values for a specific environment. In this tutorial, you create parameter files for development and production environments. This instruction takes**12 minutes** to complete.
15
15
16
16
## Prerequisites
17
17
18
18
We recommend that you complete the [tutorial about tags](template-tutorial-add-tags.md), but it's not required.
19
19
20
-
You must have Visual Studio Code with the Resource Manager Tools extension, and either Azure PowerShell or Azure CLI. For more information, see [template tools](template-tutorial-create-first-template.md#get-tools).
20
+
You need to have Visual Studio Code with the Resource Manager Tools extension, and either Azure PowerShell or Azure Command-Line Interface (CLI). For more information, see [template tools](template-tutorial-create-first-template.md#get-tools).
21
21
22
22
## Review template
23
23
24
-
Your template has many parameters you can provide during deployment. At the end of the previous tutorial, your template looked like:
24
+
Your template has many parameters you can provide during deployment. At the end of the previous tutorial, your template had the following JSON file:
This template works well, but now you want to easily manage the parameters that you pass in for the template.
29
29
30
30
## Add parameter files
31
31
32
-
Parameter files are JSON files with a structure that is similar to your template. In the file, you provide the parameter values you want to pass in during deployment.
32
+
Parameter files are JSON files with a structure that's similar to your template. In the file, you provide the parameter values you want to pass in during deployment.
33
33
34
-
Within the parameter file, you provide values for the parameters in your template. The name of each parameter in your parameter file must match the name of a parameter in your template. The name is case-insensitive but to easily see the matching values we recommend that you match the casing from the template.
34
+
Within the parameter file, you provide values for the parameters in your template. The name of each parameter in your parameter file needs to match the name of a parameter in your template. The name is case-insensitive but to easily see the matching values we recommend that you match the casing from the template.
35
35
36
36
You don't have to provide a value for every parameter. If an unspecified parameter has a default value, that value is used during deployment. If a parameter doesn't have a default value and isn't specified in the parameter file, you're prompted to provide a value during deployment.
37
37
38
-
You can't specify a parameter name in your parameter file that doesn't match a parameter name in the template. You get an error when unknown parameters are provided.
38
+
You can't specify a parameter name in your parameter file that doesn't match a parameter name in the template. You get an error when you provide unknown parameters.
39
39
40
-
In Visual Studio Code, create a new file with following content. Save the file with the name _azuredeploy.parameters.dev.json_.
40
+
In Visual Studio Code, create a new file with the following content. Save the file with the name _azuredeploy.parameters.dev.json_.
This file is your parameter file for the production environment. Notice that it uses **Standard_GRS** for the storage account, names resources with a **contoso** prefix, and sets the `Environment` tag to **Production**. In a real production environment, you would also want to use an app service with a SKU other than free, but we'll continue to use that SKU for this tutorial.
50
+
This file is your parameter file for the production environment. Notice that it uses **Standard_GRS** for the storage account, names resources with a **contoso** prefix, and sets the `Environment` tag to **Production**. In a real production environment, you would also want to use an app service with a SKU other than free, but we use that SKU for this tutorial.
51
51
52
52
## Deploy template
53
53
@@ -57,7 +57,7 @@ As a final test of your template, let's create two new resource groups. One for
57
57
58
58
For the template and parameter variables, replace `{path-to-the-template-file}`, `{path-to-azuredeploy.parameters.dev.json}`, `{path-to-azuredeploy.parameters.prod.json}`, and the curly braces `{}` with your template and parameter file paths.
59
59
60
-
First, we'll deploy to the dev environment.
60
+
First, let's deploy to the dev environment.
61
61
62
62
# [PowerShell](#tab/azure-powershell)
63
63
@@ -76,7 +76,7 @@ New-AzResourceGroupDeployment `
76
76
77
77
# [Azure CLI](#tab/azure-cli)
78
78
79
-
To run this deployment command, you must have the [latest version](/cli/azure/install-azure-cli) of Azure CLI.
79
+
To run this deployment command, you need to have the [latest version](/cli/azure/install-azure-cli) of Azure CLI.
80
80
81
81
```azurecli
82
82
templateFile="{path-to-the-template-file}"
@@ -93,7 +93,7 @@ az deployment group create \
93
93
94
94
---
95
95
96
-
Now, we'll deploy to the production environment.
96
+
Now, we deploy to the production environment.
97
97
98
98
# [PowerShell](#tab/azure-powershell)
99
99
@@ -126,27 +126,31 @@ az deployment group create \
126
126
---
127
127
128
128
> [!NOTE]
129
-
> If the deployment failed, use the `verbose` switch to get information about the resources being created. Use the `debug` switch to get more information for debugging.
129
+
> If the deployment fails, use the `verbose` switch to get information about the resources you're creating. Use the `debug` switch to get more information for debugging.
130
130
131
131
## Verify deployment
132
132
133
133
You can verify the deployment by exploring the resource groups from the Azure portal.
134
134
135
135
1. Sign in to the [Azure portal](https://portal.azure.com).
136
136
1. From the left menu, select **Resource groups**.
137
-
1. You see the two new resource groups you deployed in this tutorial.
137
+
1. You see the two new resource groups you deploy in this tutorial.
138
138
1. Select either resource group and view the deployed resources. Notice that they match the values you specified in your parameter file for that environment.
139
139
140
140
## Clean up resources
141
141
142
-
1. From the Azure portal, select **Resource group** from the left menu.
143
-
2. Enter the resource group name in the **Filter by name** field. If you've completed this series, you have three resource groups to delete - **myResourceGroup**, **myResourceGroupDev**, and **myResourceGroupProd**.
144
-
3. Select the resource group name.
145
-
4. Select **Delete resource group** from the top menu.
142
+
1. From the Azure portal, select **Resource groups** from the left menu.
143
+
1. Select the hyperlinked resource group name next to the check box. If you complete this series, you have three resource groups to delete - **myResourceGroup**, **myResourceGroupDev**, and **myResourceGroupProd**.
144
+
1. Select the **Delete resource group** icon from the top menu.
145
+
146
+
> [!CAUTION]
147
+
> Deleting a resource group is irreversible.
148
+
149
+
1. Type the resource group name in the pop-up window that displays and select **Delete**.
146
150
147
151
## Next steps
148
152
149
-
Congratulations, you've finished this introduction to deploying templates to Azure. Let us know if you have any comments and suggestions in the feedback section. Thanks!
153
+
Congratulations. You've finished this introduction to deploying templates to Azure. Let us know if you have any comments and suggestions in the feedback section.
150
154
151
155
The next tutorial series goes into more detail about deploying templates.
0 commit comments