Skip to content

Commit f7bf807

Browse files
committed
add what if to toc
1 parent 8c359e1 commit f7bf807

File tree

2 files changed

+43
-39
lines changed

2 files changed

+43
-39
lines changed

articles/azure-resource-manager/template-deploy-what-if.md

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,47 @@ description: Determine what changes will happen to your resources before deployi
44
author: mumian
55
ms.service: azure-resource-manager
66
ms.topic: conceptual
7-
ms.date: 11/07/2019
7+
ms.date: 11/08/2019
88
ms.author: jgao
99

1010
---
1111
# Resource Manager template deployment what-if operation
1212

13-
Before deploying a template, you might want to preview the changes that will happen if you deploy the template. Azure Resource Manager provides the what-if operation to let you see the changes. The what-if operation doesn't make any changes to existing resources. Instead, it predicts the changes if the specified template is deployed. Use this feature to make sure your template doesn't make any unexpected changes.
13+
Before deploying a template, you can preview the changes that will happen. Azure Resource Manager provides the what-if operation to let you see how resources will be changed if you deploy the template. The what-if operation doesn't make any changes to existing resources. Instead, it predicts the changes if the specified template is deployed. Use this feature to make sure your template doesn't make any unexpected changes.
1414

15-
The output looks like:
15+
The what-if operation is currently in preview. To use it, you must sign up for the preview.
16+
17+
You can use the what-if operation with the `New-AzDeploymentWhatIf` PowerShell command or the [Deployments - What If](/rest/api/resources/deployments/whatif) REST operation.
18+
19+
In PowerShell, the output looks like:
1620

1721
![Resource Manager template deployment what-if operation fullresourcepayload and change types](./media/template-deploy-what-if/resource-manager-deployment-whatif-change-types.png)
1822

1923
## Change types
2024

21-
The what-if operation returns six categories of changes:
25+
The what-if operation lists six different types of changes:
2226

2327
- **Create**: The resource doesn't currently exist but is defined in the template. The resource will be created.
2428

25-
- **Delete**: This change type only applies when using [complete mode](deployment-modes.md) for deployment. The resource exists, but isn't defined in the template. With complete mode, the resource will be deleted. Only resources that support complete mode deletion are included in this change type. For a list of those resources, see [Deletion of Azure resources for complete mode deployments](complete-mode-deletion.md).
29+
- **Delete**: This change type only applies when using [complete mode](deployment-modes.md) for deployment. The resource exists, but isn't defined in the template. With complete mode, the resource will be deleted. Only resources that [support complete mode deletion](complete-mode-deletion.md) are included in this change type.
2630

27-
- **Ignore**: The resource exists, but isn't defined in the template. The resource won't be deployed or modified. (Proxy resources don't show up with this change type because we can't discover them. Tracked resources in Complete mode that are outside of the RG that matches the what-if request will fall into this bucket as well.)
31+
- **Ignore**: The resource exists, but isn't defined in the template. The resource won't be deployed or modified.
2832

29-
- **Deploy**: The resource exists, and is defined in the template. The resource will be redeployed. The properties of the resource may or may not change. This change type is returned because the operation doesn't have enough information to determine if any properties will change. You only see this condition when [ResultFormat](#result-format) is set to `ResourceIdOnly`.
33+
- **Deploy**: The resource exists, and is defined in the template. The resource will be redeployed. The properties of the resource may or may not change. The operation returns this change type when it doesn't have enough information to determine if any properties will change. You only see this condition when [ResultFormat](#result-format) is set to `ResourceIdOnly`.
3034

3135
- **NoChange**: The resource exists, and is defined in the template. The resource will be redeployed, but the properties of the resource won't change. This change type is returned when [ResultFormat](#result-format) is set to `FullResourcePayloads`, which is the default value.
3236

3337
- **Modify**: The resource exists, and is defined in the template. The resource will be redeployed, and the properties of the resource will change. This change type is returned when [ResultFormat](#result-format) is set to `FullResourcePayloads`, which is the default value.
3438

3539
## Deployment scope
3640

37-
The what-if operation can be used with deployments at either the subscription or resource group level. The switch for the parameter is called `-ScopeType`. The accepted values are `Subscription` and `Resource Group`. This article only demonstrates the resource group level deployment what-if operation.
41+
You can use the what-if operation for deployments at either the subscription or resource group level. You set the deployment scope with the `-ScopeType` parameter. The accepted values are `Subscription` and `ResourceGroup`. This article demonstrates resource group deployments.
3842

3943
To learn about subscription level deployments, see [Create resource groups and resources at the subscription level](deploy-to-subscription.md#).
4044

41-
To learn more, see the [New-AzDeploymentWhatIf reference](/powershell/module/az.resources/new-azdeploymentwhatif).
42-
4345
## Result format
4446

45-
Use the `-ResultFormat` parameter to control the amount of information that is returned about the predicted changes. To see all properties that will change, set the result format to `FullResourcePayloads`. To see only which resources will change, set the result format to `ResourceIdOnly`. The default value is `FullResourcePayloads`.
47+
You can control the level of detail that is returned about the predicted changes. Use the `-ResultFormat` parameter to set whether you want only a list of resources that will change or whether that list of resources should also include details about the properties that will change. To see all properties, set the result format to `FullResourcePayloads`. To see only which resources will change, set the result format to `ResourceIdOnly`. The default value is `FullResourcePayloads`.
4648

4749
The following screenshots show the two different output formats:
4850

@@ -54,57 +56,57 @@ The following screenshots show the two different output formats:
5456

5557
![Resource Manager template deployment what-if operation fullresourcepayloads output](./media/template-deploy-what-if/resource-manager-deployment-whatif-output-fullresourcepayload.png)
5658

57-
5859
## Run what-if operation
5960

60-
The template used in this article is from [Azure Quickstart templates](https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-storage-account-create/azuredeploy.json). The template creates a storage account. The default storage account type is `Standard_LRS`.
61+
To see how what-if works, let's runs some tests. You'll deploy a template from [Azure Quickstart templates that creates a storage account](https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-storage-account-create/azuredeploy.json). The default storage account type is `Standard_LRS`.
6162

62-
[!code-json[<Azure Resource Manager template create storage account>](~/quickstart-templates/101-storage-account-create/azuredeploy.json)]
63-
64-
To demonstrate the what-if operation, you start with deploying a storage account resource with the default **Standard_LRS** storage account type, and then run the what-if operation with a different storage account type called `Standard_GRS`.
65-
66-
Select **Try it** to open the Azure Cloud Shell, and then paste the script into the shell pane.
63+
To set up your environment, deploy a storage account resource with the default **Standard_LRS** storage account type.
6764

6865
```azurepowershell-interactive
69-
$resourceGroupName = Read-Host -Prompt "Enter the Resource Group name"
70-
$location = Read-Host -Prompt "Enter the location (i.e. centralus)"
71-
72-
New-AzResourceGroup -Name $resourceGroupName -Location "$location"
73-
New-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateUri "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-storage-account-create/azuredeploy.json"
66+
New-AzResourceGroup `
67+
-Name ExampleGroup `
68+
-Location centralus
69+
New-AzResourceGroupDeployment `
70+
-ResourceGroupName ExampleGroup `
71+
-TemplateUri "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-storage-account-create/azuredeploy.json"
72+
```
7473

75-
New-AzDeploymentWhatIf -ScopeType ResourceGroup -ResourceGroupName $resourceGroupName -TemplateUri "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-storage-account-create/azuredeploy.json" -storageAccountType Standard_GRS
74+
After the deployment completes, you're ready to test the what-if operation. Run the what-if command but set the storage account type to `Standard_GRS`.
7675

77-
Write-Host "Press [ENTER] to continue ..."
76+
```azurepowershell-interactive
77+
New-AzDeploymentWhatIf `
78+
-ScopeType ResourceGroup `
79+
-ResourceGroupName ExampleGroup `
80+
-TemplateUri "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-storage-account-create/azuredeploy.json" `
81+
-storageAccountType Standard_GRS
7882
```
7983

8084
The what-if output is similar to:
8185

8286
![Resource Manager template deployment what-if operation output](./media/template-deploy-what-if/resource-manager-deployment-whatif-output.png)
8387

84-
There is a legend at the top of the output indicating what will be deleted and what will be modified.
88+
Notice at the top of the output that colors are defined to indicate the type of changes.
8589

8690
At the bottom of the output, it shows the sku name (storage account type) will be changed from **Standard_LRS** to **Standard_GRS**.
8791

88-
89-
## Use deployment mode
90-
91-
When deploying your resources, you specify that the deployment is either an incremental update or a complete update. The primary difference between these two modes is how Resource Manager handles existing resources in the resource group that aren't in the template. The default mode is incremental. To learn more, see [Azure Resource Manager deployment modes](deployment-modes.md).
92-
93-
The what-if operation supports using deployment mode. The following demo shows using deployment mode with an empty template (with no resources defined):
94-
95-
[!code-json[](~/resourcemanager-templates/empty-template/azuredeploy.json)]
92+
The what-if operation supports using [deployment mode](deployment-modes.md). The following example tests deploying a [template that has no resources defined](https://github.com/Azure/azure-docs-json-samples/blob/master/empty-template/azuredeploy.json).
9693

9794
```azurepowershell-interactive
98-
New-AzDeploymentWhatIf -ScopeType ResourceGroup -ResourceGroupName $resourceGroupName -TemplateUri "https://raw.githubusercontent.com/Azure/azure-docs-json-samples/master/empty-template/azuredeploy.json" -Mode Complete
95+
New-AzDeploymentWhatIf `
96+
-ScopeType ResourceGroup `
97+
-ResourceGroupName ExampleGroup `
98+
-TemplateUri "https://raw.githubusercontent.com/Azure/azure-docs-json-samples/master/empty-template/azuredeploy.json" `
99+
-Mode Complete
99100
```
100101

101-
The output indicates that the storage account will be deleted if the empty template is deployed in the complete deployment mode.
102+
Because no resources are defined in the template and the deployment mode is set to complete, the storage account will be deleted.
102103

103104
![Resource Manager template deployment what-if operation output deployment mode complete](./media/template-deploy-what-if/resource-manager-deployment-whatif-output-mode-complete.png)
104105

106+
It's important to remember what-if makes no actual changes. The storage account still exists in your resource group.
107+
105108
## Next steps
106109

110+
- To deploy templates with Azure PowerShell, see [Deploy resources with Resource Manager templates and Azure PowerShell](resource-group-template-deploy.md).
111+
- To deploy templates with REST, see [Deploy resources with Resource Manager templates and Resource Manager REST API](resource-group-template-deploy-rest.md).
107112
- To roll back to a successful deployment when you get an error, see [Rollback on error to successful deployment](rollback-on-error.md).
108-
- To specify how to handle resources that exist in the resource group but aren't defined in the template, see [Azure Resource Manager deployment modes](deployment-modes.md).
109-
- To understand how to define parameters in your template, see [Understand the structure and syntax of Azure Resource Manager templates](resource-group-authoring-templates.md).
110-
- For information about deploying a template that requires a SAS token, see [Deploy private template with SAS token](resource-manager-powershell-sas-token.md).

articles/azure-resource-manager/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@
152152
- name: Deploy - REST API
153153
displayName: deployment
154154
href: resource-group-template-deploy-rest.md
155+
- name: What-if deployment
156+
href: template-deploy-what-if.md
155157
- name: Redeploy on error
156158
displayName: rollback
157159
href: rollback-on-error.md

0 commit comments

Comments
 (0)