Skip to content

Commit ccdd553

Browse files
Add ValidationLevel parameter to WhatIf/Test (#27352)
Co-authored-by: Yash <[email protected]>
1 parent 93fe2cb commit ccdd553

25 files changed

+1520
-13
lines changed

src/Resources/ResourceManager/Implementation/CmdletBase/DeploymentWhatIfCmdlet.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.Cmdlet
2020

2121
public abstract class DeploymentWhatIfCmdlet: DeploymentCmdletBase, IDynamicParameters
2222
{
23+
[Parameter(Mandatory = false, HelpMessage = "Sets the validation level for validate/what-if. ValidationLevel can be Template(Skips provider validation), Provider(Performs full validation), " +
24+
"or ProviderNoRbac(Performs full validation using RBAC read checks instead of RBAC write checks for provider validation).")]
25+
public string ValidationLevel { get; set; }
26+
2327
/// <summary>
2428
/// It's important not to call this function more than once during an invocation, as it can call the Bicep CLI.
2529
/// This is slow, and can also cause diagnostics to be emitted multiple times.

src/Resources/ResourceManager/Implementation/CmdletBase/TestDeploymentCmdletBase.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ public abstract class TestDeploymentCmdletBase : DeploymentCmdletBase, IDynamicP
1717
[Parameter(Mandatory = false, HelpMessage = "The query string (for example, a SAS token) to be used with the TemplateUri parameter. Would be used in case of linked templates")]
1818
public string QueryString { get; set; }
1919

20+
[Parameter(Mandatory = false, HelpMessage = "Sets the validation level for validate/what-if. ValidationLevel can be Template(Skips provider validation), Provider(Performs full validation), " +
21+
"or ProviderNoRbac(Performs full validation using RBAC read checks instead of RBAC write checks for provider validation).")]
22+
public string ValidationLevel { get; set; }
23+
2024
public override object GetDynamicParameters()
2125
{
2226
if (!string.IsNullOrEmpty(QueryString))

src/Resources/ResourceManager/Implementation/Deployments/GetAzureManagementGroupDeploymentWhatIfResultCmdlet.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ public class GetAzureManagementGroupDeploymentWhatIfResultCmdlet : DeploymentWha
6464
templateParametersUri: this.TemplateParameterUri,
6565
templateParametersObject: GetTemplateParameterObject(),
6666
resultFormat: this.ResultFormat,
67-
excludeChangeTypes: this.ExcludeChangeType);
67+
excludeChangeTypes: this.ExcludeChangeType,
68+
validationLevel: this.ValidationLevel);
6869
}
6970
}
7071

src/Resources/ResourceManager/Implementation/Deployments/GetAzureSubscriptionDeploymentWhatIfResultCmdlet.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public class GetAzureSubscriptionDeploymentWhatIfResultCmdlet : DeploymentWhatIf
6161
templateParametersUri: this.TemplateParameterUri,
6262
templateParametersObject: GetTemplateParameterObject(),
6363
resultFormat: this.ResultFormat,
64-
excludeChangeTypes: this.ExcludeChangeType);
64+
excludeChangeTypes: this.ExcludeChangeType,
65+
validationLevel: this.ValidationLevel);
6566
}
6667
}

src/Resources/ResourceManager/Implementation/Deployments/GetAzureTenantDeploymentWhatIfResultCmdlet.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ public class GetAzureTenantDeploymentWhatIfResultCmdlet : DeploymentWhatIfCmdlet
5959
templateParametersUri: this.TemplateParameterUri,
6060
templateParametersObject: GetTemplateParameterObject(),
6161
resultFormat: this.ResultFormat,
62-
excludeChangeTypes: this.ExcludeChangeType);
62+
excludeChangeTypes: this.ExcludeChangeType,
63+
validationLevel: this.ValidationLevel);
6364
}
6465
}
6566

src/Resources/ResourceManager/Implementation/Deployments/NewAzureManagementGroupDeploymentCmdlet.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ public class NewAzureManagementGroupDeploymentCmdlet : DeploymentCreateCmdlet
105105
templateParametersUri: this.TemplateParameterUri,
106106
templateParametersObject: GetTemplateParameterObject(),
107107
resultFormat: this.WhatIfResultFormat,
108-
excludeChangeTypes: this.WhatIfExcludeChangeType);
108+
excludeChangeTypes: this.WhatIfExcludeChangeType,
109+
validationLevel: this.ValidationLevel);
109110

110111
protected override bool ShouldSkipConfirmationIfNoChange() => this.ProceedIfNoChange;
111112
}

src/Resources/ResourceManager/Implementation/Deployments/NewAzureSubscriptionDeploymentCmdlet.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ public class NewAzureSubscriptionDeploymentCmdlet : DeploymentCreateCmdlet
100100
templateParametersUri: this.TemplateParameterUri,
101101
templateParametersObject: GetTemplateParameterObject(),
102102
resultFormat: this.WhatIfResultFormat,
103-
excludeChangeTypes: this.WhatIfExcludeChangeType);
103+
excludeChangeTypes: this.WhatIfExcludeChangeType,
104+
validationLevel: this.ValidationLevel);
104105

105106
protected override bool ShouldSkipConfirmationIfNoChange() => this.ProceedIfNoChange;
106107
}

src/Resources/ResourceManager/Implementation/Deployments/NewAzureTenantDeploymentCmdlet.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ public class NewAzureTenantDeploymentCmdlet: DeploymentCreateCmdlet
9999
templateParametersUri : this.TemplateParameterUri,
100100
templateParametersObject : GetTemplateParameterObject(),
101101
resultFormat : this.WhatIfResultFormat,
102-
excludeChangeTypes: this.WhatIfExcludeChangeType
102+
excludeChangeTypes: this.WhatIfExcludeChangeType,
103+
validationLevel: this.ValidationLevel
103104
);
104105

105106
protected override bool ShouldSkipConfirmationIfNoChange() => this.ProceedIfNoChange;

src/Resources/ResourceManager/Implementation/Deployments/TestAzureManagementGroupDeploymentCmdlet.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ protected override void OnProcessRecord()
5555
TemplateFile = this.TemplateUri ?? this.TryResolvePath(this.TemplateFile),
5656
TemplateObject = this.TemplateObject,
5757
TemplateParameterObject = this.GetTemplateParameterObject(),
58-
ParameterUri = this.TemplateParameterUri
58+
ParameterUri = this.TemplateParameterUri,
59+
ValidationLevel = this.ValidationLevel
5960
};
6061

6162
var validationInfo = NewResourceManagerSdkClient.ValidateDeployment(parameters);

src/Resources/ResourceManager/Implementation/Deployments/TestAzureSubscriptionDeploymentCmdlet.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ protected override void OnProcessRecord()
5151
TemplateObject = TemplateObject,
5252
QueryString = QueryString,
5353
TemplateParameterObject = GetTemplateParameterObject(),
54-
ParameterUri = TemplateParameterUri
54+
ParameterUri = TemplateParameterUri,
55+
ValidationLevel = ValidationLevel
5556
};
5657

5758
var validationInfo = NewResourceManagerSdkClient.ValidateDeployment(parameters);

0 commit comments

Comments
 (0)