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
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/templates/template-deploy-what-if.md
+41-13Lines changed: 41 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,27 +37,35 @@ The what-if operation lists six different types of changes:
37
37
38
38
## What-if commands
39
39
40
-
You can use the what-if operation for deployments at either the subscription or resource group level.
40
+
You can use either Azure PowerShell or Azure REST API for the what-if operation.
41
41
42
-
For PowerShell, use:
42
+
### Azure PowerShell
43
+
44
+
To preview changes, use:
43
45
44
46
*`Get-AzResourceGroupDeploymentWhatIf` for resource group deployments
45
47
*`Get-AzSubscriptionDeploymentWhatIf` or `Get-AzDeploymentWhatIf` for subscription level deployments
46
48
49
+
Or, you can use the `-Whatif` switch parameter on the deployment command.
50
+
51
+
*`New-AzResourceGroupDeployment -Whatif` for resource group deployments
52
+
*`New-AzSubscriptionDeployment -Whatif` and `New-AzDeployment -Whatif` for subscription level deployments
53
+
54
+
Or, you can preview the changes before being prompted to continue with the deployment.
55
+
56
+
*`New-AzResourceGroupDeployment -Confirm` for resource group deployments
57
+
*`New-AzSubscriptionDeployment -Confirm` and `New-AzDeployment -Confirm` for subscription level deployments
58
+
47
59
> [!NOTE]
48
-
> Prior to the release of version 2.0.1-alpha5, you used the `New-AzDeploymentWhatIf` command. This command has been replaced by the `Get-Az*DeploymentWhatIf` syntax. If you've used an earlier version, you need to update those commands.
60
+
> Prior to the release of version 2.0.1-alpha5, you used the `New-AzDeploymentWhatIf` command. This command has been replaced by the `Get-AzDeploymentWhatIf`, `Get-AzResourceGroupDeploymentWhatIf`, and `Get-AzSubscriptionDeploymentWhatIf` commands. If you've used an earlier version, you need to update that syntax. The `-ScopeType` parameter has been removed.
49
61
50
-
You can also run the what-if operation from the `New-AzResourceGroupDeployment`, `New-AzSubscriptionDeployment` and `New-AzDeployment` commands. Use the `-Whatif` switch parameter to run the what-if command. Use the `-Confirm` switch parameter to first run what-if and then have the option to complete the deployment.
62
+
### Azure REST API
51
63
52
64
For REST API, use:
53
65
54
66
*[Deployments - What If](/rest/api/resources/deployments/whatif) for resource group deployments
55
67
*[Deployments - What If At Subscription Scope](/rest/api/resources/deployments/whatifatsubscriptionscope) for subscription level deployments
56
68
57
-
To learn about subscription level deployments, see [Create resource groups and resources at the subscription level](deploy-to-subscription.md#).
58
-
59
-
This article demonstrates resource group deployments.
60
-
61
69
## Result format
62
70
63
71
You can control the level of detail that is returned about the predicted changes. Set the **ResultFormat** parameter to **FullResourcePayloads** to get a list of resources what will change and details about the properties that will change. Set the **ResultFormat** parameter to **ResourceIdOnly** to get a list of resources that will change. The default value is `FullResourcePayloads`.
@@ -104,7 +112,7 @@ The following results show the two different output formats:
104
112
105
113
To see how what-if works, let's runs some tests. First, deploy a template from [Azure Quickstart templates that creates a storage account](https://github.com/Azure/azure-quickstart-templates/blob/master/101-storage-account-create/azuredeploy.json). The default storage account type is `Standard_LRS`. You'll use this storage account to test how changes are reported by what-if.
After the deployment completes, you're ready to test the what-if operation. Run the what-if command but change the storage account type to `Standard_GRS`.
@@ -157,7 +165,7 @@ Some of the properties that are listed as deleted won't actually change. In the
157
165
158
166
The what-if operation supports using [deployment mode](deployment-modes.md). When set to complete mode, resources not in the template are deleted. The following example deploys a [template that has no resources defined](https://github.com/Azure/azure-docs-json-samples/blob/master/empty-template/azuredeploy.json) in complete mode.
@@ -196,9 +204,9 @@ It's important to remember what-if makes no actual changes. The storage account
196
204
197
205
## Confirm before deployment
198
206
199
-
To preview changes before deploying a template, use the `-Confirm` switch parameter with the deployment command. If the changes are as you expected, you can then confirm that you want the deployment to complete. The following command allows you to preview changes before the template is deployed.
207
+
To preview changes before deploying a template, use the `-Confirm` switch parameter with the deployment command. If the changes are as you expected, confirm that you want the deployment to complete. The following command allows you to preview changes before the template is deployed.
- If you notice incorrect results from the preview release of what-if, please report the issues at [https://aka.ms/whatifissues](https://aka.ms/whatifissues).
0 commit comments