What-If for ARM Template deployments is now Generally Available

Published 12-15-2020 09:28 AM 12.4K Views
Microsoft

TL;DR – What-if is now Generally Available. We have closed over 90 customer-reported issues, improved the depth of the policy-aware capabilities, and made it easier for resource providers to fix their own what-if noise issues. While you might still encounter noise, these can now be resolved by the owning resource provider team, so issues should be resolved faster.

 

Why do I need what-if?

 

Deploying an ARM template can be a time-consuming process, which is why it is particularly frustrating if your deployment does not execute as expected. This creates a challenging and long dev/test loop, which can get frustrating very quickly! To help with this problem, we have introduced a new capability for ARM templates called What-if, which allows you to preview the effects of a template deployment before it is executed, allowing you to validate that the changes are expected before starting the deployment process. In this example, I am updating a Linux VM by upgrading the VM size. Before deploying, I can see that it is the only expected change and I can deploy with confidence.

 

adotfrank_0-1608046173065.png

 

 

What-if has been in a public preview for the last few months, and as part of our GA release, we are introducing the following improvements:

 

  • Major noise-reduction and other enhancements to what-if quality. We have closed ~90 publicly reported issues from the what-if noise github repo. In addition, we have set up an internal pipeline to allow each resource provider to resolve their own what-if noise related to ARM API compliance, which is often the root cause of the issue. As a result, we expect to see a rapid, continual improvement of what-if quality going forward.
  • What-if is now “policy aware” for the modify effect. This means if a property will be modified by policy, it will be captured in the what-if response. For example, if a tag is going to be added by a modify policy, this will be reflected in the what-if output for the relevant resources. What-if is already policy-aware for the deny effect, so deployments that will fail due to policy will be caught quickly with what-if. We plan to also support the audit effect as part of our post-GA improvements.

 

How do I get started with what-if?

 

What-if is available as part of the deployment cmdlets in the PowerShell Az module and the deployment commands in Az CLI. If you have a recent release of either of these tools, you likely already have them available. You will need version 4.2 or later of PowerShell Az and version 2.5 or later for Az CLI.

 

The easiest way to run what-if is simply by appending either -Confirm in Az PowerShell or --confirm-with-what-if or -c in Az CLI to the commands you are already using:

 

Az PowerShell:

 

New-AzResourceGroupDeployment -TemplateFile ./azureDeploy.json -ResourceGroupName my-rg -Confirm

 

 

Az CLI:

 

az deployment group create -f ./azureDepoy.json -g my-rg --confirm-with-what-if

 

 

This will emit a user-friendly formatted text output to the console like the screenshot above and ask you if you’d like to proceed with the deployment, but you can also return the results as JSON so you can interrogate the results programmatically. You can also run what-if without the confirm behavior if you’d like to use what-if for a CI/CD approval workflow.

 

For a full walkthrough, you can use the what-if How To guide.

 

Some notes on what-if noise

 

During the public preview, our primary goal was to reduce the amount of noise you would see in the what-if response. These were cases where what-if told you, incorrectly, that a change was going to take place even though no change would occur. You all in the Azure community have done a great job opening issues in the what-if repo and exposing us to the noise you encountered. All told, we have closed ~90 noise issues so far and will continue to burn down the list.

At the same time, we have instituted more quality gates for resource provider teams to ensure their resources are modelled correctly. This quality check will ensure what-if works as expected with no noise in the response.  As a result of this, what-if quality should continue to get improve at a quicker pace.

 

While the quality of what-if has increased dramatically, it is still possible to find what-if noise depending on the resource types you deploy in your templates. If you encounter noise, you should still open an issue in the what-if repo and we can get it routed to the right team to get it fixed quickly.

 

As always, if you have any questions or problems with deployment scripts, don’t hesitate to reach out at alfran@microsoft.com, on twitter or on GitHub.

1 Comment
Occasional Contributor

Nice work!👍🏻 

%3CLINGO-SUB%20id%3D%22lingo-sub-1989268%22%20slang%3D%22en-US%22%3EWhat-If%20for%20ARM%20Template%20deployments%20is%20now%20Generally%20Available%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1989268%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSTRONG%3ETL%3BDR%3C%2FSTRONG%3E%20%E2%80%93%20What-if%20is%20now%20Generally%20Available.%20We%20have%20closed%20over%2090%20customer-reported%20issues%2C%20improved%20the%20depth%20of%20the%20policy-aware%20capabilities%2C%20and%20made%20it%20easier%20for%20resource%20providers%20to%20fix%20their%20own%20what-if%20noise%20issues.%20While%20you%20might%20still%20encounter%20noise%2C%20these%20can%20now%20be%20resolved%20by%20the%20owning%20resource%20provider%20team%2C%20so%20issues%20should%20be%20resolved%20faster.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1179768977%22%20id%3D%22toc-hId--1179768975%22%20id%3D%22toc-hId--1179774773%22%3EWhy%20do%20I%20need%20what-if%3F%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDeploying%20an%20ARM%20template%20can%20be%20a%20time-consuming%20process%2C%20which%20is%20why%20it%20is%20particularly%20frustrating%20if%20your%20deployment%20does%20not%20execute%20as%20expected.%20This%20creates%20a%20challenging%20and%20long%20dev%2Ftest%20loop%2C%20which%20can%20get%20frustrating%20very%20quickly!%20To%20help%20with%20this%20problem%2C%20we%20have%20introduced%20a%20new%20capability%20for%20ARM%20templates%20called%20%3CSTRONG%3EWhat-if%3C%2FSTRONG%3E%2C%20which%20allows%20you%20to%20preview%20the%20effects%20of%20a%20template%20deployment%20before%20it%20is%20executed%2C%20allowing%20you%20to%20validate%20that%20the%20changes%20are%20expected%20before%20starting%20the%20deployment%20process.%20In%20this%20example%2C%20I%20am%20updating%20a%20Linux%20VM%20by%20upgrading%20the%20VM%20size.%20Before%20deploying%2C%20I%20can%20see%20that%20it%20is%20the%20only%20expected%20change%20and%20I%20can%20deploy%20with%20confidence.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22adotfrank_0-1608046173065.png%22%20style%3D%22width%3A%20706px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F240698i4D3D5B9888C456D2%2Fimage-dimensions%2F706x90%3Fv%3D1.0%22%20width%3D%22706%22%20height%3D%2290%22%20role%3D%22button%22%20title%3D%22adotfrank_0-1608046173065.png%22%20alt%3D%22adotfrank_0-1608046173065.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhat-if%20has%20been%20in%20a%20public%20preview%20for%20the%20last%20few%20months%2C%20and%20as%20part%20of%20our%20GA%20release%2C%20we%20are%20introducing%20the%20following%20improvements%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EMajor%20noise-reduction%20and%20other%20enhancements%20to%20what-if%20quality.%3C%2FSTRONG%3E%20We%20have%20closed%20~90%20publicly%20reported%20issues%20from%20the%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fazure%2Farm-template-whatif%2Fissues%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ewhat-if%20noise%20github%20repo%3C%2FA%3E.%20In%20addition%2C%20we%20have%20set%20up%20an%20internal%20pipeline%20to%20allow%20each%20resource%20provider%20to%20resolve%20their%20own%20what-if%20noise%20related%20to%20ARM%20API%20compliance%2C%20which%20is%20often%20the%20root%20cause%20of%20the%20issue.%20As%20a%20result%2C%20we%20expect%20to%20see%20a%20rapid%2C%20continual%20improvement%20of%20what-if%20quality%20going%20forward.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EWhat-if%20is%20now%20%E2%80%9Cpolicy%20aware%E2%80%9D%20for%20the%20modify%20effect.%3C%2FSTRONG%3E%20This%20means%20if%20a%20property%20will%20be%20modified%20by%20policy%2C%20it%20will%20be%20captured%20in%20the%20what-if%20response.%20For%20example%2C%20if%20a%20tag%20is%20going%20to%20be%20added%20by%20a%20modify%20policy%2C%20this%20will%20be%20reflected%20in%20the%20what-if%20output%20for%20the%20relevant%20resources.%20What-if%20is%20already%20policy-aware%20for%20the%20deny%20effect%2C%20so%20deployments%20that%20will%20fail%20due%20to%20policy%20will%20be%20caught%20quickly%20with%20what-if.%20We%20plan%20to%20also%20support%20the%20audit%20effect%20as%20part%20of%20our%20post-GA%20improvements.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1307743856%22%20id%3D%22toc-hId-1307743858%22%20id%3D%22toc-hId-1307738060%22%3EHow%20do%20I%20get%20started%20with%20what-if%3F%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhat-if%20is%20available%20as%20part%20of%20the%20deployment%20cmdlets%20in%20the%20PowerShell%20Az%20module%20and%20the%20deployment%20commands%20in%20Az%20CLI.%20If%20you%20have%20a%20recent%20release%20of%20either%20of%20these%20tools%2C%20you%20likely%20already%20have%20them%20available.%20You%20will%20need%20version%204.2%20or%20later%20of%20PowerShell%20Az%20and%20version%202.5%20or%20later%20for%20Az%20CLI.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20easiest%20way%20to%20run%20what-if%20is%20simply%20by%20appending%20either%20-Confirm%20in%20Az%20PowerShell%20or%20--confirm-with-what-if%20or%20-c%20in%20Az%20CLI%20to%20the%20commands%20you%20are%20already%20using%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EAz%20PowerShell%3A%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3ENew-AzResourceGroupDeployment%20-TemplateFile%20.%2FazureDeploy.json%20-ResourceGroupName%20my-rg%20-Confirm%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EAz%20CLI%3A%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Eaz%20deployment%20group%20create%20-f%20.%2FazureDepoy.json%20-g%20my-rg%20--confirm-with-what-if%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20will%20emit%20a%20user-friendly%20formatted%20text%20output%20to%20the%20console%20like%20the%20screenshot%20above%20and%20ask%20you%20if%20you%E2%80%99d%20like%20to%20proceed%20with%20the%20deployment%2C%20but%20you%20can%20also%20return%20the%20results%20as%20JSON%20so%20you%20can%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fazure-resource-manager%2Ftemplates%2Ftemplate-deploy-what-if%3Ftabs%3Dazure-cli%23programmatically-evaluate-what-if-results%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Einterrogate%20the%20results%20programmatically%3C%2FA%3E.%20You%20can%20also%20run%20what-if%20without%20the%20confirm%20behavior%20if%20you%E2%80%99d%20like%20to%20use%20what-if%20for%20a%20CI%2FCD%20approval%20workflow.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFor%20a%20full%20walkthrough%2C%20you%20can%20use%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fazure-resource-manager%2Ftemplates%2Ftemplate-deploy-what-if%3Ftabs%3Dazure-cli%23run-what-if-operation%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ewhat-if%20How%20To%20guide%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--499710607%22%20id%3D%22toc-hId--499710605%22%20id%3D%22toc-hId--499716403%22%3ESome%20notes%20on%20what-if%20noise%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDuring%20the%20public%20preview%2C%20our%20primary%20goal%20was%20to%20reduce%20the%20amount%20of%20noise%20you%20would%20see%20in%20the%20what-if%20response.%20These%20were%20cases%20where%20what-if%20told%20you%2C%20incorrectly%2C%20that%20a%20change%20was%20going%20to%20take%20place%20even%20though%20no%20change%20would%20occur.%20You%20all%20in%20the%20Azure%20community%20have%20done%20a%20great%20job%20opening%20issues%20in%20the%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fazure%2Farm-template-whatif%2Fissues%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ewhat-if%20repo%3C%2FA%3E%20and%20exposing%20us%20to%20the%20noise%20you%20encountered.%20All%20told%2C%20we%20have%20closed%20~90%20noise%20issues%20so%20far%20and%20will%20continue%20to%20burn%20down%20the%20list.%3C%2FP%3E%0A%3CP%3EAt%20the%20same%20time%2C%20we%20have%20instituted%20more%20quality%20gates%20for%20resource%20provider%20teams%20to%20ensure%20their%20resources%20are%20modelled%20correctly.%20This%20quality%20check%20will%20ensure%20what-if%20works%20as%20expected%20with%20no%20noise%20in%20the%20response.%26nbsp%3B%20As%20a%20result%20of%20this%2C%20what-if%20quality%20should%20continue%20to%20get%20improve%20at%20a%20quicker%20pace.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhile%20the%20quality%20of%20what-if%20has%20increased%20dramatically%2C%20it%20is%20still%20possible%20to%20find%20what-if%20noise%20depending%20on%20the%20resource%20types%20you%20deploy%20in%20your%20templates.%20If%20you%20encounter%20noise%2C%20you%20should%20still%20open%20an%20issue%20in%20the%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Faka.ms%2Fwhatifissues%22%20target%3D%22_blank%22%3Ewhat-if%20repo%3C%2FA%3E%20and%20we%20can%20get%20it%20routed%20to%20the%20right%20team%20to%20get%20it%20fixed%20quickly.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20always%2C%20if%20you%20have%20any%20questions%20or%20problems%20with%20deployment%20scripts%2C%20don%E2%80%99t%20hesitate%20to%20reach%20out%20at%20%3CA%20href%3D%22mailto%3Aalfran%40microsoft.com%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ealfran%40microsoft.com%3C%2FA%3E%2C%20on%20%3CA%20href%3D%22http%3A%2F%2Ftwitter.com%2Fadotfrank%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Etwitter%3C%2FA%3E%20or%20on%20%3CA%20href%3D%22http%3A%2F%2Fgithub.com%2Falex-frankel%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EGitHub%3C%2FA%3E.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1989268%22%20slang%3D%22en-US%22%3E%3CP%3EWhat-if%20for%20ARM%20Templates%20is%20now%20Generally%20Available.%20We%20have%20closed%20over%2090%20customer-reported%20issues%2C%20improved%20the%20depth%20of%20the%20policy-aware%20capabilities%2C%20and%20made%20it%20easier%20for%20resource%20providers%20to%20fix%20their%20own%20what-if%20noise%20issues.%20While%20you%20might%20still%20encounter%20noise%2C%20these%20can%20now%20be%20resolved%20by%20the%20owning%20resource%20provider%20team%2C%20so%20issues%20should%20be%20resolved%20faster.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1990184%22%20slang%3D%22en-US%22%3ERe%3A%20What-If%20for%20ARM%20Template%20deployments%20is%20now%20Generally%20Available%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1990184%22%20slang%3D%22en-US%22%3E%3CP%3ENice%20work!%3CSPAN%20class%3D%22lia-unicode-emoji%22%20title%3D%22%3Athumbs_up%3A%22%3E%3Cspan%20class%3D%22lia-unicode-emoji%22%20title%3D%22%3Athumbs_up%3A%22%3E%F0%9F%91%8D%F0%9F%8F%BB%3C%2Fspan%3E%3C%2FSPAN%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Version history
Last update:
‎Dec 15 2020 09:28 AM
Updated by: