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
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.
14
14
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:
16
20
17
21

18
22
19
23
## Change types
20
24
21
-
The what-if operation returns six categories of changes:
25
+
The what-if operation lists six different types of changes:
22
26
23
27
-**Create**: The resource doesn't currently exist but is defined in the template. The resource will be created.
24
28
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.
26
30
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.
28
32
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`.
30
34
31
35
-**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.
32
36
33
37
-**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.
34
38
35
39
## Deployment scope
36
40
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.
38
42
39
43
To learn about subscription level deployments, see [Create resource groups and resources at the subscription level](deploy-to-subscription.md#).
40
44
41
-
To learn more, see the [New-AzDeploymentWhatIf reference](/powershell/module/az.resources/new-azdeploymentwhatif).
42
-
43
45
## Result format
44
46
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`.
46
48
47
49
The following screenshots show the two different output formats:
48
50
@@ -54,57 +56,57 @@ The following screenshots show the two different output formats:
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`.
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.
67
64
68
65
```azurepowershell-interactive
69
-
$resourceGroupName = Read-Host -Prompt "Enter the Resource Group name"
70
-
$location = Read-Host -Prompt "Enter the location (i.e. centralus)"
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.
85
89
86
90
At the bottom of the output, it shows the sku name (storage account type) will be changed from **Standard_LRS** to **Standard_GRS**.
87
91
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):
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).
It's important to remember what-if makes no actual changes. The storage account still exists in your resource group.
107
+
105
108
## Next steps
106
109
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).
107
112
- 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).
0 commit comments