I want to write a wrapper around New-AzResourceGroupDeployment
in PowerShell. So lets assume the following script:
New-AzResourceGroupDeployment `
-Name 'test' `
-ResourceGroupName 'rg-test' `
-TemplateFile .\main.bicep `
-TemplateParameterFile .\parameters\parameters.json `
-Verbose `
-WhatIf
This will output something like this:
VERBOSE: Using Bicep v0.4.1008
...
What if: Performing the operation "Creating Deployment" on target "rg-test".
So the problem here is that I won't get any results from the WhatIf
. I guess its because WhatIf
runs a different process in the background.
So is there a way to capture the output of the WhatIf
?