So far you've deployed and then looked at what happened. For an empty practice environment, that's fine. For an environment that holds data, you want to know beforehand: What does this change create, what does it modify, what does it delete? Azure Resource Manager answers that question with what-if.

In this lesson you read the answer, get to know its noise, and see in a case from our own practice what what-if does not prove. At the end, you run the Kladde as a deployment stack, which also takes care of cleaning up.

What-if: the preview

What-if sends the template to ARM like a deployment, but changes nothing. ARM compares the description with what's in Azure and reports the expected change for every resource. For the Kladde at subscription level:

PowerShell
az deployment sub what-if --location germanywestcentral --parameters infra/main.dev.bicepparam

For a template that goes into a resource group, the command is az deployment group what-if, and it takes --resource-group like az deployment group create. After the cleanup at the end of 3.2.3, there's nothing left in rg-kladde-dev, so the answer looks like this, shortened:

Note: The result may contain false positive predictions (noise).
You can help us improve the accuracy of the result by opening an issue here: https://aka.ms/WhatIfIssues

Resource and property changes are indicated with these symbols:
  + Create
  = Nochange

The deployment will update the following scope:

Scope: /subscriptions/…

  = Microsoft.Resources/resourceGroups/rg-kladde-dev

Scope: /subscriptions/…/resourceGroups/rg-kladde-dev

  + Microsoft.App/managedEnvironments/cae-kladde-dev
  + Microsoft.OperationalInsights/workspaces/log-kladde-dev
  + Microsoft.Storage/storageAccounts/stkladdedev…
  + Microsoft.Storage/storageAccounts/stkladdedev…/blobServices/default

Resource changes: 4 to create, 1 no change.

In the full output, every new resource is followed by each property with its value, and every type is followed by the API version in square brackets. At the start, what-if itself explains which symbol stands for which kind of change; it lists only the symbols that occur in this output.

You can also put the preview right in front of the deployment. With --confirm-with-what-if (-c for short), az deployment sub create shows what-if first and then asks whether to go on.