diff --git a/src/Resources/ResourceManager/Implementation/CmdletBase/DeploymentWhatIfCmdlet.cs b/src/Resources/ResourceManager/Implementation/CmdletBase/DeploymentWhatIfCmdlet.cs index 04636d260114..fc7c2f57896b 100644 --- a/src/Resources/ResourceManager/Implementation/CmdletBase/DeploymentWhatIfCmdlet.cs +++ b/src/Resources/ResourceManager/Implementation/CmdletBase/DeploymentWhatIfCmdlet.cs @@ -20,6 +20,10 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.Cmdlet public abstract class DeploymentWhatIfCmdlet: DeploymentCmdletBase, IDynamicParameters { + [Parameter(Mandatory = false, HelpMessage = "Sets the validation level for validate/what-if. ValidationLevel can be Template(Skips provider validation), Provider(Performs full validation), " + + "or ProviderNoRbac(Performs full validation using RBAC read checks instead of RBAC write checks for provider validation).")] + public string ValidationLevel { get; set; } + /// /// It's important not to call this function more than once during an invocation, as it can call the Bicep CLI. /// This is slow, and can also cause diagnostics to be emitted multiple times. diff --git a/src/Resources/ResourceManager/Implementation/CmdletBase/TestDeploymentCmdletBase.cs b/src/Resources/ResourceManager/Implementation/CmdletBase/TestDeploymentCmdletBase.cs index fac018b549b0..fe8a8ddb8beb 100644 --- a/src/Resources/ResourceManager/Implementation/CmdletBase/TestDeploymentCmdletBase.cs +++ b/src/Resources/ResourceManager/Implementation/CmdletBase/TestDeploymentCmdletBase.cs @@ -17,6 +17,10 @@ public abstract class TestDeploymentCmdletBase : DeploymentCmdletBase, IDynamicP [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")] public string QueryString { get; set; } + [Parameter(Mandatory = false, HelpMessage = "Sets the validation level for validate/what-if. ValidationLevel can be Template(Skips provider validation), Provider(Performs full validation), " + + "or ProviderNoRbac(Performs full validation using RBAC read checks instead of RBAC write checks for provider validation).")] + public string ValidationLevel { get; set; } + public override object GetDynamicParameters() { if (!string.IsNullOrEmpty(QueryString)) diff --git a/src/Resources/ResourceManager/Implementation/Deployments/GetAzureManagementGroupDeploymentWhatIfResultCmdlet.cs b/src/Resources/ResourceManager/Implementation/Deployments/GetAzureManagementGroupDeploymentWhatIfResultCmdlet.cs index dc9be3cc5248..6d25e1ba91cd 100644 --- a/src/Resources/ResourceManager/Implementation/Deployments/GetAzureManagementGroupDeploymentWhatIfResultCmdlet.cs +++ b/src/Resources/ResourceManager/Implementation/Deployments/GetAzureManagementGroupDeploymentWhatIfResultCmdlet.cs @@ -64,7 +64,8 @@ public class GetAzureManagementGroupDeploymentWhatIfResultCmdlet : DeploymentWha templateParametersUri: this.TemplateParameterUri, templateParametersObject: GetTemplateParameterObject(), resultFormat: this.ResultFormat, - excludeChangeTypes: this.ExcludeChangeType); + excludeChangeTypes: this.ExcludeChangeType, + validationLevel: this.ValidationLevel); } } diff --git a/src/Resources/ResourceManager/Implementation/Deployments/GetAzureSubscriptionDeploymentWhatIfResultCmdlet.cs b/src/Resources/ResourceManager/Implementation/Deployments/GetAzureSubscriptionDeploymentWhatIfResultCmdlet.cs index bf22876aae75..d0c44c27a74c 100644 --- a/src/Resources/ResourceManager/Implementation/Deployments/GetAzureSubscriptionDeploymentWhatIfResultCmdlet.cs +++ b/src/Resources/ResourceManager/Implementation/Deployments/GetAzureSubscriptionDeploymentWhatIfResultCmdlet.cs @@ -61,6 +61,7 @@ public class GetAzureSubscriptionDeploymentWhatIfResultCmdlet : DeploymentWhatIf templateParametersUri: this.TemplateParameterUri, templateParametersObject: GetTemplateParameterObject(), resultFormat: this.ResultFormat, - excludeChangeTypes: this.ExcludeChangeType); + excludeChangeTypes: this.ExcludeChangeType, + validationLevel: this.ValidationLevel); } } diff --git a/src/Resources/ResourceManager/Implementation/Deployments/GetAzureTenantDeploymentWhatIfResultCmdlet.cs b/src/Resources/ResourceManager/Implementation/Deployments/GetAzureTenantDeploymentWhatIfResultCmdlet.cs index 131587c2087a..1bd896ef0232 100644 --- a/src/Resources/ResourceManager/Implementation/Deployments/GetAzureTenantDeploymentWhatIfResultCmdlet.cs +++ b/src/Resources/ResourceManager/Implementation/Deployments/GetAzureTenantDeploymentWhatIfResultCmdlet.cs @@ -59,7 +59,8 @@ public class GetAzureTenantDeploymentWhatIfResultCmdlet : DeploymentWhatIfCmdlet templateParametersUri: this.TemplateParameterUri, templateParametersObject: GetTemplateParameterObject(), resultFormat: this.ResultFormat, - excludeChangeTypes: this.ExcludeChangeType); + excludeChangeTypes: this.ExcludeChangeType, + validationLevel: this.ValidationLevel); } } diff --git a/src/Resources/ResourceManager/Implementation/Deployments/NewAzureManagementGroupDeploymentCmdlet.cs b/src/Resources/ResourceManager/Implementation/Deployments/NewAzureManagementGroupDeploymentCmdlet.cs index 2f867ea61ffb..166855b2fca5 100644 --- a/src/Resources/ResourceManager/Implementation/Deployments/NewAzureManagementGroupDeploymentCmdlet.cs +++ b/src/Resources/ResourceManager/Implementation/Deployments/NewAzureManagementGroupDeploymentCmdlet.cs @@ -105,7 +105,8 @@ public class NewAzureManagementGroupDeploymentCmdlet : DeploymentCreateCmdlet templateParametersUri: this.TemplateParameterUri, templateParametersObject: GetTemplateParameterObject(), resultFormat: this.WhatIfResultFormat, - excludeChangeTypes: this.WhatIfExcludeChangeType); + excludeChangeTypes: this.WhatIfExcludeChangeType, + validationLevel: this.ValidationLevel); protected override bool ShouldSkipConfirmationIfNoChange() => this.ProceedIfNoChange; } diff --git a/src/Resources/ResourceManager/Implementation/Deployments/NewAzureSubscriptionDeploymentCmdlet.cs b/src/Resources/ResourceManager/Implementation/Deployments/NewAzureSubscriptionDeploymentCmdlet.cs index c1dfe2278b26..08e9e238a306 100644 --- a/src/Resources/ResourceManager/Implementation/Deployments/NewAzureSubscriptionDeploymentCmdlet.cs +++ b/src/Resources/ResourceManager/Implementation/Deployments/NewAzureSubscriptionDeploymentCmdlet.cs @@ -100,7 +100,8 @@ public class NewAzureSubscriptionDeploymentCmdlet : DeploymentCreateCmdlet templateParametersUri: this.TemplateParameterUri, templateParametersObject: GetTemplateParameterObject(), resultFormat: this.WhatIfResultFormat, - excludeChangeTypes: this.WhatIfExcludeChangeType); + excludeChangeTypes: this.WhatIfExcludeChangeType, + validationLevel: this.ValidationLevel); protected override bool ShouldSkipConfirmationIfNoChange() => this.ProceedIfNoChange; } diff --git a/src/Resources/ResourceManager/Implementation/Deployments/NewAzureTenantDeploymentCmdlet.cs b/src/Resources/ResourceManager/Implementation/Deployments/NewAzureTenantDeploymentCmdlet.cs index 2ee21fe61a56..15b826fdb41a 100644 --- a/src/Resources/ResourceManager/Implementation/Deployments/NewAzureTenantDeploymentCmdlet.cs +++ b/src/Resources/ResourceManager/Implementation/Deployments/NewAzureTenantDeploymentCmdlet.cs @@ -99,7 +99,8 @@ public class NewAzureTenantDeploymentCmdlet: DeploymentCreateCmdlet templateParametersUri : this.TemplateParameterUri, templateParametersObject : GetTemplateParameterObject(), resultFormat : this.WhatIfResultFormat, - excludeChangeTypes: this.WhatIfExcludeChangeType + excludeChangeTypes: this.WhatIfExcludeChangeType, + validationLevel: this.ValidationLevel ); protected override bool ShouldSkipConfirmationIfNoChange() => this.ProceedIfNoChange; diff --git a/src/Resources/ResourceManager/Implementation/Deployments/TestAzureManagementGroupDeploymentCmdlet.cs b/src/Resources/ResourceManager/Implementation/Deployments/TestAzureManagementGroupDeploymentCmdlet.cs index 1b6780c2b167..e7299f7eb729 100644 --- a/src/Resources/ResourceManager/Implementation/Deployments/TestAzureManagementGroupDeploymentCmdlet.cs +++ b/src/Resources/ResourceManager/Implementation/Deployments/TestAzureManagementGroupDeploymentCmdlet.cs @@ -55,7 +55,8 @@ protected override void OnProcessRecord() TemplateFile = this.TemplateUri ?? this.TryResolvePath(this.TemplateFile), TemplateObject = this.TemplateObject, TemplateParameterObject = this.GetTemplateParameterObject(), - ParameterUri = this.TemplateParameterUri + ParameterUri = this.TemplateParameterUri, + ValidationLevel = this.ValidationLevel }; var validationInfo = NewResourceManagerSdkClient.ValidateDeployment(parameters); diff --git a/src/Resources/ResourceManager/Implementation/Deployments/TestAzureSubscriptionDeploymentCmdlet.cs b/src/Resources/ResourceManager/Implementation/Deployments/TestAzureSubscriptionDeploymentCmdlet.cs index a54427ed20ac..4dc621d30a86 100644 --- a/src/Resources/ResourceManager/Implementation/Deployments/TestAzureSubscriptionDeploymentCmdlet.cs +++ b/src/Resources/ResourceManager/Implementation/Deployments/TestAzureSubscriptionDeploymentCmdlet.cs @@ -51,7 +51,8 @@ protected override void OnProcessRecord() TemplateObject = TemplateObject, QueryString = QueryString, TemplateParameterObject = GetTemplateParameterObject(), - ParameterUri = TemplateParameterUri + ParameterUri = TemplateParameterUri, + ValidationLevel = ValidationLevel }; var validationInfo = NewResourceManagerSdkClient.ValidateDeployment(parameters); diff --git a/src/Resources/ResourceManager/Implementation/Deployments/TestAzureTenantDeploymentCmdlet.cs b/src/Resources/ResourceManager/Implementation/Deployments/TestAzureTenantDeploymentCmdlet.cs index 596f1a0014a1..59e505d78e52 100644 --- a/src/Resources/ResourceManager/Implementation/Deployments/TestAzureTenantDeploymentCmdlet.cs +++ b/src/Resources/ResourceManager/Implementation/Deployments/TestAzureTenantDeploymentCmdlet.cs @@ -51,7 +51,8 @@ protected override void OnProcessRecord() TemplateObject = this.TemplateObject, QueryString = QueryString, TemplateParameterObject = this.GetTemplateParameterObject(), - ParameterUri = this.TemplateParameterUri + ParameterUri = this.TemplateParameterUri, + ValidationLevel = this.ValidationLevel }; var validationInfo = NewResourceManagerSdkClient.ValidateDeployment(parameters); diff --git a/src/Resources/ResourceManager/Implementation/ResourceGroupDeployments/GetAzureResourceGroupDeploymentWhatIfResultCmdlet.cs b/src/Resources/ResourceManager/Implementation/ResourceGroupDeployments/GetAzureResourceGroupDeploymentWhatIfResultCmdlet.cs index f0e9ed5cb1c5..2e8e2eeccc45 100644 --- a/src/Resources/ResourceManager/Implementation/ResourceGroupDeployments/GetAzureResourceGroupDeploymentWhatIfResultCmdlet.cs +++ b/src/Resources/ResourceManager/Implementation/ResourceGroupDeployments/GetAzureResourceGroupDeploymentWhatIfResultCmdlet.cs @@ -61,6 +61,7 @@ public class GetAzureResourceGroupDeploymentWhatIfResultCmdlet : DeploymentWhatI templateParametersUri: this.TemplateParameterUri, templateParametersObject: GetTemplateParameterObject(), resultFormat: this.ResultFormat, - excludeChangeTypes: this.ExcludeChangeType); + excludeChangeTypes: this.ExcludeChangeType, + validationLevel: this.ValidationLevel); } } diff --git a/src/Resources/ResourceManager/Implementation/ResourceGroupDeployments/NewAzureResourceGroupDeploymentCmdlet.cs b/src/Resources/ResourceManager/Implementation/ResourceGroupDeployments/NewAzureResourceGroupDeploymentCmdlet.cs index 55ff4f9b4377..696e5bff471d 100644 --- a/src/Resources/ResourceManager/Implementation/ResourceGroupDeployments/NewAzureResourceGroupDeploymentCmdlet.cs +++ b/src/Resources/ResourceManager/Implementation/ResourceGroupDeployments/NewAzureResourceGroupDeploymentCmdlet.cs @@ -121,7 +121,8 @@ public class NewAzureResourceGroupDeploymentCmdlet : DeploymentCreateCmdlet templateParametersUri: this.TemplateParameterUri, templateParametersObject: this.GetTemplateParameterObject(), resultFormat: this.WhatIfResultFormat, - excludeChangeTypes: this.WhatIfExcludeChangeType); + excludeChangeTypes: this.WhatIfExcludeChangeType, + validationLevel: this.ValidationLevel); protected override void OnProcessRecord() { diff --git a/src/Resources/ResourceManager/Implementation/ResourceGroupDeployments/TestAzureResourceGroupDeploymentCmdlet.cs b/src/Resources/ResourceManager/Implementation/ResourceGroupDeployments/TestAzureResourceGroupDeploymentCmdlet.cs index b539a020ea5b..cc9dd79cdbca 100644 --- a/src/Resources/ResourceManager/Implementation/ResourceGroupDeployments/TestAzureResourceGroupDeploymentCmdlet.cs +++ b/src/Resources/ResourceManager/Implementation/ResourceGroupDeployments/TestAzureResourceGroupDeploymentCmdlet.cs @@ -76,7 +76,8 @@ protected override void OnProcessRecord() Type = RollbackToLastDeployment ? OnErrorDeploymentType.LastSuccessful : OnErrorDeploymentType.SpecificDeployment, DeploymentName = RollbackToLastDeployment ? null : RollBackDeploymentName } - : null + : null, + ValidationLevel = ValidationLevel }; var validationInfo = NewResourceManagerSdkClient.ValidateDeployment(parameters); diff --git a/src/Resources/ResourceManager/SdkClient/NewResourceManagerSdkClient.cs b/src/Resources/ResourceManager/SdkClient/NewResourceManagerSdkClient.cs index 55d5ddbea0e9..b5c04c7cc18b 100644 --- a/src/Resources/ResourceManager/SdkClient/NewResourceManagerSdkClient.cs +++ b/src/Resources/ResourceManager/SdkClient/NewResourceManagerSdkClient.cs @@ -481,6 +481,11 @@ private Deployment CreateBasicDeployment(PSDeploymentCmdletParameters parameters deployment.Tags = parameters?.Tags == null ? null : new Dictionary(parameters.Tags); deployment.Properties.OnErrorDeployment = parameters.OnErrorDeployment; + if (!string.IsNullOrEmpty(parameters.ValidationLevel)) + { + deployment.Properties.ValidationLevel = parameters.ValidationLevel; + } + return deployment; } diff --git a/src/Resources/ResourceManager/SdkModels/Deployments/PSDeploymentCmdletParameters.cs b/src/Resources/ResourceManager/SdkModels/Deployments/PSDeploymentCmdletParameters.cs index 7a1ecbce0cae..89a31e473cb9 100644 --- a/src/Resources/ResourceManager/SdkModels/Deployments/PSDeploymentCmdletParameters.cs +++ b/src/Resources/ResourceManager/SdkModels/Deployments/PSDeploymentCmdletParameters.cs @@ -43,5 +43,7 @@ public class PSDeploymentCmdletParameters public OnErrorDeployment OnErrorDeployment { get; set; } public IDictionary> AuxTenantHeaders { get; set; } + + public string ValidationLevel { get; set; } } } diff --git a/src/Resources/ResourceManager/SdkModels/Deployments/PSDeploymentWhatIfCmdletParameters.cs b/src/Resources/ResourceManager/SdkModels/Deployments/PSDeploymentWhatIfCmdletParameters.cs index 4fa8a4e81429..3fe151f99c20 100644 --- a/src/Resources/ResourceManager/SdkModels/Deployments/PSDeploymentWhatIfCmdletParameters.cs +++ b/src/Resources/ResourceManager/SdkModels/Deployments/PSDeploymentWhatIfCmdletParameters.cs @@ -34,7 +34,8 @@ public PSDeploymentWhatIfCmdletParameters( Hashtable templateObject = null, Hashtable templateParametersObject = null, WhatIfResultFormat resultFormat = WhatIfResultFormat.FullResourcePayloads, - string[] excludeChangeTypes = null) + string[] excludeChangeTypes = null, + string validationLevel = null) { this.DeploymentName = deploymentName ?? this.GenerateDeployName(); this.ScopeType = scopeType; @@ -53,6 +54,7 @@ public PSDeploymentWhatIfCmdletParameters( .Select(changeType => changeType.ToLowerInvariant()) .Distinct() .Select(changeType => (ChangeType)Enum.Parse(typeof(ChangeType), changeType, true)); + this.ValidationLevel = validationLevel; } public string DeploymentName @@ -87,6 +89,8 @@ public string DeploymentName public IEnumerable ExcludeChangeTypes { get; } + public string ValidationLevel { get; set; } + public DeploymentWhatIf ToDeploymentWhatIf() { var properties = new DeploymentWhatIfProperties @@ -134,6 +138,11 @@ public DeploymentWhatIf ToDeploymentWhatIf() : null; } + if (!string.IsNullOrEmpty(this.ValidationLevel)) + { + properties.ValidationLevel = this.ValidationLevel; + } + return new DeploymentWhatIf(properties, this.Location); } diff --git a/src/Resources/Resources.Test/ResourceGroupDeployments/TestAzureResourceGroupDeploymentCommandTests.cs b/src/Resources/Resources.Test/ResourceGroupDeployments/TestAzureResourceGroupDeploymentCommandTests.cs index f20e7d17856e..8a13d988fddb 100644 --- a/src/Resources/Resources.Test/ResourceGroupDeployments/TestAzureResourceGroupDeploymentCommandTests.cs +++ b/src/Resources/Resources.Test/ResourceGroupDeployments/TestAzureResourceGroupDeploymentCommandTests.cs @@ -31,6 +31,7 @@ using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Formatters; using Newtonsoft.Json.Linq; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions; +using FluentAssertions; namespace Microsoft.Azure.Commands.Resources.Test.Resources { @@ -147,5 +148,36 @@ public void ValidatesPSResourceGroupDeploymentWithUserTemplateWithDiagnostics() commandRuntimeMock.Verify(f => f.WriteObject(expectedObject, true), Times.Once()); commandRuntimeMock.Verify(f => f.WriteObject(It.IsAny>()), Times.Never()); } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void ValidatesPSResourceGroupDeploymentWithUserTemplateProviderNoRbac() + { + PSDeploymentCmdletParameters expectedParameters = new PSDeploymentCmdletParameters() + { + TemplateFile = templateFile, + ValidationLevel = ValidationLevel.ProviderNoRbac + }; + PSDeploymentCmdletParameters actualParameters = new PSDeploymentCmdletParameters(); + + TemplateValidationInfo expectedResults = new(new DeploymentValidateResult()); + + resourcesClientMock.Setup(f => f.ValidateDeployment( + It.IsAny())) + .Returns(expectedResults) + .Callback((PSDeploymentCmdletParameters p) => { actualParameters = p; }); + + cmdlet.ResourceGroupName = resourceGroupName; + cmdlet.TemplateFile = expectedParameters.TemplateFile; + cmdlet.ValidationLevel = ValidationLevel.ProviderNoRbac; + + cmdlet.ExecuteCmdlet(); + + actualParameters.TemplateFile.Should().Equals(expectedParameters.TemplateFile); + + actualParameters.ValidationLevel.Should().Be(ValidationLevel.ProviderNoRbac); + + Assert.NotNull(actualParameters.TemplateParameterObject); + } } } diff --git a/src/Resources/Resources.Test/ScenarioTests/DeploymentWhatIfTests.cs b/src/Resources/Resources.Test/ScenarioTests/DeploymentWhatIfTests.cs index 52da91e8e794..6066c0dabfe7 100644 --- a/src/Resources/Resources.Test/ScenarioTests/DeploymentWhatIfTests.cs +++ b/src/Resources/Resources.Test/ScenarioTests/DeploymentWhatIfTests.cs @@ -152,6 +152,34 @@ public void TenantLevelWhatIf_SetExcludeChangeType_HidesResourceChanges() { TestRunner.RunTestScript("Test-WhatIfExcludeChangeTypesAtTenantScope"); } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TenantLevelWhatIf_ProviderNoRbacAtTenantScope() + { + TestRunner.RunTestScript("Test-WhatIfProviderNoRbacAtTenantScope"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void MGLevelWhatIf_ProviderNoRbacAtManagementGroupScope() + { + TestRunner.RunTestScript("Test-WhatIfProviderNoRbacAtManagementGroupScope"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void SubLevelWhatIf_ProviderNoRbacAtSubscriptionScope() + { + TestRunner.RunTestScript("Test-WhatIfProviderNoRbacAtSubscriptionScope"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void RGLevelWhatIf_ProviderNoRbacAtResourceGroupScope() + { + TestRunner.RunTestScript("Test-WhatIfProviderNoRbacAtResourceGroupScope"); + } } } diff --git a/src/Resources/Resources.Test/ScenarioTests/DeploymentWhatIfTests.ps1 b/src/Resources/Resources.Test/ScenarioTests/DeploymentWhatIfTests.ps1 index 89d052b4201b..312cf6295dc8 100644 --- a/src/Resources/Resources.Test/ScenarioTests/DeploymentWhatIfTests.ps1 +++ b/src/Resources/Resources.Test/ScenarioTests/DeploymentWhatIfTests.ps1 @@ -284,6 +284,46 @@ function Test-WhatIfExcludeChangeTypesAtResourceGroupScope } } +<# +.SYNOPSIS +Tests resource group level deployment what-if with resource creation. +#> +function Test-WhatIfProviderNoRbacAtResourceGroupScope +{ + try + { + # Arrange. + $deploymentName = Get-ResourceName + $location = "westus" + $resourceGroupName = Get-ResourceGroupName + $storageAccountName = Get-ResourceName + $validationLevel = "ProviderNoRbac" + + New-AzResourceGroup -Name $resourceGroupName -Location $location + + # Act. + $result = Get-AzResourceGroupDeploymentWhatIfResult ` + -ResourceGroupName $resourceGroupName ` + -Name $deploymentName ` + -ResultFormat ResourceIdOnly ` + -TemplateFile sampleDeploymentTemplate.json ` + -storageAccountName $storageAccountName ` + -ValidationLevel $validationLevel + + # Assert. + foreach ($change in $result.Changes) + { + Assert-AreEqual "Create" $change.ChangeType + } + + } + finally + { + # Cleanup. + Clean-ResourceGroup $resourceGroupName + } +} + <# @@ -503,6 +543,34 @@ function Test-WhatIfExcludeChangeTypesAtSubscriptionScope Assert-True { $result.Changes.Count -eq 0 } } +<# +.SYNOPSIS +Tests subscription level deployment what-if with resource creation. +#> +function Test-WhatIfProviderNoRbacAtSubscriptionScope +{ + # Arrange. + $deploymentName = Get-ResourceName + $storageAccountName = Get-ResourceName + $location = "westus" + $validationLevel = "ProviderNoRbac" + + # Act. + $result = Get-AzDeploymentWhatIfResult ` + -Name $deploymentName ` + -Location $location ` + -ResultFormat ResourceIdOnly ` + -TemplateFile subscription_level_template.json ` + -storageAccountName $storageAccountName ` + -ValidationLevel $validationLevel + + # Assert. + foreach ($change in $result.Changes) + { + Assert-AreEqual "Create" $change.ChangeType + } +} + <# .SYNOPSIS Tests management group level deployment what-if with resource creation. @@ -613,6 +681,44 @@ function Test-WhatIfExcludeChangeTypesAtManagementGroupScope Assert-True { $result.Changes.Count -eq 0 } } +<# +.SYNOPSIS +Tests management group level deployment what-if with resource creation. +#> +function Test-WhatIfProviderNoRbacAtManagementGroupScope +{ + # Arrange. + $deploymentName = Get-ResourceName + $managementGroupId = "myTestMG" + $subscriptionId = "a93e8c5c-63cb-4635-933f-6d166ac25187" + $resourceGroupName = Get-ResourceGroupName + $storageAccountName = Get-ResourceName + $location = "westus" + $validationLevel = "ProviderNoRbac" + + # Act. + $result = Get-AzManagementGroupDeploymentWhatIfResult ` + -Name $deploymentName ` + -Location $location ` + -ManagementGroupId $managementGroupId ` + -TemplateFile management_group_level_template.json ` + -targetMG $managementGroupId ` + -nestedsubId $subscriptionId ` + -nestedRG $resourceGroupName ` + -storageAccountName $storageAccountName ` + -ValidationLevel $validationLevel + + # Assert. + Assert-AreEqual "Succeeded" $result.Status + Assert-NotNull $result.Changes + Assert-True { $result.Changes.Count -gt 0 } + + foreach ($change in $result.Changes) + { + Assert-AreEqual "Create" $change.ChangeType + } +} + <# .SYNOPSIS Tests tenant level deployment what-if with resource creation. @@ -719,3 +825,40 @@ function Test-WhatIfExcludeChangeTypesAtTenantScope Assert-NotNull $result.Changes Assert-True { $result.Changes.Count -eq 0 } } + +<# +.SYNOPSIS +Tests tenant level deployment what-if with ExcludeChangeType. +#> +function Test-WhatIfProviderNoRbacAtTenantScope +{ + # Arrange. + $deploymentName = Get-ResourceName + $managementGroupId = "myTestMG" + $subscriptionId = "a93e8c5c-63cb-4635-933f-6d166ac25187" + $resourceGroupName = Get-ResourceGroupName + $storageAccountName = Get-ResourceName + $location = "westus" + $validationLevel = "ProviderNoRbac" + + # Act. + $result = Get-AzTenantDeploymentWhatIfResult ` + -Name $deploymentName ` + -Location $location ` + -TemplateFile management_group_level_template.json ` + -targetMG $managementGroupId ` + -nestedsubId $subscriptionId ` + -nestedRG $resourceGroupName ` + -storageAccountName $storageAccountName ` + -ValidationLevel $validationLevel + + # Assert. + Assert-AreEqual "Succeeded" $result.Status + Assert-NotNull $result.Changes + Assert-True { $result.Changes.Count -gt 0 } + + foreach ($change in $result.Changes) + { + Assert-AreEqual "Create" $change.ChangeType + } +} diff --git a/src/Resources/Resources.Test/SessionRecords/Microsoft.Azure.Commands.Resources.Test.ScenarioTests.DeploymentWhatIfTests/MGLevelWhatIf_ProviderNoRbacAtManagementGroupScope.json b/src/Resources/Resources.Test/SessionRecords/Microsoft.Azure.Commands.Resources.Test.ScenarioTests.DeploymentWhatIfTests/MGLevelWhatIf_ProviderNoRbacAtManagementGroupScope.json new file mode 100644 index 000000000000..8525aeb4c1fd --- /dev/null +++ b/src/Resources/Resources.Test/SessionRecords/Microsoft.Azure.Commands.Resources.Test.ScenarioTests.DeploymentWhatIfTests/MGLevelWhatIf_ProviderNoRbacAtManagementGroupScope.json @@ -0,0 +1,197 @@ +{ + "Entries": [ + { + "RequestUri": "/providers/Microsoft.Management/managementGroups/myTestMG/providers/Microsoft.Resources/deployments/ps2159/whatIf?api-version=2020-06-01", + "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuTWFuYWdlbWVudC9tYW5hZ2VtZW50R3JvdXBzL215VGVzdE1HL3Byb3ZpZGVycy9NaWNyb3NvZnQuUmVzb3VyY2VzL2RlcGxveW1lbnRzL3BzMjE1OS93aGF0SWY/YXBpLXZlcnNpb249MjAyMC0wNi0wMQ==", + "RequestMethod": "POST", + "RequestBody": "{\r\n \"location\": \"westus\",\r\n \"properties\": {\r\n \"whatIfSettings\": {\r\n \"resultFormat\": \"FullResourcePayloads\"\r\n },\r\n \"template\": {\r\n \"$schema\": \"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#\",\r\n \"contentVersion\": \"1.0.0.0\",\r\n \"parameters\": {\r\n \"targetMG\": {\r\n \"type\": \"string\"\r\n },\r\n \"nestedsubId\": {\r\n \"type\": \"string\"\r\n },\r\n \"nestedRG\": {\r\n \"type\": \"string\"\r\n },\r\n \"storageAccountName\": {\r\n \"type\": \"string\"\r\n }\r\n },\r\n \"variables\": {\r\n \"mgScope\": \"[concat('/providers/Microsoft.Management/managementGroups/', parameters('targetMG'))]\"\r\n },\r\n \"resources\": [\r\n {\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"policy2\",\r\n \"apiVersion\": \"2016-12-01\",\r\n \"properties\": {\r\n \"policyType\": \"Custom\",\r\n \"parameters\": {},\r\n \"policyRule\": {\r\n \"if\": {\r\n \"field\": \"location\",\r\n \"equals\": \"northeurope\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n }\r\n },\r\n {\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"location-lock\",\r\n \"apiVersion\": \"2016-12-01\",\r\n \"dependsOn\": [\r\n \"policy2\"\r\n ],\r\n \"properties\": {\r\n \"scope\": \"[variables('mgScope')]\",\r\n \"policyDefinitionId\": \"[concat(variables('mgScope'), '/providers/', 'Microsoft.Authorization/policyDefinitions/', 'policy2')]\"\r\n }\r\n },\r\n {\r\n \"type\": \"Microsoft.Resources/deployments\",\r\n \"name\": \"ps_test_management_group_deployment\",\r\n \"apiVersion\": \"2018-05-01\",\r\n \"location\": \"West US\",\r\n \"subscriptionId\": \"[parameters('nestedSubId')]\",\r\n \"properties\": {\r\n \"template\": {\r\n \"$schema\": \"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#\",\r\n \"contentVersion\": \"1.0.0.0\",\r\n \"parameters\": {},\r\n \"variables\": {},\r\n \"resources\": [\r\n {\r\n \"type\": \"Microsoft.Resources/resourceGroups\",\r\n \"name\": \"[parameters('nestedRG')]\",\r\n \"apiVersion\": \"2018-05-01\",\r\n \"location\": \"East US 2\",\r\n \"properties\": {}\r\n },\r\n {\r\n \"type\": \"Microsoft.Resources/deployments\",\r\n \"name\": \"ps_test_management_group_deployment\",\r\n \"apiVersion\": \"2017-05-10\",\r\n \"resourceGroup\": \"[parameters('nestedRG')]\",\r\n \"dependsOn\": [\r\n \"[parameters('nestedRG')]\"\r\n ],\r\n \"properties\": {\r\n \"template\": {\r\n \"$schema\": \"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#\",\r\n \"contentVersion\": \"1.0.0.0\",\r\n \"parameters\": {},\r\n \"variables\": {},\r\n \"resources\": [\r\n {\r\n \"type\": \"Microsoft.Storage/storageAccounts\",\r\n \"name\": \"[parameters('storageAccountName')]\",\r\n \"apiVersion\": \"2015-06-15\",\r\n \"location\": \"East US\",\r\n \"properties\": {\r\n \"accountType\": \"Standard_LRS\"\r\n }\r\n }\r\n ]\r\n },\r\n \"mode\": \"Incremental\"\r\n }\r\n }\r\n ]\r\n },\r\n \"mode\": \"Incremental\"\r\n }\r\n }\r\n ]\r\n },\r\n \"parameters\": {\r\n \"nestedRG\": {\r\n \"value\": \"ps915\"\r\n },\r\n \"storageAccountName\": {\r\n \"value\": \"ps3533\"\r\n },\r\n \"nestedsubId\": {\r\n \"value\": \"a93e8c5c-63cb-4635-933f-6d166ac25187\"\r\n },\r\n \"targetMG\": {\r\n \"value\": \"myTestMG\"\r\n }\r\n },\r\n \"mode\": \"Incremental\"\r\n }\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "ae07744e-14c0-47d3-a817-5af555925abf" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.29017.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19041.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/3.9.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "4275" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Location": [ + "https://management.azure.com/providers/Microsoft.Resources/operationResults/eyJqb2JJZCI6IkRlcGxveW1lbnRXaGF0SWZKb2ItTVlURVNUTUctUFMyMTU5LThENkVGQTcyOjJEOThEMDoyRDQ1MUE6MkRCRkVGOjJEQkE0QzlCRjgxMUE3Iiwiam9iTG9jYXRpb24iOiJ3ZXN0dXMifQ?api-version=2020-06-01" + ], + "Retry-After": [ + "0" + ], + "x-ms-ratelimit-remaining-tenant-writes": [ + "1199" + ], + "x-ms-request-id": [ + "8d6efa72-98d0-451a-bfef-ba4c9bf811a7" + ], + "x-ms-correlation-request-id": [ + "8d6efa72-98d0-451a-bfef-ba4c9bf811a7" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200731T043237Z:8d6efa72-98d0-451a-bfef-ba4c9bf811a7" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 31 Jul 2020 04:32:36 GMT" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 202 + }, + { + "RequestUri": "/providers/Microsoft.Resources/operationResults/eyJqb2JJZCI6IkRlcGxveW1lbnRXaGF0SWZKb2ItTVlURVNUTUctUFMyMTU5LThENkVGQTcyOjJEOThEMDoyRDQ1MUE6MkRCRkVGOjJEQkE0QzlCRjgxMUE3Iiwiam9iTG9jYXRpb24iOiJ3ZXN0dXMifQ?api-version=2020-06-01", + "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuUmVzb3VyY2VzL29wZXJhdGlvblJlc3VsdHMvZXlKcWIySkpaQ0k2SWtSbGNHeHZlVzFsYm5SWGFHRjBTV1pLYjJJdFRWbFVSVk5VVFVjdFVGTXlNVFU1TFRoRU5rVkdRVGN5T2pKRU9UaEVNRG95UkRRMU1VRTZNa1JDUmtWR09qSkVRa0UwUXpsQ1JqZ3hNVUUzSWl3aWFtOWlURzlqWVhScGIyNGlPaUozWlhOMGRYTWlmUT9hcGktdmVyc2lvbj0yMDIwLTA2LTAx", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29017.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19041.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/3.9.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-tenant-reads": [ + "11999" + ], + "x-ms-request-id": [ + "8ca9acdd-c57a-428b-9d74-4b39b3d054fe" + ], + "x-ms-correlation-request-id": [ + "8ca9acdd-c57a-428b-9d74-4b39b3d054fe" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200731T043252Z:8ca9acdd-c57a-428b-9d74-4b39b3d054fe" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 31 Jul 2020 04:32:51 GMT" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "1953" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"status\": \"Succeeded\",\r\n \"properties\": {\r\n \"changes\": [\r\n {\r\n \"resourceId\": \"/providers/Microsoft.Management/managementGroups/myTestMG/providers/Microsoft.Authorization/policyAssignments/location-lock\",\r\n \"changeType\": \"Create\",\r\n \"after\": {\r\n \"apiVersion\": \"2016-12-01\",\r\n \"id\": \"/providers/Microsoft.Management/managementGroups/myTestMG/providers/Microsoft.Authorization/policyAssignments/location-lock\",\r\n \"name\": \"location-lock\",\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/providers/Microsoft.Management/managementGroups/myTestMG/providers/Microsoft.Authorization/policyDefinitions/policy2\",\r\n \"scope\": \"/providers/Microsoft.Management/managementGroups/myTestMG\"\r\n },\r\n \"type\": \"Microsoft.Authorization/policyAssignments\"\r\n }\r\n },\r\n {\r\n \"resourceId\": \"/providers/Microsoft.Management/managementGroups/myTestMG/providers/Microsoft.Authorization/policyDefinitions/policy2\",\r\n \"changeType\": \"Create\",\r\n \"after\": {\r\n \"apiVersion\": \"2016-12-01\",\r\n \"id\": \"/providers/Microsoft.Management/managementGroups/myTestMG/providers/Microsoft.Authorization/policyDefinitions/policy2\",\r\n \"name\": \"policy2\",\r\n \"properties\": {\r\n \"policyRule\": {\r\n \"if\": {\r\n \"equals\": \"northeurope\",\r\n \"field\": \"location\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n },\r\n \"policyType\": \"Custom\"\r\n },\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\"\r\n }\r\n },\r\n {\r\n \"resourceId\": \"/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/resourceGroups/ps915\",\r\n \"changeType\": \"Create\",\r\n \"after\": {\r\n \"apiVersion\": \"2018-05-01\",\r\n \"id\": \"/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/resourceGroups/ps915\",\r\n \"location\": \"East US 2\",\r\n \"name\": \"ps915\",\r\n \"type\": \"Microsoft.Resources/resourceGroups\"\r\n }\r\n },\r\n {\r\n \"resourceId\": \"/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/resourceGroups/ps915/providers/Microsoft.Storage/storageAccounts/ps3533\",\r\n \"changeType\": \"Create\",\r\n \"after\": {\r\n \"apiVersion\": \"2015-06-15\",\r\n \"id\": \"/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/resourceGroups/ps915/providers/Microsoft.Storage/storageAccounts/ps3533\",\r\n \"location\": \"East US\",\r\n \"name\": \"ps3533\",\r\n \"properties\": {\r\n \"accountType\": \"Standard_LRS\"\r\n },\r\n \"type\": \"Microsoft.Storage/storageAccounts\"\r\n }\r\n }\r\n ]\r\n }\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/providers/Microsoft.Resources/operationResults/eyJqb2JJZCI6IkRlcGxveW1lbnRXaGF0SWZKb2ItTVlURVNUTUctUFMyMTU5LThENkVGQTcyOjJEOThEMDoyRDQ1MUE6MkRCRkVGOjJEQkE0QzlCRjgxMUE3Iiwiam9iTG9jYXRpb24iOiJ3ZXN0dXMifQ?api-version=2020-06-01", + "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuUmVzb3VyY2VzL29wZXJhdGlvblJlc3VsdHMvZXlKcWIySkpaQ0k2SWtSbGNHeHZlVzFsYm5SWGFHRjBTV1pLYjJJdFRWbFVSVk5VVFVjdFVGTXlNVFU1TFRoRU5rVkdRVGN5T2pKRU9UaEVNRG95UkRRMU1VRTZNa1JDUmtWR09qSkVRa0UwUXpsQ1JqZ3hNVUUzSWl3aWFtOWlURzlqWVhScGIyNGlPaUozWlhOMGRYTWlmUT9hcGktdmVyc2lvbj0yMDIwLTA2LTAx", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29017.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19041.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/3.9.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-tenant-reads": [ + "11998" + ], + "x-ms-request-id": [ + "c9332cfc-c155-4cd6-901a-ee0e69f78545" + ], + "x-ms-correlation-request-id": [ + "c9332cfc-c155-4cd6-901a-ee0e69f78545" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200731T043252Z:c9332cfc-c155-4cd6-901a-ee0e69f78545" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 31 Jul 2020 04:32:52 GMT" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "1953" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"status\": \"Succeeded\",\r\n \"properties\": {\r\n \"changes\": [\r\n {\r\n \"resourceId\": \"/providers/Microsoft.Management/managementGroups/myTestMG/providers/Microsoft.Authorization/policyAssignments/location-lock\",\r\n \"changeType\": \"Create\",\r\n \"after\": {\r\n \"apiVersion\": \"2016-12-01\",\r\n \"id\": \"/providers/Microsoft.Management/managementGroups/myTestMG/providers/Microsoft.Authorization/policyAssignments/location-lock\",\r\n \"name\": \"location-lock\",\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/providers/Microsoft.Management/managementGroups/myTestMG/providers/Microsoft.Authorization/policyDefinitions/policy2\",\r\n \"scope\": \"/providers/Microsoft.Management/managementGroups/myTestMG\"\r\n },\r\n \"type\": \"Microsoft.Authorization/policyAssignments\"\r\n }\r\n },\r\n {\r\n \"resourceId\": \"/providers/Microsoft.Management/managementGroups/myTestMG/providers/Microsoft.Authorization/policyDefinitions/policy2\",\r\n \"changeType\": \"Create\",\r\n \"after\": {\r\n \"apiVersion\": \"2016-12-01\",\r\n \"id\": \"/providers/Microsoft.Management/managementGroups/myTestMG/providers/Microsoft.Authorization/policyDefinitions/policy2\",\r\n \"name\": \"policy2\",\r\n \"properties\": {\r\n \"policyRule\": {\r\n \"if\": {\r\n \"equals\": \"northeurope\",\r\n \"field\": \"location\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n },\r\n \"policyType\": \"Custom\"\r\n },\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\"\r\n }\r\n },\r\n {\r\n \"resourceId\": \"/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/resourceGroups/ps915\",\r\n \"changeType\": \"Create\",\r\n \"after\": {\r\n \"apiVersion\": \"2018-05-01\",\r\n \"id\": \"/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/resourceGroups/ps915\",\r\n \"location\": \"East US 2\",\r\n \"name\": \"ps915\",\r\n \"type\": \"Microsoft.Resources/resourceGroups\"\r\n }\r\n },\r\n {\r\n \"resourceId\": \"/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/resourceGroups/ps915/providers/Microsoft.Storage/storageAccounts/ps3533\",\r\n \"changeType\": \"Create\",\r\n \"after\": {\r\n \"apiVersion\": \"2015-06-15\",\r\n \"id\": \"/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/resourceGroups/ps915/providers/Microsoft.Storage/storageAccounts/ps3533\",\r\n \"location\": \"East US\",\r\n \"name\": \"ps3533\",\r\n \"properties\": {\r\n \"accountType\": \"Standard_LRS\"\r\n },\r\n \"type\": \"Microsoft.Storage/storageAccounts\"\r\n }\r\n }\r\n ]\r\n }\r\n}", + "StatusCode": 200 + } + ], + "Names": { + "Test-WhatIfProviderNoRbacAtManagementGroupScope": [ + "ps2159", + "ps915", + "ps3533" + ] + }, + "Variables": { + "SubscriptionId": "a93e8c5c-63cb-4635-933f-6d166ac25187" + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Test/SessionRecords/Microsoft.Azure.Commands.Resources.Test.ScenarioTests.DeploymentWhatIfTests/RGLevelWhatIf_ProviderNoRbacAtResourceGroupScope.json b/src/Resources/Resources.Test/SessionRecords/Microsoft.Azure.Commands.Resources.Test.ScenarioTests.DeploymentWhatIfTests/RGLevelWhatIf_ProviderNoRbacAtResourceGroupScope.json new file mode 100644 index 000000000000..364517c52a74 --- /dev/null +++ b/src/Resources/Resources.Test/SessionRecords/Microsoft.Azure.Commands.Resources.Test.ScenarioTests.DeploymentWhatIfTests/RGLevelWhatIf_ProviderNoRbacAtResourceGroupScope.json @@ -0,0 +1,677 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/resourcegroups/ps4296?api-version=2020-06-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYTkzZThjNWMtNjNjYi00NjM1LTkzM2YtNmQxNjZhYzI1MTg3L3Jlc291cmNlZ3JvdXBzL3BzNDI5Nj9hcGktdmVyc2lvbj0yMDIwLTA2LTAx", + "RequestMethod": "HEAD", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "2005e8ac-2c02-4eb7-b67a-d9e6dfa51578" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.29017.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19041.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/3.9.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-failure-cause": [ + "gateway" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "x-ms-request-id": [ + "1eccbc5d-0c0d-4086-a56f-2cc110085d66" + ], + "x-ms-correlation-request-id": [ + "1eccbc5d-0c0d-4086-a56f-2cc110085d66" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200724T004903Z:1eccbc5d-0c0d-4086-a56f-2cc110085d66" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 24 Jul 2020 00:49:03 GMT" + ], + "Content-Length": [ + "98" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 404 + }, + { + "RequestUri": "/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/resourcegroups/ps4296?api-version=2020-06-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYTkzZThjNWMtNjNjYi00NjM1LTkzM2YtNmQxNjZhYzI1MTg3L3Jlc291cmNlZ3JvdXBzL3BzNDI5Nj9hcGktdmVyc2lvbj0yMDIwLTA2LTAx", + "RequestMethod": "HEAD", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "657674b9-d525-4aeb-a439-67b845afd274" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.29017.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19041.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/3.9.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "x-ms-request-id": [ + "14d20dad-b061-46ca-bd53-b82157f7bedf" + ], + "x-ms-correlation-request-id": [ + "14d20dad-b061-46ca-bd53-b82157f7bedf" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200724T004921Z:14d20dad-b061-46ca-bd53-b82157f7bedf" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 24 Jul 2020 00:49:21 GMT" + ], + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 204 + }, + { + "RequestUri": "/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/resourcegroups/ps4296?api-version=2020-06-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYTkzZThjNWMtNjNjYi00NjM1LTkzM2YtNmQxNjZhYzI1MTg3L3Jlc291cmNlZ3JvdXBzL3BzNDI5Nj9hcGktdmVyc2lvbj0yMDIwLTA2LTAx", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"westus\"\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "60467d7c-99c6-473a-8c2d-7102f9942fa0" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.29017.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19041.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/3.9.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "28" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "e4319db1-fee7-47ba-bb08-221b7dbfc677" + ], + "x-ms-correlation-request-id": [ + "e4319db1-fee7-47ba-bb08-221b7dbfc677" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200724T004904Z:e4319db1-fee7-47ba-bb08-221b7dbfc677" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 24 Jul 2020 00:49:03 GMT" + ], + "Content-Length": [ + "209" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/resourceGroups/ps4296\",\r\n \"name\": \"ps4296\",\r\n \"type\": \"Microsoft.Resources/resourceGroups\",\r\n \"location\": \"westus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/resourcegroups/ps4296/providers/Microsoft.Resources/deployments/ps6327/whatIf?api-version=2020-06-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYTkzZThjNWMtNjNjYi00NjM1LTkzM2YtNmQxNjZhYzI1MTg3L3Jlc291cmNlZ3JvdXBzL3BzNDI5Ni9wcm92aWRlcnMvTWljcm9zb2Z0LlJlc291cmNlcy9kZXBsb3ltZW50cy9wczYzMjcvd2hhdElmP2FwaS12ZXJzaW9uPTIwMjAtMDYtMDE=", + "RequestMethod": "POST", + "RequestBody": "{\r\n \"properties\": {\r\n \"whatIfSettings\": {\r\n \"resultFormat\": \"ResourceIdOnly\"\r\n },\r\n \"template\": {\r\n \"$schema\": \"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#\",\r\n \"contentVersion\": \"1.0.0.0\",\r\n \"parameters\": {\r\n \"storageAccountName\": {\r\n \"type\": \"String\"\r\n },\r\n \"storageAccountType\": {\r\n \"type\": \"string\",\r\n \"defaultValue\": \"Standard_LRS\",\r\n \"allowedValues\": [\r\n \"Standard_LRS\",\r\n \"Standard_GRS\",\r\n \"Standard_ZRS\"\r\n ]\r\n },\r\n \"location\": {\r\n \"type\": \"String\",\r\n \"defaultValue\": \"East US\",\r\n \"allowedValues\": [\r\n \"West US\",\r\n \"East US\"\r\n ]\r\n }\r\n },\r\n \"resources\": [\r\n {\r\n \"type\": \"Microsoft.Storage/storageAccounts\",\r\n \"name\": \"[parameters('StorageAccountName')]\",\r\n \"apiVersion\": \"2015-06-15\",\r\n \"location\": \"[parameters('location')]\",\r\n \"properties\": {\r\n \"accountType\": \"[parameters('storageAccountType')]\"\r\n }\r\n }\r\n ],\r\n \"outputs\": {\r\n \"storageAccountInfo\": {\r\n \"value\": \"[reference(concat('Microsoft.Storage/storageAccounts/', parameters('StorageAccountName')),providers('Microsoft.Storage', 'storageAccounts').apiVersions[0])]\",\r\n \"type\": \"object\"\r\n }\r\n }\r\n },\r\n \"parameters\": {\r\n \"storageAccountName\": {\r\n \"value\": \"ps451\"\r\n }\r\n },\r\n \"mode\": \"Incremental\"\r\n }\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "0001cf55-083c-4011-acf7-a7ea50787fc2" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.29017.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19041.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/3.9.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "1573" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Location": [ + "https://management.azure.com/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/operationresults/eyJqb2JJZCI6IkRlcGxveW1lbnRXaGF0SWZKb2ItUFM0Mjk2LVBTNjMyNy1ENzlGRkU4NToyRDRCNTM6MkQ0M0FBOjJEODZBODoyREFGRUQ5MjA5MUZGMCIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2020-06-01" + ], + "Retry-After": [ + "0" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "d79ffe85-4b53-43aa-86a8-afed92091ff0" + ], + "x-ms-correlation-request-id": [ + "d79ffe85-4b53-43aa-86a8-afed92091ff0" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200724T004905Z:d79ffe85-4b53-43aa-86a8-afed92091ff0" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 24 Jul 2020 00:49:05 GMT" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/operationresults/eyJqb2JJZCI6IkRlcGxveW1lbnRXaGF0SWZKb2ItUFM0Mjk2LVBTNjMyNy1ENzlGRkU4NToyRDRCNTM6MkQ0M0FBOjJEODZBODoyREFGRUQ5MjA5MUZGMCIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2020-06-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYTkzZThjNWMtNjNjYi00NjM1LTkzM2YtNmQxNjZhYzI1MTg3L29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWtSbGNHeHZlVzFsYm5SWGFHRjBTV1pLYjJJdFVGTTBNamsyTFZCVE5qTXlOeTFFTnpsR1JrVTROVG95UkRSQ05UTTZNa1EwTTBGQk9qSkVPRFpCT0RveVJFRkdSVVE1TWpBNU1VWkdNQ0lzSW1wdllreHZZMkYwYVc5dUlqb2lkMlZ6ZEhWekluMD9hcGktdmVyc2lvbj0yMDIwLTA2LTAx", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29017.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19041.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/3.9.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "x-ms-request-id": [ + "c835d96b-4e1a-4ed9-875b-e7fbf2947627" + ], + "x-ms-correlation-request-id": [ + "c835d96b-4e1a-4ed9-875b-e7fbf2947627" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200724T004920Z:c835d96b-4e1a-4ed9-875b-e7fbf2947627" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 24 Jul 2020 00:49:20 GMT" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "212" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"status\": \"Succeeded\",\r\n \"properties\": {\r\n \"changes\": [\r\n {\r\n \"resourceId\": \"/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/resourceGroups/ps4296/providers/Microsoft.Storage/storageAccounts/ps451\",\r\n \"changeType\": \"Create\"\r\n }\r\n ]\r\n }\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/operationresults/eyJqb2JJZCI6IkRlcGxveW1lbnRXaGF0SWZKb2ItUFM0Mjk2LVBTNjMyNy1ENzlGRkU4NToyRDRCNTM6MkQ0M0FBOjJEODZBODoyREFGRUQ5MjA5MUZGMCIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2020-06-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYTkzZThjNWMtNjNjYi00NjM1LTkzM2YtNmQxNjZhYzI1MTg3L29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWtSbGNHeHZlVzFsYm5SWGFHRjBTV1pLYjJJdFVGTTBNamsyTFZCVE5qTXlOeTFFTnpsR1JrVTROVG95UkRSQ05UTTZNa1EwTTBGQk9qSkVPRFpCT0RveVJFRkdSVVE1TWpBNU1VWkdNQ0lzSW1wdllreHZZMkYwYVc5dUlqb2lkMlZ6ZEhWekluMD9hcGktdmVyc2lvbj0yMDIwLTA2LTAx", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29017.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19041.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/3.9.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11998" + ], + "x-ms-request-id": [ + "43755527-ab2c-4fee-b939-660da908971a" + ], + "x-ms-correlation-request-id": [ + "43755527-ab2c-4fee-b939-660da908971a" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200724T004921Z:43755527-ab2c-4fee-b939-660da908971a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 24 Jul 2020 00:49:20 GMT" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "212" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"status\": \"Succeeded\",\r\n \"properties\": {\r\n \"changes\": [\r\n {\r\n \"resourceId\": \"/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/resourceGroups/ps4296/providers/Microsoft.Storage/storageAccounts/ps451\",\r\n \"changeType\": \"Create\"\r\n }\r\n ]\r\n }\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/resourcegroups/ps4296?api-version=2020-06-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYTkzZThjNWMtNjNjYi00NjM1LTkzM2YtNmQxNjZhYzI1MTg3L3Jlc291cmNlZ3JvdXBzL3BzNDI5Nj9hcGktdmVyc2lvbj0yMDIwLTA2LTAx", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "abdbb164-fa3e-46a8-b2b8-be933ae5acc7" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.29017.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19041.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/3.9.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Location": [ + "https://management.azure.com/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1QUzQyOTYtV0VTVFVTIiwiam9iTG9jYXRpb24iOiJ3ZXN0dXMifQ?api-version=2020-06-01" + ], + "Retry-After": [ + "0" + ], + "x-ms-ratelimit-remaining-subscription-deletes": [ + "14999" + ], + "x-ms-request-id": [ + "44d4e7f6-3181-4cdb-821d-fb9484c2a237" + ], + "x-ms-correlation-request-id": [ + "44d4e7f6-3181-4cdb-821d-fb9484c2a237" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200724T004921Z:44d4e7f6-3181-4cdb-821d-fb9484c2a237" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 24 Jul 2020 00:49:21 GMT" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1QUzQyOTYtV0VTVFVTIiwiam9iTG9jYXRpb24iOiJ3ZXN0dXMifQ?api-version=2020-06-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYTkzZThjNWMtNjNjYi00NjM1LTkzM2YtNmQxNjZhYzI1MTg3L29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFRVXpReU9UWXRWMFZUVkZWVElpd2lhbTlpVEc5allYUnBiMjRpT2lKM1pYTjBkWE1pZlE/YXBpLXZlcnNpb249MjAyMC0wNi0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29017.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19041.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/3.9.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Location": [ + "https://management.azure.com/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1QUzQyOTYtV0VTVFVTIiwiam9iTG9jYXRpb24iOiJ3ZXN0dXMifQ?api-version=2020-06-01" + ], + "Retry-After": [ + "0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11998" + ], + "x-ms-request-id": [ + "6ffea322-b125-413a-b9d3-c47164dd0025" + ], + "x-ms-correlation-request-id": [ + "6ffea322-b125-413a-b9d3-c47164dd0025" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200724T004936Z:6ffea322-b125-413a-b9d3-c47164dd0025" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 24 Jul 2020 00:49:36 GMT" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1QUzQyOTYtV0VTVFVTIiwiam9iTG9jYXRpb24iOiJ3ZXN0dXMifQ?api-version=2020-06-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYTkzZThjNWMtNjNjYi00NjM1LTkzM2YtNmQxNjZhYzI1MTg3L29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFRVXpReU9UWXRWMFZUVkZWVElpd2lhbTlpVEc5allYUnBiMjRpT2lKM1pYTjBkWE1pZlE/YXBpLXZlcnNpb249MjAyMC0wNi0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29017.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19041.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/3.9.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Location": [ + "https://management.azure.com/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1QUzQyOTYtV0VTVFVTIiwiam9iTG9jYXRpb24iOiJ3ZXN0dXMifQ?api-version=2020-06-01" + ], + "Retry-After": [ + "0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11997" + ], + "x-ms-request-id": [ + "3d68f6ed-ca84-4b95-a802-87af71a91ead" + ], + "x-ms-correlation-request-id": [ + "3d68f6ed-ca84-4b95-a802-87af71a91ead" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200724T004952Z:3d68f6ed-ca84-4b95-a802-87af71a91ead" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 24 Jul 2020 00:49:51 GMT" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1QUzQyOTYtV0VTVFVTIiwiam9iTG9jYXRpb24iOiJ3ZXN0dXMifQ?api-version=2020-06-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYTkzZThjNWMtNjNjYi00NjM1LTkzM2YtNmQxNjZhYzI1MTg3L29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFRVXpReU9UWXRWMFZUVkZWVElpd2lhbTlpVEc5allYUnBiMjRpT2lKM1pYTjBkWE1pZlE/YXBpLXZlcnNpb249MjAyMC0wNi0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29017.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19041.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/3.9.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11996" + ], + "x-ms-request-id": [ + "d30e204a-fe04-4246-bb5d-b0955d07216f" + ], + "x-ms-correlation-request-id": [ + "d30e204a-fe04-4246-bb5d-b0955d07216f" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200724T005007Z:d30e204a-fe04-4246-bb5d-b0955d07216f" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 24 Jul 2020 00:50:07 GMT" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "0" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1QUzQyOTYtV0VTVFVTIiwiam9iTG9jYXRpb24iOiJ3ZXN0dXMifQ?api-version=2020-06-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYTkzZThjNWMtNjNjYi00NjM1LTkzM2YtNmQxNjZhYzI1MTg3L29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFRVXpReU9UWXRWMFZUVkZWVElpd2lhbTlpVEc5allYUnBiMjRpT2lKM1pYTjBkWE1pZlE/YXBpLXZlcnNpb249MjAyMC0wNi0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29017.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19041.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/3.9.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11995" + ], + "x-ms-request-id": [ + "056630d6-1ab9-42cd-8fe6-e00b3c6e1d3e" + ], + "x-ms-correlation-request-id": [ + "056630d6-1ab9-42cd-8fe6-e00b3c6e1d3e" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200724T005007Z:056630d6-1ab9-42cd-8fe6-e00b3c6e1d3e" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 24 Jul 2020 00:50:07 GMT" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "0" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 200 + } + ], + "Names": { + "Test-WhatIfProviderNoRbacAtResourceGroupScope": [ + "ps6327", + "ps4296", + "ps451" + ] + }, + "Variables": { + "SubscriptionId": "a93e8c5c-63cb-4635-933f-6d166ac25187" + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Test/SessionRecords/Microsoft.Azure.Commands.Resources.Test.ScenarioTests.DeploymentWhatIfTests/SubLevelWhatIf_ProviderNoRbacAtSubscriptionScope.json b/src/Resources/Resources.Test/SessionRecords/Microsoft.Azure.Commands.Resources.Test.ScenarioTests.DeploymentWhatIfTests/SubLevelWhatIf_ProviderNoRbacAtSubscriptionScope.json new file mode 100644 index 000000000000..ae19a2588d53 --- /dev/null +++ b/src/Resources/Resources.Test/SessionRecords/Microsoft.Azure.Commands.Resources.Test.ScenarioTests.DeploymentWhatIfTests/SubLevelWhatIf_ProviderNoRbacAtSubscriptionScope.json @@ -0,0 +1,196 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/providers/Microsoft.Resources/deployments/ps1977/whatIf?api-version=2020-06-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYTkzZThjNWMtNjNjYi00NjM1LTkzM2YtNmQxNjZhYzI1MTg3L3Byb3ZpZGVycy9NaWNyb3NvZnQuUmVzb3VyY2VzL2RlcGxveW1lbnRzL3BzMTk3Ny93aGF0SWY/YXBpLXZlcnNpb249MjAyMC0wNi0wMQ==", + "RequestMethod": "POST", + "RequestBody": "{\r\n \"location\": \"westus\",\r\n \"properties\": {\r\n \"whatIfSettings\": {\r\n \"resultFormat\": \"ResourceIdOnly\"\r\n },\r\n \"template\": {\r\n \"$schema\": \"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#\",\r\n \"contentVersion\": \"1.0.0.0\",\r\n \"parameters\": {\r\n \"storageAccountName\": {\r\n \"type\": \"string\",\r\n \"defaultValue\": \"armbuilddemo18122\"\r\n },\r\n \"nestedDeploymentRG\": {\r\n \"type\": \"string\",\r\n \"defaultValue\": \"ps_test_subscription_deployment\"\r\n },\r\n \"policyLocation\": {\r\n \"type\": \"string\",\r\n \"defaultValue\": \"northeurope\"\r\n }\r\n },\r\n \"variables\": {},\r\n \"resources\": [\r\n {\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"policy2\",\r\n \"apiVersion\": \"2016-12-01\",\r\n \"properties\": {\r\n \"policyType\": \"Custom\",\r\n \"parameters\": {},\r\n \"policyRule\": {\r\n \"if\": {\r\n \"field\": \"location\",\r\n \"equals\": \"[parameters('policyLocation')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n }\r\n },\r\n {\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"location-lock\",\r\n \"apiVersion\": \"2016-12-01\",\r\n \"dependsOn\": [\r\n \"policy2\"\r\n ],\r\n \"properties\": {\r\n \"scope\": \"[subscription().id]\",\r\n \"policyDefinitionId\": \"[resourceId('Microsoft.Authorization/policyDefinitions', 'policy2')]\"\r\n }\r\n },\r\n {\r\n \"type\": \"Microsoft.Resources/resourceGroups\",\r\n \"name\": \"[parameters('nestedDeploymentRG')]\",\r\n \"location\": \"West US\",\r\n \"apiVersion\": \"2019-05-01\",\r\n \"properties\": {}\r\n },\r\n {\r\n \"type\": \"Microsoft.Resources/deployments\",\r\n \"name\": \"rg-nested\",\r\n \"apiVersion\": \"2017-05-10\",\r\n \"resourceGroup\": \"[parameters('nestedDeploymentRG')]\",\r\n \"dependsOn\": [\r\n \"[parameters('nestedDeploymentRG')]\"\r\n ],\r\n \"properties\": {\r\n \"template\": {\r\n \"$schema\": \"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#\",\r\n \"contentVersion\": \"1.0.0.0\",\r\n \"parameters\": {},\r\n \"variables\": {},\r\n \"resources\": [\r\n {\r\n \"type\": \"Microsoft.Storage/storageAccounts\",\r\n \"name\": \"[parameters('storageAccountName')]\",\r\n \"apiVersion\": \"2015-06-15\",\r\n \"location\": \"East US\",\r\n \"properties\": {\r\n \"accountType\": \"Standard_LRS\"\r\n }\r\n }\r\n ]\r\n },\r\n \"mode\": \"Incremental\"\r\n }\r\n }\r\n ]\r\n },\r\n \"parameters\": {\r\n \"storageAccountName\": {\r\n \"value\": \"ps3160\"\r\n }\r\n },\r\n \"mode\": \"Incremental\"\r\n }\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "8946be88-cdf2-43ee-89ec-695a6b9429a9" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.29017.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19041.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/3.9.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "3093" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Location": [ + "https://management.azure.com/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/operationresults/eyJqb2JJZCI6IkRlcGxveW1lbnRXaGF0SWZKb2ItLVBTMTk3Ny02QkNDMjlFNzoyRDQxRUY6MkQ0RDg3OjJEQkNGNToyREQ1QTFERTRFNkQ1MSIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2020-06-01" + ], + "Retry-After": [ + "0" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "6bcc29e7-41ef-4d87-bcf5-d5a1de4e6d51" + ], + "x-ms-correlation-request-id": [ + "6bcc29e7-41ef-4d87-bcf5-d5a1de4e6d51" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200724T005723Z:6bcc29e7-41ef-4d87-bcf5-d5a1de4e6d51" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 24 Jul 2020 00:57:23 GMT" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/operationresults/eyJqb2JJZCI6IkRlcGxveW1lbnRXaGF0SWZKb2ItLVBTMTk3Ny02QkNDMjlFNzoyRDQxRUY6MkQ0RDg3OjJEQkNGNToyREQ1QTFERTRFNkQ1MSIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2020-06-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYTkzZThjNWMtNjNjYi00NjM1LTkzM2YtNmQxNjZhYzI1MTg3L29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWtSbGNHeHZlVzFsYm5SWGFHRjBTV1pLYjJJdExWQlRNVGszTnkwMlFrTkRNamxGTnpveVJEUXhSVVk2TWtRMFJEZzNPakpFUWtOR05Ub3lSRVExUVRGRVJUUkZOa1ExTVNJc0ltcHZZa3h2WTJGMGFXOXVJam9pZDJWemRIVnpJbjA/YXBpLXZlcnNpb249MjAyMC0wNi0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29017.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19041.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/3.9.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "x-ms-request-id": [ + "5efd6b6c-9dd5-4d84-bf5e-e9bbd9fe1b5b" + ], + "x-ms-correlation-request-id": [ + "5efd6b6c-9dd5-4d84-bf5e-e9bbd9fe1b5b" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200724T005739Z:5efd6b6c-9dd5-4d84-bf5e-e9bbd9fe1b5b" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 24 Jul 2020 00:57:38 GMT" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "684" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"status\": \"Succeeded\",\r\n \"properties\": {\r\n \"changes\": [\r\n {\r\n \"resourceId\": \"/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/providers/Microsoft.Authorization/policyAssignments/location-lock\",\r\n \"changeType\": \"Create\"\r\n },\r\n {\r\n \"resourceId\": \"/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/providers/Microsoft.Authorization/policyDefinitions/policy2\",\r\n \"changeType\": \"Create\"\r\n },\r\n {\r\n \"resourceId\": \"/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/resourceGroups/ps_test_subscription_deployment\",\r\n \"changeType\": \"Create\"\r\n },\r\n {\r\n \"resourceId\": \"/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/resourceGroups/ps_test_subscription_deployment/providers/Microsoft.Storage/storageAccounts/ps3160\",\r\n \"changeType\": \"Create\"\r\n }\r\n ]\r\n }\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/operationresults/eyJqb2JJZCI6IkRlcGxveW1lbnRXaGF0SWZKb2ItLVBTMTk3Ny02QkNDMjlFNzoyRDQxRUY6MkQ0RDg3OjJEQkNGNToyREQ1QTFERTRFNkQ1MSIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2020-06-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYTkzZThjNWMtNjNjYi00NjM1LTkzM2YtNmQxNjZhYzI1MTg3L29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWtSbGNHeHZlVzFsYm5SWGFHRjBTV1pLYjJJdExWQlRNVGszTnkwMlFrTkRNamxGTnpveVJEUXhSVVk2TWtRMFJEZzNPakpFUWtOR05Ub3lSRVExUVRGRVJUUkZOa1ExTVNJc0ltcHZZa3h2WTJGMGFXOXVJam9pZDJWemRIVnpJbjA/YXBpLXZlcnNpb249MjAyMC0wNi0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29017.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19041.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/3.9.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11998" + ], + "x-ms-request-id": [ + "29b84e9b-e18a-4dbf-b39a-08e2e7ff5281" + ], + "x-ms-correlation-request-id": [ + "29b84e9b-e18a-4dbf-b39a-08e2e7ff5281" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200724T005739Z:29b84e9b-e18a-4dbf-b39a-08e2e7ff5281" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 24 Jul 2020 00:57:38 GMT" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "684" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"status\": \"Succeeded\",\r\n \"properties\": {\r\n \"changes\": [\r\n {\r\n \"resourceId\": \"/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/providers/Microsoft.Authorization/policyAssignments/location-lock\",\r\n \"changeType\": \"Create\"\r\n },\r\n {\r\n \"resourceId\": \"/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/providers/Microsoft.Authorization/policyDefinitions/policy2\",\r\n \"changeType\": \"Create\"\r\n },\r\n {\r\n \"resourceId\": \"/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/resourceGroups/ps_test_subscription_deployment\",\r\n \"changeType\": \"Create\"\r\n },\r\n {\r\n \"resourceId\": \"/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/resourceGroups/ps_test_subscription_deployment/providers/Microsoft.Storage/storageAccounts/ps3160\",\r\n \"changeType\": \"Create\"\r\n }\r\n ]\r\n }\r\n}", + "StatusCode": 200 + } + ], + "Names": { + "Test-WhatIfProviderNoRbacAtSubscriptionScope": [ + "ps1977", + "ps3160" + ] + }, + "Variables": { + "SubscriptionId": "a93e8c5c-63cb-4635-933f-6d166ac25187" + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Test/SessionRecords/Microsoft.Azure.Commands.Resources.Test.ScenarioTests.DeploymentWhatIfTests/TenantLevelWhatIf_ProviderNoRbacAtTenantScope.json b/src/Resources/Resources.Test/SessionRecords/Microsoft.Azure.Commands.Resources.Test.ScenarioTests.DeploymentWhatIfTests/TenantLevelWhatIf_ProviderNoRbacAtTenantScope.json new file mode 100644 index 000000000000..5516345dc335 --- /dev/null +++ b/src/Resources/Resources.Test/SessionRecords/Microsoft.Azure.Commands.Resources.Test.ScenarioTests.DeploymentWhatIfTests/TenantLevelWhatIf_ProviderNoRbacAtTenantScope.json @@ -0,0 +1,197 @@ +{ + "Entries": [ + { + "RequestUri": "/providers/Microsoft.Resources/deployments/ps3280/whatIf?api-version=2020-06-01", + "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuUmVzb3VyY2VzL2RlcGxveW1lbnRzL3BzMzI4MC93aGF0SWY/YXBpLXZlcnNpb249MjAyMC0wNi0wMQ==", + "RequestMethod": "POST", + "RequestBody": "{\r\n \"location\": \"westus\",\r\n \"properties\": {\r\n \"whatIfSettings\": {\r\n \"resultFormat\": \"FullResourcePayloads\"\r\n },\r\n \"template\": {\r\n \"$schema\": \"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#\",\r\n \"contentVersion\": \"1.0.0.0\",\r\n \"parameters\": {\r\n \"targetMG\": {\r\n \"type\": \"string\"\r\n },\r\n \"nestedsubId\": {\r\n \"type\": \"string\"\r\n },\r\n \"nestedRG\": {\r\n \"type\": \"string\"\r\n },\r\n \"storageAccountName\": {\r\n \"type\": \"string\"\r\n }\r\n },\r\n \"variables\": {\r\n \"mgScope\": \"[concat('/providers/Microsoft.Management/managementGroups/', parameters('targetMG'))]\"\r\n },\r\n \"resources\": [\r\n {\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"policy2\",\r\n \"apiVersion\": \"2016-12-01\",\r\n \"properties\": {\r\n \"policyType\": \"Custom\",\r\n \"parameters\": {},\r\n \"policyRule\": {\r\n \"if\": {\r\n \"field\": \"location\",\r\n \"equals\": \"northeurope\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n }\r\n },\r\n {\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"location-lock\",\r\n \"apiVersion\": \"2016-12-01\",\r\n \"dependsOn\": [\r\n \"policy2\"\r\n ],\r\n \"properties\": {\r\n \"scope\": \"[variables('mgScope')]\",\r\n \"policyDefinitionId\": \"[concat(variables('mgScope'), '/providers/', 'Microsoft.Authorization/policyDefinitions/', 'policy2')]\"\r\n }\r\n },\r\n {\r\n \"type\": \"Microsoft.Resources/deployments\",\r\n \"name\": \"ps_test_management_group_deployment\",\r\n \"apiVersion\": \"2018-05-01\",\r\n \"location\": \"West US\",\r\n \"subscriptionId\": \"[parameters('nestedSubId')]\",\r\n \"properties\": {\r\n \"template\": {\r\n \"$schema\": \"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#\",\r\n \"contentVersion\": \"1.0.0.0\",\r\n \"parameters\": {},\r\n \"variables\": {},\r\n \"resources\": [\r\n {\r\n \"type\": \"Microsoft.Resources/resourceGroups\",\r\n \"name\": \"[parameters('nestedRG')]\",\r\n \"apiVersion\": \"2018-05-01\",\r\n \"location\": \"East US 2\",\r\n \"properties\": {}\r\n },\r\n {\r\n \"type\": \"Microsoft.Resources/deployments\",\r\n \"name\": \"ps_test_management_group_deployment\",\r\n \"apiVersion\": \"2017-05-10\",\r\n \"resourceGroup\": \"[parameters('nestedRG')]\",\r\n \"dependsOn\": [\r\n \"[parameters('nestedRG')]\"\r\n ],\r\n \"properties\": {\r\n \"template\": {\r\n \"$schema\": \"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#\",\r\n \"contentVersion\": \"1.0.0.0\",\r\n \"parameters\": {},\r\n \"variables\": {},\r\n \"resources\": [\r\n {\r\n \"type\": \"Microsoft.Storage/storageAccounts\",\r\n \"name\": \"[parameters('storageAccountName')]\",\r\n \"apiVersion\": \"2015-06-15\",\r\n \"location\": \"East US\",\r\n \"properties\": {\r\n \"accountType\": \"Standard_LRS\"\r\n }\r\n }\r\n ]\r\n },\r\n \"mode\": \"Incremental\"\r\n }\r\n }\r\n ]\r\n },\r\n \"mode\": \"Incremental\"\r\n }\r\n }\r\n ]\r\n },\r\n \"parameters\": {\r\n \"nestedRG\": {\r\n \"value\": \"ps7396\"\r\n },\r\n \"nestedsubId\": {\r\n \"value\": \"a93e8c5c-63cb-4635-933f-6d166ac25187\"\r\n },\r\n \"targetMG\": {\r\n \"value\": \"myTestMG\"\r\n },\r\n \"storageAccountName\": {\r\n \"value\": \"ps3089\"\r\n }\r\n },\r\n \"mode\": \"Incremental\"\r\n }\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "1707a851-78f4-411c-be4b-49eb60c9d833" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.29017.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19041.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/3.9.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "4276" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Location": [ + "https://management.azure.com/providers/Microsoft.Resources/operationResults/eyJqb2JJZCI6IkRlcGxveW1lbnRXaGF0SWZKb2ItLVBTMzI4MC0yRTFCRjhDQzoyREM4NjI6MkQ0NzE3OjJEQjk3ODoyRDFERjg3ODZDQzNFMyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2020-06-01" + ], + "Retry-After": [ + "0" + ], + "x-ms-ratelimit-remaining-tenant-writes": [ + "1199" + ], + "x-ms-request-id": [ + "2e1bf8cc-c862-4717-b978-1df8786cc3e3" + ], + "x-ms-correlation-request-id": [ + "2e1bf8cc-c862-4717-b978-1df8786cc3e3" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200731T045313Z:2e1bf8cc-c862-4717-b978-1df8786cc3e3" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 31 Jul 2020 04:53:13 GMT" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 202 + }, + { + "RequestUri": "/providers/Microsoft.Resources/operationResults/eyJqb2JJZCI6IkRlcGxveW1lbnRXaGF0SWZKb2ItLVBTMzI4MC0yRTFCRjhDQzoyREM4NjI6MkQ0NzE3OjJEQjk3ODoyRDFERjg3ODZDQzNFMyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2020-06-01", + "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuUmVzb3VyY2VzL29wZXJhdGlvblJlc3VsdHMvZXlKcWIySkpaQ0k2SWtSbGNHeHZlVzFsYm5SWGFHRjBTV1pLYjJJdExWQlRNekk0TUMweVJURkNSamhEUXpveVJFTTROakk2TWtRME56RTNPakpFUWprM09Eb3lSREZFUmpnM09EWkRRek5GTXlJc0ltcHZZa3h2WTJGMGFXOXVJam9pZDJWemRIVnpJbjA/YXBpLXZlcnNpb249MjAyMC0wNi0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29017.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19041.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/3.9.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-tenant-reads": [ + "11999" + ], + "x-ms-request-id": [ + "dd17ce13-dc8e-47a3-a994-4451fb94b7a5" + ], + "x-ms-correlation-request-id": [ + "dd17ce13-dc8e-47a3-a994-4451fb94b7a5" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200731T045328Z:dd17ce13-dc8e-47a3-a994-4451fb94b7a5" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 31 Jul 2020 04:53:28 GMT" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "1730" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"status\": \"Succeeded\",\r\n \"properties\": {\r\n \"changes\": [\r\n {\r\n \"resourceId\": \"/providers/Microsoft.Authorization/policyAssignments/location-lock\",\r\n \"changeType\": \"Create\",\r\n \"after\": {\r\n \"apiVersion\": \"2016-12-01\",\r\n \"id\": \"/providers/Microsoft.Authorization/policyAssignments/location-lock\",\r\n \"name\": \"location-lock\",\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/providers/Microsoft.Management/managementGroups/myTestMG/providers/Microsoft.Authorization/policyDefinitions/policy2\",\r\n \"scope\": \"/providers/Microsoft.Management/managementGroups/myTestMG\"\r\n },\r\n \"type\": \"Microsoft.Authorization/policyAssignments\"\r\n }\r\n },\r\n {\r\n \"resourceId\": \"/providers/Microsoft.Authorization/policyDefinitions/policy2\",\r\n \"changeType\": \"Create\",\r\n \"after\": {\r\n \"apiVersion\": \"2016-12-01\",\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/policy2\",\r\n \"name\": \"policy2\",\r\n \"properties\": {\r\n \"policyRule\": {\r\n \"if\": {\r\n \"equals\": \"northeurope\",\r\n \"field\": \"location\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n },\r\n \"policyType\": \"Custom\"\r\n },\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\"\r\n }\r\n },\r\n {\r\n \"resourceId\": \"/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/resourceGroups/ps7396\",\r\n \"changeType\": \"Create\",\r\n \"after\": {\r\n \"apiVersion\": \"2018-05-01\",\r\n \"id\": \"/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/resourceGroups/ps7396\",\r\n \"location\": \"East US 2\",\r\n \"name\": \"ps7396\",\r\n \"type\": \"Microsoft.Resources/resourceGroups\"\r\n }\r\n },\r\n {\r\n \"resourceId\": \"/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/resourceGroups/ps7396/providers/Microsoft.Storage/storageAccounts/ps3089\",\r\n \"changeType\": \"Create\",\r\n \"after\": {\r\n \"apiVersion\": \"2015-06-15\",\r\n \"id\": \"/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/resourceGroups/ps7396/providers/Microsoft.Storage/storageAccounts/ps3089\",\r\n \"location\": \"East US\",\r\n \"name\": \"ps3089\",\r\n \"properties\": {\r\n \"accountType\": \"Standard_LRS\"\r\n },\r\n \"type\": \"Microsoft.Storage/storageAccounts\"\r\n }\r\n }\r\n ]\r\n }\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/providers/Microsoft.Resources/operationResults/eyJqb2JJZCI6IkRlcGxveW1lbnRXaGF0SWZKb2ItLVBTMzI4MC0yRTFCRjhDQzoyREM4NjI6MkQ0NzE3OjJEQjk3ODoyRDFERjg3ODZDQzNFMyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2020-06-01", + "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuUmVzb3VyY2VzL29wZXJhdGlvblJlc3VsdHMvZXlKcWIySkpaQ0k2SWtSbGNHeHZlVzFsYm5SWGFHRjBTV1pLYjJJdExWQlRNekk0TUMweVJURkNSamhEUXpveVJFTTROakk2TWtRME56RTNPakpFUWprM09Eb3lSREZFUmpnM09EWkRRek5GTXlJc0ltcHZZa3h2WTJGMGFXOXVJam9pZDJWemRIVnpJbjA/YXBpLXZlcnNpb249MjAyMC0wNi0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29017.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.19041.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/3.9.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-tenant-reads": [ + "11998" + ], + "x-ms-request-id": [ + "4127dcc0-de91-4fda-bd51-b7e1d198ce60" + ], + "x-ms-correlation-request-id": [ + "4127dcc0-de91-4fda-bd51-b7e1d198ce60" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200731T045329Z:4127dcc0-de91-4fda-bd51-b7e1d198ce60" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 31 Jul 2020 04:53:28 GMT" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "1730" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"status\": \"Succeeded\",\r\n \"properties\": {\r\n \"changes\": [\r\n {\r\n \"resourceId\": \"/providers/Microsoft.Authorization/policyAssignments/location-lock\",\r\n \"changeType\": \"Create\",\r\n \"after\": {\r\n \"apiVersion\": \"2016-12-01\",\r\n \"id\": \"/providers/Microsoft.Authorization/policyAssignments/location-lock\",\r\n \"name\": \"location-lock\",\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/providers/Microsoft.Management/managementGroups/myTestMG/providers/Microsoft.Authorization/policyDefinitions/policy2\",\r\n \"scope\": \"/providers/Microsoft.Management/managementGroups/myTestMG\"\r\n },\r\n \"type\": \"Microsoft.Authorization/policyAssignments\"\r\n }\r\n },\r\n {\r\n \"resourceId\": \"/providers/Microsoft.Authorization/policyDefinitions/policy2\",\r\n \"changeType\": \"Create\",\r\n \"after\": {\r\n \"apiVersion\": \"2016-12-01\",\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/policy2\",\r\n \"name\": \"policy2\",\r\n \"properties\": {\r\n \"policyRule\": {\r\n \"if\": {\r\n \"equals\": \"northeurope\",\r\n \"field\": \"location\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n },\r\n \"policyType\": \"Custom\"\r\n },\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\"\r\n }\r\n },\r\n {\r\n \"resourceId\": \"/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/resourceGroups/ps7396\",\r\n \"changeType\": \"Create\",\r\n \"after\": {\r\n \"apiVersion\": \"2018-05-01\",\r\n \"id\": \"/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/resourceGroups/ps7396\",\r\n \"location\": \"East US 2\",\r\n \"name\": \"ps7396\",\r\n \"type\": \"Microsoft.Resources/resourceGroups\"\r\n }\r\n },\r\n {\r\n \"resourceId\": \"/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/resourceGroups/ps7396/providers/Microsoft.Storage/storageAccounts/ps3089\",\r\n \"changeType\": \"Create\",\r\n \"after\": {\r\n \"apiVersion\": \"2015-06-15\",\r\n \"id\": \"/subscriptions/a93e8c5c-63cb-4635-933f-6d166ac25187/resourceGroups/ps7396/providers/Microsoft.Storage/storageAccounts/ps3089\",\r\n \"location\": \"East US\",\r\n \"name\": \"ps3089\",\r\n \"properties\": {\r\n \"accountType\": \"Standard_LRS\"\r\n },\r\n \"type\": \"Microsoft.Storage/storageAccounts\"\r\n }\r\n }\r\n ]\r\n }\r\n}", + "StatusCode": 200 + } + ], + "Names": { + "Test-WhatIfProviderNoRbacAtTenantScope": [ + "ps3280", + "ps7396", + "ps3089" + ] + }, + "Variables": { + "SubscriptionId": "a93e8c5c-63cb-4635-933f-6d166ac25187" + } +} \ No newline at end of file diff --git a/src/Resources/Resources/ChangeLog.md b/src/Resources/Resources/ChangeLog.md index 43b3aa9db872..3b82c5ff8a57 100644 --- a/src/Resources/Resources/ChangeLog.md +++ b/src/Resources/Resources/ChangeLog.md @@ -27,6 +27,7 @@ - `Set-AzResource` - `Remove-AzResource` - `Invoke-AzResourceAction` +* Added ValidationLevel Parameter to WhatIf and Validate cmdlets for deployments. ## Version 7.9.0 * Added `-ApplicationId` as an alias of `-ServicePrincipalName`.