Skip to content

Commit 87d56f0

Browse files
committed
update
1 parent c6fd6f7 commit 87d56f0

File tree

1 file changed

+16
-57
lines changed

1 file changed

+16
-57
lines changed

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

Lines changed: 16 additions & 57 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: 03/04/2020
6+
ms.date: 03/05/2020
77
ms.author: jgao
88
---
99
# Resource Manager template deployment what-if operation (Preview)
@@ -15,7 +15,11 @@ Before deploying a template, you might want to preview the changes that will hap
1515
1616
You can use the what-if operation with the PowerShell commands or REST API operations.
1717

18-
In PowerShell, the output looks like:
18+
In PowerShell, the output includes color-coded results that help you see the different types of changes.
19+
20+
![Resource Manager template deployment what-if operation fullresourcepayload and change types](./media/template-deploy-what-if/resource-manager-deployment-whatif-change-types.png)
21+
22+
The text ouptput is:
1923

2024
```powershell
2125
Resource and property changes are indicated with these symbols:
@@ -25,7 +29,7 @@ Resource and property changes are indicated with these symbols:
2529
2630
The deployment will update the following scope:
2731
28-
Scope: /subscriptions/3a4176e0-58d3-4bb8-8cc2-9b8776777f27/resourceGroups/ExampleGroup
32+
Scope: /subscriptions/./resourceGroups/ExampleGroup
2933
3034
~ Microsoft.Network/virtualNetworks/vnet-001 [2018-10-01]
3135
- tags.Owner: "Team A"
@@ -44,10 +48,6 @@ Scope: /subscriptions/3a4176e0-58d3-4bb8-8cc2-9b8776777f27/resourceGroups/Exampl
4448
Resource changes: 1 to modify.
4549
```
4650

47-
The following image shows the color-coded results that are returned in PowerShell to help you see the different types of changes.
48-
49-
![Resource Manager template deployment what-if operation fullresourcepayload and change types](./media/template-deploy-what-if/resource-manager-deployment-whatif-change-types.png)
50-
5151
## What-if commands
5252

5353
You can use either Azure PowerShell or Azure REST API for the what-if operation.
@@ -113,7 +113,7 @@ The following results show the two different output formats:
113113
114114
The deployment will update the following scope:
115115
116-
Scope: /subscriptions/3a4176e0-58d3-4bb8-8cc2-9b8776777f27/resourceGroups/ExampleGroup
116+
Scope: /subscriptions/./resourceGroups/ExampleGroup
117117
118118
~ Microsoft.Network/virtualNetworks/vnet-001 [2018-10-01]
119119
- tags.Owner: "Team A"
@@ -140,7 +140,7 @@ The following results show the two different output formats:
140140
141141
The deployment will update the following scope:
142142
143-
Scope: /subscriptions/3a4176e0-58d3-4bb8-8cc2-9b8776777f27/resourceGroups/ExampleGroup
143+
Scope: /subscriptions/./resourceGroups/ExampleGroup
144144
145145
! Microsoft.Network/virtualNetworks/vnet-001
146146
@@ -164,7 +164,7 @@ New-AzResourceGroupDeployment `
164164

165165
### Test modification
166166

167-
After the deployment completes, you're ready to test the what-if operation. This time deploy a template for the same virtual network but it has a few changes. It is missing one the original tags, a subnet has been removed, and the address prefix has changed.
167+
After the deployment completes, you're ready to test the what-if operation. This time deploy a [template that changes the virtual network](https://github.com/Azure/azure-docs-json-samples/blob/master/azure-resource-manager/what-if/what-if-after.json). It is missing one the original tags, a subnet has been removed, and the address prefix has changed.
168168

169169
```azurepowershell
170170
New-AzResourceGroupDeployment `
@@ -187,7 +187,7 @@ Resource and property changes are indicated with these symbols:
187187
188188
The deployment will update the following scope:
189189
190-
Scope: /subscriptions/3a4176e0-58d3-4bb8-8cc2-9b8776777f27/resourceGroups/ExampleGroup
190+
Scope: /subscriptions/./resourceGroups/ExampleGroup
191191
192192
~ Microsoft.Network/virtualNetworks/vnet-001 [2018-10-01]
193193
- tags.Owner: "Team A"
@@ -231,11 +231,11 @@ foreach ($change in $results.Changes)
231231
}
232232
```
233233

234-
### Test deletion
234+
## Confirm deletion
235235

236236
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.
237237

238-
For this example, you'll use the confirm parameter to verify that you want to continue with the deployment.
238+
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.
239239

240240
```azurepowershell
241241
New-AzResourceGroupDeployment `
@@ -245,7 +245,7 @@ New-AzResourceGroupDeployment `
245245
-Mode Complete
246246
```
247247

248-
Because no resources are defined in the template and the deployment mode is set to complete, the storage account will be deleted.
248+
Because no resources are defined in the template and the deployment mode is set to complete, the virtual network will be deleted.
249249

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

@@ -257,12 +257,12 @@ Resource and property changes are indicated with this symbol:
257257
258258
The deployment will update the following scope:
259259
260-
Scope: /subscriptions/3a4176e0-58d3-4bb8-8cc2-9b8776777f27/resourceGroups/ExampleGroup
260+
Scope: /subscriptions/./resourceGroups/ExampleGroup
261261
262262
- Microsoft.Network/virtualNetworks/vnet-001
263263
264264
id:
265-
"/subscriptions/3a4176e0-58d3-4bb8-8cc2-9b8776777f27/resourceGroups/ExampleGroup/providers/Microsoft.Network/virtualNet
265+
"/subscriptions/./resourceGroups/ExampleGroup/providers/Microsoft.Network/virtualNet
266266
works/vnet-001"
267267
location: "centralus"
268268
name: "vnet-001"
@@ -276,51 +276,10 @@ Are you sure you want to execute the deployment?
276276
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):
277277
```
278278

279-
## Confirm before deployment
280-
281-
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.
282-
283-
```azurepowershell
284-
New-AzResourceGroupDeployment `
285-
-ResourceGroupName ExampleGroup `
286-
-TemplateUri "https://raw.githubusercontent.com/Azure/azure-docs-json-samples/master/empty-template/azuredeploy.json" `
287-
-Mode Complete `
288-
-Confirm
289-
```
290-
291279
You see the expected changes and can confirm that you want the deployment to run.
292280

293-
```powershell
294-
Resource and property changes are indicated with this symbol:
295-
- Delete
296-
297-
The deployment will update the following scope:
298-
299-
Scope: /subscriptions/./resourceGroups/ExampleGroup
300-
301-
- Microsoft.Storage/storageAccounts/storez2wlfuvcm4awc
302-
303-
id:
304-
"/subscriptions/./resourceGroups/ExampleGroup/providers/Microsoft.Storage/storageAcc
305-
ounts/storez2wlfuvcm4awc"
306-
kind: "StorageV2"
307-
location: "centralus"
308-
name: "storez2wlfuvcm4awc"
309-
sku.name: "Standard_LRS"
310-
sku.tier: "Standard"
311-
type: "Microsoft.Storage/storageAccounts"
312-
313-
Resource changes: 1 to delete.
314-
315-
Are you sure you want to execute the deployment?
316-
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):
317-
```
318-
319-
320-
321281
## Next steps
322282

323283
- 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).
324284
- To deploy templates with Azure PowerShell, see [Deploy resources with Resource Manager templates and Azure PowerShell](deploy-powershell.md).
325285
- To deploy templates with REST, see [Deploy resources with Resource Manager templates and Resource Manager REST API](deploy-rest.md).
326-
- To roll back to a successful deployment when you get an error, see [Rollback on error to successful deployment](rollback-on-error.md).

0 commit comments

Comments
 (0)