Skip to content

Commit 53a31e1

Browse files
committed
updating whatif
1 parent 512e373 commit 53a31e1

File tree

2 files changed

+38
-8
lines changed

2 files changed

+38
-8
lines changed
Loading

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

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Template deployment what-if (Preview)
33
description: Determine what changes will happen to your resources before deploying an Azure Resource Manager template.
44
author: mumian
55
ms.topic: conceptual
6-
ms.date: 11/20/2019
6+
ms.date: 02/28/2020
77
ms.author: jgao
88
---
99
# Resource Manager template deployment what-if operation (Preview)
@@ -13,7 +13,7 @@ Before deploying a template, you might want to preview the changes that will hap
1313
> [!NOTE]
1414
> The what-if operation is currently in preview. To use it, you must [sign up for the preview](https://aka.ms/armtemplatepreviews). As a preview release, the results may sometimes show that a resource will change when actually no change will happen. We're working to reduce these issues, but we need your help. Please report these issues at [https://aka.ms/whatifissues](https://aka.ms/whatifissues).
1515
16-
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.
16+
You can use the what-if operation with the PowerShell commands or REST API operations.
1717

1818
In PowerShell, the output looks like:
1919

@@ -37,13 +37,25 @@ The what-if operation lists six different types of changes:
3737

3838
## Deployment scope
3939

40-
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.
40+
You can use the what-if operation for deployments at either the subscription or resource group level.
41+
42+
For PowerShell, use:
43+
44+
* **Get-AzResourceGroupDeploymentWhatIf** for resource group deployments
45+
* **Get-AzSubscriptionDeploymentWhatIf** or **Get-AzDeploymentWhatIf** for subscription level deployments
46+
47+
For REST API, use:
48+
49+
* [Deployments - What If](/rest/api/resources/deployments/whatif) for resource group deployments
50+
* [Deployments - What If At Subscription Scope](/rest/api/resources/deployments/whatifatsubscriptionscope) for subscription level deployments
4151

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

54+
This article demonstrates resource group deployments.
55+
4456
## Result format
4557

46-
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`.
58+
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`.
4759

4860
The following screenshots show the two different output formats:
4961

@@ -75,22 +87,40 @@ New-AzResourceGroupDeployment `
7587
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`.
7688

7789
```azurepowershell-interactive
78-
New-AzDeploymentWhatIf `
79-
-ScopeType ResourceGroup `
90+
Get-AzResourceGroupDeploymentWhatIf `
8091
-ResourceGroupName ExampleGroup `
8192
-TemplateUri "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-storage-account-create/azuredeploy.json" `
8293
-storageAccountType Standard_GRS
8394
```
8495

85-
The what-if output is similar to:
96+
The what-if output appears similar to:
8697

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

100+
The text output is:
101+
102+
```powershell
103+
Resource and property changes are indicated with these symbols:
104+
- Delete
105+
~ Modify
106+
107+
The deployment will update the following scope:
108+
109+
Scope: /subscriptions/./resourceGroups/ExampleGroup
110+
111+
~ Microsoft.Storage/storageAccounts/storez2wlfuvcm4awc [2019-04-01]
112+
- properties.accessTier: "Hot"
113+
~ properties.supportsHttpsTrafficOnly: true => "true"
114+
~ sku.name: "Standard_LRS" => "Standard_GRS"
115+
116+
Resource changes: 1 to modify.
117+
```
118+
89119
Notice at the top of the output that colors are defined to indicate the type of changes.
90120

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

93-
Some of the properties that are listed as deleted won't actually change. In the preceding image, these properties are accessTier, encryption.keySource and others in that section. Properties can be incorrectly reported as deleted when they aren't in the template, but are automatically set during deployment as default values. This result is considered "noise" in the what-if response. The final deployed resource will have the values set for the properties. As the what-if operation matures, these properties will be filtered out of the result.
123+
Some of the properties that are listed as deleted won't actually change. In the preceding image, the accessTier property is listed as being deleted. Properties can be incorrectly reported as deleted when they aren't in the template, but are automatically set during deployment as default values. This result is considered "noise" in the what-if response. The final deployed resource will have the values set for the properties. As the what-if operation matures, these properties will be filtered out of the result.
94124

95125
### Test deletion
96126

0 commit comments

Comments
 (0)