-
Notifications
You must be signed in to change notification settings - Fork 4k
Open
Labels
ARMService AttentionThis issue is responsible by Azure service team.This issue is responsible by Azure service team.customer-reportedneeds-team-attentionThis issue needs attention from Azure service team or SDK teamThis issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Description
Description
Setting ConfirmImpact.None
has the same behavior as setting ConfirmImpact.Low
when executing the New-AzResourceGroupDeployment and executes the WhatIf behavior
Steps to reproduce
$ConfirmPreference = "None"
New-AzResourceGroupDeployment [...]
The bug is in ShouldProcessGivenCurrentConfirmFlagAndPreference
private bool ShouldProcessGivenCurrentConfirmFlagAndPreference()
{
if (this.MyInvocation.BoundParameters.GetOrNull("Confirm") is SwitchParameter confirmFlag)
{
return confirmFlag.IsPresent;
}
if (this.SessionState == null)
{
return false;
}
var confirmPreference = (ConfirmImpact)this.SessionState.PSVariable.GetValue("ConfirmPreference");
return this.ConfirmImpact >= confirmPreference;
}
specifically
return this.ConfirmImpact >= confirmPreference;
should be
return confirmPreference != ConfirmImpact.None && this.ConfirmImpact >= confirmPreference;
Module versions
5.4.0
workaround
if($ConfirmPreference -eq "None") {
New-AzResourceGroupDeployment [...] -Confirm:$false
} else {
New-AzResourceGroupDeployment [...]
}
Metadata
Metadata
Assignees
Labels
ARMService AttentionThis issue is responsible by Azure service team.This issue is responsible by Azure service team.customer-reportedneeds-team-attentionThis issue needs attention from Azure service team or SDK teamThis issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that