Skip to content

Commit 5bef569

Browse files
committed
update
1 parent 0568772 commit 5bef569

File tree

2 files changed

+67
-26
lines changed

2 files changed

+67
-26
lines changed
Loading

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

Lines changed: 67 additions & 26 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: 02/28/2020
6+
ms.date: 03/04/2020
77
ms.author: jgao
88
---
99
# Resource Manager template deployment what-if operation (Preview)
@@ -17,45 +17,58 @@ You can use the what-if operation with the PowerShell commands or REST API opera
1717

1818
In PowerShell, the output looks like:
1919

20-
![Resource Manager template deployment what-if operation fullresourcepayload and change types](./media/template-deploy-what-if/resource-manager-deployment-whatif-change-types.png)
20+
```powershell
21+
Resource and property changes are indicated with these symbols:
22+
- Delete
23+
+ Create
24+
~ Modify
2125
22-
## Change types
26+
The deployment will update the following scope:
2327
24-
The what-if operation lists six different types of changes:
28+
Scope: /subscriptions/3a4176e0-58d3-4bb8-8cc2-9b8776777f27/resourceGroups/ExampleGroup
2529
26-
- **Create**: The resource doesn't currently exist but is defined in the template. The resource will be created.
30+
~ Microsoft.Network/virtualNetworks/vnet-001 [2018-10-01]
31+
- tags.Owner: "Team A"
32+
~ properties.addressSpace.addressPrefixes: [
33+
- 0: "10.0.0.0/16"
34+
+ 0: "10.0.0.0/15"
35+
]
36+
~ properties.subnets: [
37+
- 0:
2738
28-
- **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.
39+
name: "subnet001"
40+
properties.addressPrefix: "10.0.0.0/24"
2941
30-
- **Ignore**: The resource exists, but isn't defined in the template. The resource won't be deployed or modified.
42+
]
3143
32-
- **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.
44+
Resource changes: 1 to modify.
45+
```
3346

34-
- **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.
47+
The following image shows the color-coded results that are returned in PowerShell to help you see the different types of changes.
3548

36-
- **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`.
49+
![Resource Manager template deployment what-if operation fullresourcepayload and change types](./media/template-deploy-what-if/resource-manager-deployment-whatif-change-types.png)
3750

3851
## What-if commands
3952

4053
You can use either Azure PowerShell or Azure REST API for the what-if operation.
4154

4255
### Azure PowerShell
4356

44-
To preview changes, use:
45-
46-
* `Get-AzResourceGroupDeploymentWhatIf` for resource group deployments
47-
* `Get-AzSubscriptionDeploymentWhatIf` or `Get-AzDeploymentWhatIf` for subscription level deployments
48-
49-
Or, you can use the `-Whatif` switch parameter on the deployment command.
57+
To see a preview of the changes before deploying a template, add the `-Whatif` switch parameter to the deployment command.
5058

5159
* `New-AzResourceGroupDeployment -Whatif` for resource group deployments
5260
* `New-AzSubscriptionDeployment -Whatif` and `New-AzDeployment -Whatif` for subscription level deployments
5361

54-
Or, you can preview the changes before being prompted to continue with the deployment.
62+
Or, you can use the `-Confirm` switch parameter to preview the changes and get prompted to continue with the deployment.
5563

5664
* `New-AzResourceGroupDeployment -Confirm` for resource group deployments
5765
* `New-AzSubscriptionDeployment -Confirm` and `New-AzDeployment -Confirm` for subscription level deployments
5866

67+
The preceding commands return a text summary that you can manually inspect. To get an object that you can programmatically inspect for changes, use:
68+
69+
* `$results = Get-AzResourceGroupDeploymentWhatIf` for resource group deployments
70+
* `$results = Get-AzSubscriptionDeploymentWhatIf` or `$results = Get-AzDeploymentWhatIf` for subscription level deployments
71+
5972
> [!NOTE]
6073
> 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.
6174
@@ -66,9 +79,27 @@ For REST API, use:
6679
* [Deployments - What If](/rest/api/resources/deployments/whatif) for resource group deployments
6780
* [Deployments - What If At Subscription Scope](/rest/api/resources/deployments/whatifatsubscriptionscope) for subscription level deployments
6881

82+
## Change types
83+
84+
The what-if operation lists six different types of changes:
85+
86+
- **Create**: The resource doesn't currently exist but is defined in the template. The resource will be created.
87+
88+
- **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.
89+
90+
- **Ignore**: The resource exists, but isn't defined in the template. The resource won't be deployed or modified.
91+
92+
- **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.
93+
94+
- **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.
95+
96+
- **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`.
97+
6998
## Result format
7099

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`.
100+
You can control the level of detail that is returned about the predicted changes. In the deployment commands (`New-Az*Deployment`), use the **-WhatIfResultFormat** parameter. In the programmatic object commands (`Get-Az*DeploymentWhatIf`), use the **ResultFormat** parameter.
101+
102+
Set the format 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`.
72103

73104
The following results show the two different output formats:
74105

@@ -77,17 +108,27 @@ The following results show the two different output formats:
77108
```powershell
78109
Resource and property changes are indicated with these symbols:
79110
- Delete
111+
+ Create
80112
~ Modify
81113
82114
The deployment will update the following scope:
83115
84-
Scope: /subscriptions/./resourceGroups/ExampleGroup
116+
Scope: /subscriptions/3a4176e0-58d3-4bb8-8cc2-9b8776777f27/resourceGroups/ExampleGroup
117+
118+
~ Microsoft.Network/virtualNetworks/vnet-001 [2018-10-01]
119+
- tags.Owner: "Team A"
120+
~ properties.addressSpace.addressPrefixes: [
121+
- 0: "10.0.0.0/16"
122+
+ 0: "10.0.0.0/15"
123+
]
124+
~ properties.subnets: [
125+
- 0:
126+
127+
name: "subnet001"
128+
properties.addressPrefix: "10.0.0.0/24"
129+
130+
]
85131
86-
~ Microsoft.Storage/storageAccounts/storez2wlfuvcm4awc [2019-04-01]
87-
- properties.accessTier: "Hot"
88-
~ properties.supportsHttpsTrafficOnly: true => "true"
89-
~ sku.name: "Standard_LRS" => "Standard_GRS"
90-
91132
Resource changes: 1 to modify.
92133
```
93134

@@ -99,9 +140,9 @@ The following results show the two different output formats:
99140
100141
The deployment will update the following scope:
101142
102-
Scope: /subscriptions/./resourceGroups/ExampleGroup
143+
Scope: /subscriptions/3a4176e0-58d3-4bb8-8cc2-9b8776777f27/resourceGroups/ExampleGroup
103144
104-
! Microsoft.Storage/storageAccounts/storez2wlfuvcm4awc
145+
! Microsoft.Network/virtualNetworks/vnet-001
105146
106147
Resource changes: 1 to deploy.
107148
```

0 commit comments

Comments
 (0)