Birdman
Birdman

Reputation: 1524

PowerShell: How to suppress cmdlet confirmation when the common parameter isn't supported

I'm working on a small script to test ARM templates for Azure in PowerShell. It uses the Test-AzResourceGroupDeployment cmdlet. It tests if an ARM template is valid. I'd like to suppress prompts for this cmdlet. I want my script to return with a positive/negative response if the template is valid. However, after viewing info about the cmdlet through Get-Help, it doesn't look like it supports the Confirm common parameter. So I'm forced to 'continue' 2-3 times during script execution instead of getting an immediate result.

enter image description here

So my question is, do I have any options to get around this for a cmdlet such as this? Or since it doesn't support the Confirm common parameter, am I just out of luck and forced to deal with "Continue with this operation?" prompts?

Upvotes: 0

Views: 376

Answers (1)

Birdman
Birdman

Reputation: 1524

I added the -debug common parameter to the cmdlet which appears to have created the prompts which are occurring. I replaced it with -verbose when doing some testing just so there wasn't so much feedback on the console. It was then I realized the prompts disappeared. So the problem appears to have been the debugging common parameter.

If anyone has more info on this feel free to comment. (i.e. does the debug common parameter always spawn confirm prompts, etc.)

Upvotes: 0

Related Questions