diff --git a/src/Resources/ResourceManager/Entities/Policy/PolicyDefinitionProperties.cs b/src/Resources/ResourceManager/Entities/Policy/PolicyDefinitionProperties.cs index 6e3b3d38ad77..6a41c2dbfc3c 100644 --- a/src/Resources/ResourceManager/Entities/Policy/PolicyDefinitionProperties.cs +++ b/src/Resources/ResourceManager/Entities/Policy/PolicyDefinitionProperties.cs @@ -57,5 +57,11 @@ public class PolicyDefinitionProperties /// [JsonProperty(Required = Required.Default)] public string Mode { get; set; } + + /// + /// The policy type. + /// + [JsonProperty(Required = Required.Default)] + public PolicyType PolicyType { get; set; } } } diff --git a/src/Resources/ResourceManager/Entities/Policy/PolicySetDefinitionProperties.cs b/src/Resources/ResourceManager/Entities/Policy/PolicySetDefinitionProperties.cs index 7ce5fed83b5e..3b775c84b7f1 100644 --- a/src/Resources/ResourceManager/Entities/Policy/PolicySetDefinitionProperties.cs +++ b/src/Resources/ResourceManager/Entities/Policy/PolicySetDefinitionProperties.cs @@ -57,5 +57,11 @@ public class PolicySetDefinitionProperties /// [JsonProperty(Required = Required.Default)] public JArray PolicyDefinitionGroups { get; set; } + + /// + /// The policy type. + /// + [JsonProperty(Required = Required.Default)] + public PolicyType PolicyType { get; set; } } } diff --git a/src/Resources/ResourceManager/Entities/Policy/PolicyType.cs b/src/Resources/ResourceManager/Entities/Policy/PolicyType.cs new file mode 100644 index 000000000000..310a521a430f --- /dev/null +++ b/src/Resources/ResourceManager/Entities/Policy/PolicyType.cs @@ -0,0 +1,37 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.Policy +{ + /// + /// The policy assignment enforcement mode. + /// + public enum PolicyType + { + /// + /// The policy policy [set] definition is custom + /// + Custom, + + /// + /// The policy policy [set] definition is built in + /// + BuiltIn, + + /// + /// The policy policy definition is static + /// + Static + } +} diff --git a/src/Resources/ResourceManager/Extensions/JsonExtensions.cs b/src/Resources/ResourceManager/Extensions/JsonExtensions.cs index cc78c412bb0f..cf269a9f6154 100644 --- a/src/Resources/ResourceManager/Extensions/JsonExtensions.cs +++ b/src/Resources/ResourceManager/Extensions/JsonExtensions.cs @@ -23,6 +23,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions using System.Collections.Generic; using System.Globalization; using System.IO; + using System.Management.Automation; /// /// JSON extensions @@ -134,6 +135,50 @@ public static JToken ToJToken(this object obj) return null; } + if (obj is PSObject psObject) + { + var jObject = new JObject(); + if (psObject.BaseObject is object[] psArray) + { + var jArray = new JArray(); + foreach (var item in psArray) + { + jArray.Add(item.ToJToken()); + } + + return jArray; + } + + foreach (var property in psObject.Properties) + { + jObject.Add(new JProperty(property.Name, property.Value.ToJToken())); + } + + return jObject; + } + + if (obj is PSMemberInfoCollection psCollection) + { + var jObject = new JObject(); + foreach (var member in psCollection) + { + jObject.Add(new JProperty(member.Name, member.Value.ToJToken())); + } + + return jObject; + } + + if (obj is object[] objArray) + { + var jArray = new JArray(); + foreach (var item in objArray) + { + jArray.Add(item.ToJToken()); + } + + return jArray; + } + return JToken.FromObject(obj, JsonExtensions.JsonObjectTypeSerializer); } diff --git a/src/Resources/ResourceManager/Implementation/Policy/GetAzurePolicyAssignment.cs b/src/Resources/ResourceManager/Implementation/Policy/GetAzurePolicyAssignment.cs index 5c509acd2b71..a1634a6de7c2 100644 --- a/src/Resources/ResourceManager/Implementation/Policy/GetAzurePolicyAssignment.cs +++ b/src/Resources/ResourceManager/Implementation/Policy/GetAzurePolicyAssignment.cs @@ -25,7 +25,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation /// /// Gets the policy assignment. /// - [Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "PolicyAssignment", DefaultParameterSetName = PolicyCmdletBase.DefaultParameterSet), OutputType(typeof(PSObject))] + [Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "PolicyAssignment", DefaultParameterSetName = PolicyCmdletBase.DefaultParameterSet), OutputType(typeof(PsPolicyAssignment))] public class GetAzurePolicyAssignmentCmdlet : PolicyCmdletBase { /// @@ -84,7 +84,7 @@ private void RunCmdlet() getFirstPage: () => this.GetResources(), getNextPage: nextLink => this.GetNextLink(nextLink), cancellationToken: this.CancellationToken, - action: resources => this.WriteObject(sendToPipeline: this.GetOutputObjects("PolicyAssignmentId", resources), enumerateCollection: true)); + action: resources => this.WriteObject(sendToPipeline: this.GetOutputPolicyAssignments(resources), enumerateCollection: true)); } /// diff --git a/src/Resources/ResourceManager/Implementation/Policy/GetAzurePolicyDefinition.cs b/src/Resources/ResourceManager/Implementation/Policy/GetAzurePolicyDefinition.cs index e352ce4a2e93..b29a2fcf9f26 100644 --- a/src/Resources/ResourceManager/Implementation/Policy/GetAzurePolicyDefinition.cs +++ b/src/Resources/ResourceManager/Implementation/Policy/GetAzurePolicyDefinition.cs @@ -27,7 +27,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation /// /// Gets the policy definition. /// - [Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "PolicyDefinition", DefaultParameterSetName = PolicyCmdletBase.NameParameterSet), OutputType(typeof(PSObject))] + [Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "PolicyDefinition", DefaultParameterSetName = PolicyCmdletBase.NameParameterSet), OutputType(typeof(PsPolicyDefinition))] public class GetAzurePolicyDefinitionCmdlet : PolicyCmdletBase { /// @@ -97,7 +97,7 @@ private void RunCmdlet() getFirstPage: () => this.GetResources(listFilter), getNextPage: nextLink => this.GetNextLink(nextLink), cancellationToken: this.CancellationToken, - action: resources => this.WriteObject(sendToPipeline: this.GetFilteredOutputObjects("PolicyDefinitionId", listFilter, resources), enumerateCollection: true)); + action: resources => this.WriteObject(sendToPipeline: this.GetFilteredOutputPolicyDefinitions(listFilter, resources), enumerateCollection: true)); } /// diff --git a/src/Resources/ResourceManager/Implementation/Policy/GetAzurePolicySetDefinition.cs b/src/Resources/ResourceManager/Implementation/Policy/GetAzurePolicySetDefinition.cs index 335423264b12..aa6d4de940e7 100644 --- a/src/Resources/ResourceManager/Implementation/Policy/GetAzurePolicySetDefinition.cs +++ b/src/Resources/ResourceManager/Implementation/Policy/GetAzurePolicySetDefinition.cs @@ -27,7 +27,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation /// /// Gets the policy set definition. /// - [Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "PolicySetDefinition", DefaultParameterSetName = PolicyCmdletBase.NameParameterSet), OutputType(typeof(PSObject))] + [Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "PolicySetDefinition", DefaultParameterSetName = PolicyCmdletBase.NameParameterSet), OutputType(typeof(PsPolicySetDefinition))] public class GetAzurePolicySetDefinitionCmdlet : PolicyCmdletBase { /// @@ -97,7 +97,7 @@ private void RunCmdlet() getFirstPage: () => this.GetResources(listFilter), getNextPage: nextLink => this.GetNextLink(nextLink), cancellationToken: this.CancellationToken, - action: resources => this.WriteObject(sendToPipeline: this.GetFilteredOutputObjects("PolicySetDefinitionId", listFilter, resources), enumerateCollection: true)); + action: resources => this.WriteObject(sendToPipeline: this.GetFilteredOutputPolicySetDefinitions(listFilter, resources), enumerateCollection: true)); } /// diff --git a/src/Resources/ResourceManager/Implementation/Policy/NewAzurePolicyAssignment.cs b/src/Resources/ResourceManager/Implementation/Policy/NewAzurePolicyAssignment.cs index c1b7a17ab53a..a4f816bff7cd 100644 --- a/src/Resources/ResourceManager/Implementation/Policy/NewAzurePolicyAssignment.cs +++ b/src/Resources/ResourceManager/Implementation/Policy/NewAzurePolicyAssignment.cs @@ -29,7 +29,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation /// /// Creates a policy assignment. /// - [Cmdlet("New", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "PolicyAssignment", DefaultParameterSetName = PolicyCmdletBase.DefaultParameterSet), OutputType(typeof(PSObject))] + [Cmdlet("New", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "PolicyAssignment", DefaultParameterSetName = PolicyCmdletBase.DefaultParameterSet), OutputType(typeof(PsPolicyAssignment))] public class NewAzurePolicyAssignmentCmdlet : PolicyCmdletBase, IDynamicParameters { private readonly RuntimeDefinedParameterDictionary dynamicParameters = new RuntimeDefinedParameterDictionary(); @@ -76,7 +76,7 @@ public class NewAzurePolicyAssignmentCmdlet : PolicyCmdletBase, IDynamicParamete [Parameter(ParameterSetName = PolicyCmdletBase.DefaultParameterSet, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = PolicyHelpStrings.NewPolicyAssignmentPolicyDefinitionHelp)] [Parameter(ParameterSetName = PolicyCmdletBase.PolicyParameterObjectParameterSet, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = PolicyHelpStrings.NewPolicyAssignmentPolicyDefinitionHelp)] [Parameter(ParameterSetName = PolicyCmdletBase.PolicyParameterStringParameterSet, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = PolicyHelpStrings.NewPolicyAssignmentPolicyDefinitionHelp)] - public PSObject PolicyDefinition { get; set; } + public PsPolicyDefinition PolicyDefinition { get; set; } /// /// Gets or sets the policy assignment policy set definition parameter. @@ -85,7 +85,7 @@ public class NewAzurePolicyAssignmentCmdlet : PolicyCmdletBase, IDynamicParamete [Parameter(ParameterSetName = PolicyCmdletBase.DefaultParameterSet, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = PolicyHelpStrings.NewPolicyAssignmentPolicySetDefinitionHelp)] [Parameter(ParameterSetName = PolicyCmdletBase.PolicySetParameterObjectParameterSet, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = PolicyHelpStrings.NewPolicyAssignmentPolicySetDefinitionHelp)] [Parameter(ParameterSetName = PolicyCmdletBase.PolicySetParameterStringParameterSet, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = PolicyHelpStrings.NewPolicyAssignmentPolicySetDefinitionHelp)] - public PSObject PolicySetDefinition { get; set; } + public PsPolicySetDefinition PolicySetDefinition { get; set; } /// /// Gets or sets the policy assignment policy parameter object. @@ -140,12 +140,12 @@ protected override void OnProcessRecord() throw new PSInvalidOperationException("Only one of PolicyDefinition or PolicySetDefinition can be specified, not both."); } - if (this.PolicyDefinition != null && this.PolicyDefinition.Properties["policyDefinitionId"] == null) + if (this.PolicyDefinition != null && this.PolicyDefinition.PolicyDefinitionId == null) { throw new PSInvalidOperationException("The supplied PolicyDefinition object is invalid."); } - if (this.PolicySetDefinition != null && this.PolicySetDefinition.Properties["policySetDefinitionId"] == null) + if (this.PolicySetDefinition != null && this.PolicySetDefinition.PolicySetDefinitionId == null) { throw new PSInvalidOperationException("The supplied PolicySetDefinition object is invalid."); } @@ -173,7 +173,7 @@ protected override void OnProcessRecord() var result = this.GetLongRunningOperationTracker(activityName: activity, isResourceCreateOrUpdate: true) .WaitOnOperation(operationResult: operationResult); - this.WriteObject(this.GetOutputObjects("PolicyAssignmentId", JObject.Parse(result)), enumerateCollection: true); + this.WriteObject(this.GetOutputPolicyAssignments(JObject.Parse(result)), enumerateCollection: true); } /// @@ -208,11 +208,11 @@ private JToken GetResource() if (this.PolicyDefinition != null) { - policyassignmentObject.Properties.PolicyDefinitionId = this.PolicyDefinition.Properties["policyDefinitionId"].Value.ToString(); + policyassignmentObject.Properties.PolicyDefinitionId = this.PolicyDefinition.PolicyDefinitionId; } else if (this.PolicySetDefinition != null) { - policyassignmentObject.Properties.PolicyDefinitionId = this.PolicySetDefinition.Properties["policySetDefinitionId"].Value.ToString(); + policyassignmentObject.Properties.PolicyDefinitionId = this.PolicySetDefinition.PolicySetDefinitionId; } return policyassignmentObject.ToJToken(); @@ -223,11 +223,11 @@ object IDynamicParameters.GetDynamicParameters() PSObject parameters = null; if (this.PolicyDefinition != null) { - parameters = this.PolicyDefinition.GetPSObjectProperty("Properties.parameters") as PSObject; + parameters = this.PolicyDefinition.Properties.Parameters; } else if (this.PolicySetDefinition != null) { - parameters = this.PolicySetDefinition.GetPSObjectProperty("Properties.parameters") as PSObject; + parameters = this.PolicySetDefinition.Properties.Parameters; } if (parameters != null) diff --git a/src/Resources/ResourceManager/Implementation/Policy/NewAzurePolicyDefinition.cs b/src/Resources/ResourceManager/Implementation/Policy/NewAzurePolicyDefinition.cs index 3ca41e850f68..4118e56a4c64 100644 --- a/src/Resources/ResourceManager/Implementation/Policy/NewAzurePolicyDefinition.cs +++ b/src/Resources/ResourceManager/Implementation/Policy/NewAzurePolicyDefinition.cs @@ -26,7 +26,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation /// /// Creates the new policy definition. /// - [Cmdlet("New", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "PolicyDefinition", DefaultParameterSetName = PolicyCmdletBase.NameParameterSet), OutputType(typeof(PSObject))] + [Cmdlet("New", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "PolicyDefinition", DefaultParameterSetName = PolicyCmdletBase.NameParameterSet), OutputType(typeof(PsPolicyDefinition))] public class NewAzurePolicyDefinitionCmdlet : PolicyCmdletBase { /// @@ -121,8 +121,7 @@ protected override void OnProcessRecord() var activity = string.Format("PUT {0}", managementUri.PathAndQuery); var result = this.GetLongRunningOperationTracker(activityName: activity, isResourceCreateOrUpdate: true) .WaitOnOperation(operationResult: operationResult); - - this.WriteObject(this.GetOutputObjects("PolicyDefinitionId", JObject.Parse(result)), enumerateCollection: true); + this.WriteObject(this.GetOutputPolicyDefinitions(JObject.Parse(result)), enumerateCollection: true); } /// diff --git a/src/Resources/ResourceManager/Implementation/Policy/NewAzurePolicySetDefinition.cs b/src/Resources/ResourceManager/Implementation/Policy/NewAzurePolicySetDefinition.cs index c567f4c5d7c6..959c60f3e6a3 100644 --- a/src/Resources/ResourceManager/Implementation/Policy/NewAzurePolicySetDefinition.cs +++ b/src/Resources/ResourceManager/Implementation/Policy/NewAzurePolicySetDefinition.cs @@ -25,7 +25,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation /// /// Creates the policy set definition. /// - [Cmdlet("New", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "PolicySetDefinition", DefaultParameterSetName = PolicyCmdletBase.NameParameterSet, SupportsShouldProcess = true), OutputType(typeof(PSObject))] + [Cmdlet("New", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "PolicySetDefinition", DefaultParameterSetName = PolicyCmdletBase.NameParameterSet, SupportsShouldProcess = true), OutputType(typeof(PsPolicySetDefinition))] public class NewAzurePolicySetDefinitionCmdlet : PolicyCmdletBase { /// @@ -123,7 +123,7 @@ protected override void OnProcessRecord() var result = this.GetLongRunningOperationTracker(activityName: activity, isResourceCreateOrUpdate: true) .WaitOnOperation(operationResult: operationResult); - this.WriteObject(this.GetOutputObjects("PolicySetDefinitionId", JObject.Parse(result)), enumerateCollection: true); + this.WriteObject(this.GetOutputPolicySetDefinitions(JObject.Parse(result)), enumerateCollection: true); } } diff --git a/src/Resources/ResourceManager/Implementation/Policy/PolicyCmdletBase.cs b/src/Resources/ResourceManager/Implementation/Policy/PolicyCmdletBase.cs index cb43b00e10b3..5c1e0991e7ab 100644 --- a/src/Resources/ResourceManager/Implementation/Policy/PolicyCmdletBase.cs +++ b/src/Resources/ResourceManager/Implementation/Policy/PolicyCmdletBase.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation { using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions; + using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.Policy; using Microsoft.Azure.Commands.ResourceManager.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Newtonsoft.Json.Linq; @@ -46,6 +47,7 @@ public enum ListFilter protected const string IdParameterSet = "IdParameterSet"; protected const string NameParameterSet = "NameParameterSet"; protected const string SubscriptionIdParameterSet = "SubscriptionIdParameterSet"; + protected const string InputObjectParameterSet = "InputObjectParameterSet"; protected const string ManagementGroupNameParameterSet = "ManagementGroupNameParameterSet"; protected const string IncludeDescendentParameterSet = "IncludeDescendentParameterSet"; protected const string BuiltinFilterParameterSet = "BuiltinFilterParameterSet"; @@ -66,51 +68,89 @@ public enum ListFilter protected const string PolicyTypeFilterFormat = "$filter=PolicyType eq '{0}'"; /// - /// Converts the resource object to specified resource type object. + /// Converts the resource object collection to a PsPolicyAssignment collection. /// /// The resource type of the objects to create /// The policy definition resource object. - protected PSObject[] GetOutputObjects(string resourceType, params JToken[] resources) + protected PsPolicyAssignment[] GetOutputPolicyAssignments(params JToken[] resources) { return resources .CoalesceEnumerable() .Where(resource => resource != null) - .SelectArray(resource => - { - var psobject = resource.ToResource().ToPsObject(); - psobject.Properties.Add(new PSNoteProperty(resourceType, psobject.Properties["ResourceId"].Value)); - return psobject; - }); + .SelectArray(resource => new PsPolicyAssignment(resource)); + } + + /// + /// Converts the resource object collection to a PsPolicyDefinition collection. + /// + /// The policy definition resource object. + protected PsPolicyDefinition[] GetOutputPolicyDefinitions(params JToken[] resources) + { + return resources + .CoalesceEnumerable() + .Where(resource => resource != null) + .SelectArray(resource => new PsPolicyDefinition(resource)); + } + + /// + /// Converts the resource object collection to a PsPolicySetDefinition collection. + /// + /// The policy definition resource object. + protected PsPolicySetDefinition[] GetOutputPolicySetDefinitions(params JToken[] resources) + { + return resources + .CoalesceEnumerable() + .Where(resource => resource != null) + .SelectArray(resource => new PsPolicySetDefinition(resource)); } /// - /// Converts the resource object collection to a filtered PSObject array. + /// Converts the resource object collection to a filtered PsPolicyDefinition array. /// - /// The resource type of the input objects /// the filter /// The policy definition resource object. - protected PSObject[] GetFilteredOutputObjects(string resourceType, ListFilter filter, params JObject[] resources) + protected PsPolicyDefinition[] GetFilteredOutputPolicyDefinitions(ListFilter filter, params JToken[] resources) { - Func filterLambda = (result) => + Func filterLambda = (result) => { if (filter == ListFilter.None) { return true; } - var policyType = ((PSObject)result.Properties["Properties"].Value).Properties["policyType"].Value; - return policyType == null || string.Equals(policyType.ToString(), filter.ToString(), StringComparison.OrdinalIgnoreCase); + var policyType = result.Properties.PolicyType; + return string.Equals(policyType.ToString(), filter.ToString(), StringComparison.OrdinalIgnoreCase); }; return resources .CoalesceEnumerable() .Where(resource => resource != null) - .SelectArray(resource => + .SelectArray(resource => new PsPolicyDefinition(resource)) + .Where(filterLambda).ToArray(); + } + + /// + /// Converts the resource object collection to a filtered PsPolicySetDefinition array. + /// + /// the filter + /// The policy definition resource object. + protected PsPolicySetDefinition[] GetFilteredOutputPolicySetDefinitions(ListFilter filter, params JObject[] resources) + { + Func filterLambda = (result) => + { + if (filter == ListFilter.None) { - var psobject = resource.ToResource().ToPsObject(); - psobject.Properties.Add(new PSNoteProperty(resourceType, psobject.Properties["ResourceId"].Value)); - return psobject; - }) + return true; + } + + var policyType = result.Properties.PolicyType; + return string.Equals(policyType.ToString(), filter.ToString(), StringComparison.OrdinalIgnoreCase); + }; + + return resources + .CoalesceEnumerable() + .Where(resource => resource != null) + .SelectArray(resource => new PsPolicySetDefinition(resource)) .Where(filterLambda).ToArray(); } diff --git a/src/Resources/ResourceManager/Implementation/Policy/PolicyHelpStrings.cs b/src/Resources/ResourceManager/Implementation/Policy/PolicyHelpStrings.cs index 619a1dc69b0c..7afe0f6ac54c 100644 --- a/src/Resources/ResourceManager/Implementation/Policy/PolicyHelpStrings.cs +++ b/src/Resources/ResourceManager/Implementation/Policy/PolicyHelpStrings.cs @@ -40,6 +40,7 @@ public static class PolicyHelpStrings public const string RemovePolicyAssignmentNameHelp = "The name of the policy assignment to delete."; public const string RemovePolicyAssignmentScopeHelp = "The scope of the policy assignment to delete, e.g. /providers/managementGroups/{managementGroupName}, defaults to current subscription."; public const string RemovePolicyAssignmentIdHelp = "The fully qualified policy assignment ID to delete, including the scope, e.g. /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}."; + public const string RemovePolicyAssignmentInputObjectHelp = "The policy assignment object to remove that was output from another cmdlet."; public const string SetPolicyAssignmentNameHelp = "The name of the policy assignment to update."; public const string SetPolicyAssignmentScopeHelp = "The scope of the policy assignment to update, e.g. /providers/managementGroups/{managementGroupName}, defaults to current subscription."; public const string SetPolicyAssignmentNotScopesHelp = "The not scopes of the updated policy assignment."; @@ -50,6 +51,7 @@ public static class PolicyHelpStrings public const string SetPolicyAssignmentPolicyParameterObjectHelp = "The new policy parameters object for the policy assignment."; public const string SetPolicyParameterHelp = "The new policy parameters file path or string for the policy assignment."; public const string SetPolicyAssignmentSkuHelp = "A hash table which specifies sku properties. This parameter is deprecated and ignored."; + public const string SetPolicyAssignmentInputObjectHelp = "The policy assignment object to update that was output from another cmdlet."; public const string PolicyAssignmentAssignIdentityHelp = "Generate and assign an Azure Active Directory Identity for this policy assignment. The identity will be used when executing deployments for 'deployIfNotExists' policies. Location is required when assigning an identity."; public const string PolicyAssignmentLocationHelp = "The location of the policy assignment's resource identity. This is required when the -AssignIdentity switch is used."; @@ -73,6 +75,7 @@ public static class PolicyHelpStrings public const string NewPolicyDefinitionSubscriptionIdHelp = "The subscription ID of the new policy definition."; public const string RemovePolicyDefinitionNameHelp = "The name of the policy definition to delete."; public const string RemovePolicyDefinitionIdHelp = "The fully qualified policy definition ID to delete, including the subscription or management group. e.g. /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}."; + public const string RemovePolicyDefinitionInputObjectHelp = "The policy definition object to remove that was output from another cmdlet."; public const string ForceFlagHelp = "Do not ask for confirmation."; public const string RemovePolicyDefinitionManagementGroupHelp = "The name of the management group of the policy definition to delete."; public const string RemovePolicyDefinitionSubscriptionIdHelp = "The subscription ID of the policy definition to delete."; @@ -85,6 +88,7 @@ public static class PolicyHelpStrings public const string SetPolicyDefinitionParameterHelp = "The parameters declaration of the updated policy definition. This can either be a path to a file or uri containing the parameters JSON declaration, or the parameters declaration as a JSON string."; public const string SetPolicyDefinitionManagementGroupHelp = "The name of the management group of the policy definition to update."; public const string SetPolicyDefinitionSubscriptionIdHelp = "The subscription ID of the policy definition to update."; + public const string SetPolicyDefinitionInputObjectHelp = "The policy definition object to update that was output from another cmdlet."; /// /// Policy set definition cmdlet parameter help strings @@ -106,6 +110,7 @@ public static class PolicyHelpStrings public const string NewPolicySetDefinitionSubscriptionIdHelp = "The subscription ID of the new policy set definition."; public const string RemovePolicySetDefinitionNameHelp = "The policy set definition name to delete."; public const string RemovePolicySetDefinitionIdHelp = "The fully qualified policy set definition ID to delete, including the subscription or management group. e.g. /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}."; + public const string RemovePolicySetDefinitionInputObjectHelp = "The policy set definition object to remove that was output from another cmdlet."; public const string RemovePolicySetDefinitionManagementGroupHelp = "The name of the management group of the policy set definition to delete."; public const string RemovePolicySetDefinitionSubscriptionIdHelp = "The subscription ID of the policy set definition to delete."; public const string SetPolicySetDefinitionNameHelp = "The name of the policy set definition to update."; @@ -118,5 +123,6 @@ public static class PolicyHelpStrings public const string SetPolicySetDefinitionParameterHelp = "The parameters declaration of the updated policy set definition. This can either be a path to a file or uri containing the parameters JSON declaration, or the parameters declaration as a JSON string."; public const string SetPolicySetDefinitionManagementGroupHelp = "The name of the management group of the policy set definition to update."; public const string SetPolicySetDefinitionSubscriptionIdHelp = "The subscription ID of the policy set definition to update."; + public const string SetPolicySetDefinitionInputObjectHelp = "The policy set definition object to update that was output from another cmdlet."; } } diff --git a/src/Resources/ResourceManager/Implementation/Policy/PsPolicyAssignment.cs b/src/Resources/ResourceManager/Implementation/Policy/PsPolicyAssignment.cs new file mode 100644 index 000000000000..5f75106d116f --- /dev/null +++ b/src/Resources/ResourceManager/Implementation/Policy/PsPolicyAssignment.cs @@ -0,0 +1,43 @@ +namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.Policy +{ + using System.Management.Automation; + + using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components; + using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions; + + using Newtonsoft.Json.Linq; + + /// + /// Class that wraps a policy definition PSObject + /// + public class PsPolicyAssignment + { + public PsPolicyAssignment(JToken input) + { + var resource = input.ToResource(); + Identity = resource.Identity?.ToJToken().ToPsObject(); + Location = resource.Location; + Name = resource.Name; + PolicyAssignmentId = resource.Id; + Properties = new PsPolicyAssignmentProperties(resource.Properties); + ResourceId = resource.Id; + ResourceName = resource.Name; + ResourceGroupName = string.IsNullOrEmpty(resource.Id) ? null : ResourceIdUtility.GetResourceGroupName(resource.Id); + ResourceType = resource.Type; + Sku = resource.Sku?.ToJToken().ToPsObject(); + SubscriptionId = string.IsNullOrEmpty(resource.Id) ? null : ResourceIdUtility.GetSubscriptionId(resource.Id); + } + + public PSObject Identity { get; set; } + public string Location { get; set; } + public string Name { get; set; } + public string ResourceId { get; set; } + public string ResourceName { get; set; } + public string ResourceGroupName { get; set; } + public string ResourceType { get; set; } + public string SubscriptionId { get; set; } + public PSObject Sku { get; set; } + public string PolicyAssignmentId { get; set; } + public PsPolicyAssignmentProperties Properties { get; set; } + } +} diff --git a/src/Resources/ResourceManager/Implementation/Policy/PsPolicyAssignmentEnforcementMode.cs b/src/Resources/ResourceManager/Implementation/Policy/PsPolicyAssignmentEnforcementMode.cs new file mode 100644 index 000000000000..57b279379a9f --- /dev/null +++ b/src/Resources/ResourceManager/Implementation/Policy/PsPolicyAssignmentEnforcementMode.cs @@ -0,0 +1,32 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.Policy +{ + /// + /// The policy assignment enforcement mode. + /// + public enum PsPolicyAssignmentEnforcementMode + { + /// + /// The policy effect is enforced during resource creation or update. + /// + Default, + + /// + /// The policy effect is not enforced during resource creation or update. + /// + DoNotEnforce + } +} diff --git a/src/Resources/ResourceManager/Implementation/Policy/PsPolicyAssignmentProperties.cs b/src/Resources/ResourceManager/Implementation/Policy/PsPolicyAssignmentProperties.cs new file mode 100644 index 000000000000..10298d895ff4 --- /dev/null +++ b/src/Resources/ResourceManager/Implementation/Policy/PsPolicyAssignmentProperties.cs @@ -0,0 +1,115 @@ +namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.Policy +{ + using System.Management.Automation; + + using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.Policy; + using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions; + + using Newtonsoft.Json.Linq; + + /// + /// The policy assignment properties. + /// + public class PsPolicyAssignmentProperties + { + public PsPolicyAssignmentProperties(JToken input) + { + var properties = input.ToObject(JsonExtensions.JsonMediaTypeSerializer); + Scope = properties.Scope; + NotScopes = properties.NotScopes; + DisplayName = properties.DisplayName; + Description = properties.Description; + Metadata = properties.Metadata.ToPsObject(); + EnforcementMode = (PsPolicyAssignmentEnforcementMode)properties.EnforcementMode; + PolicyDefinitionId = properties.PolicyDefinitionId; + Parameters = properties.Parameters.ToPsObject(); + } + + /// + /// The scope. + /// + public string Scope { get; set; } + + /// + /// The not scopes array. + /// + public string[] NotScopes { get; set; } + + /// + /// The display name. + /// + public string DisplayName { get; set; } + + /// + /// The description. + /// + public string Description { get; set; } + + /// + /// The policy assignment metadata. + /// + public PSObject Metadata { get; set; } + + /// + /// The policy assignment enforcement mode. + /// + public PsPolicyAssignmentEnforcementMode? EnforcementMode { get; set; } + + /// + /// The policy definition id. + /// + public string PolicyDefinitionId { get; set; } + + /// + /// The parameter values. + /// + public PSObject Parameters { get; set; } + + /// + /// Convert to JSON + /// + /// JSON representatnion of policy assignment properties + public JToken ToJToken() + { + var returnValue = new JObject(); + if (this.Scope != null) + { + returnValue["scope"] = this.Scope; + } + + if (this.NotScopes != null) + { + returnValue["notScopes"] = this.NotScopes.ToJToken(); + } + + if (this.DisplayName != null) + { + returnValue["displayName"] = this.DisplayName; + } + + if (this.Description != null) + { + returnValue["description"] = this.Description; + } + + if (this.Metadata != null) + { + returnValue["metaData"] = this.Metadata.ToJToken(); + } + + returnValue["enforcementMode"] = this.EnforcementMode.ToString(); + + if (this.PolicyDefinitionId != null) + { + returnValue["policyDefinitionId"] = this.PolicyDefinitionId; + } + + if (this.Parameters != null) + { + returnValue["parameters"] = this.Parameters.ToJToken(); + } + + return returnValue; + } + } +} diff --git a/src/Resources/ResourceManager/Implementation/Policy/PsPolicyDefinition.cs b/src/Resources/ResourceManager/Implementation/Policy/PsPolicyDefinition.cs new file mode 100644 index 000000000000..60f2c751c4b3 --- /dev/null +++ b/src/Resources/ResourceManager/Implementation/Policy/PsPolicyDefinition.cs @@ -0,0 +1,33 @@ +namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.Policy +{ + using System.Management.Automation; + using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components; + using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions; + using Newtonsoft.Json.Linq; + + /// + /// Class that wraps a policy definition PSObject + /// + public class PsPolicyDefinition + { + public PsPolicyDefinition(JToken input) + { + var resource = input.ToResource(); + Name = resource.Name; + PolicyDefinitionId = resource.Id; + Properties = new PsPolicyDefinitionProperties(resource.Properties); + ResourceId = resource.Id; + ResourceName = resource.Name; + ResourceType = resource.Type; + SubscriptionId = string.IsNullOrEmpty(resource.Id) ? null : ResourceIdUtility.GetSubscriptionId(resource.Id); + } + + public string Name { get; set; } + public string ResourceId { get; set; } + public string ResourceName { get; set; } + public string ResourceType { get; set; } + public string SubscriptionId { get; set; } + public PsPolicyDefinitionProperties Properties { get; set; } + public string PolicyDefinitionId { get; set; } + } +} diff --git a/src/Resources/ResourceManager/Implementation/Policy/PsPolicyDefinitionProperties.cs b/src/Resources/ResourceManager/Implementation/Policy/PsPolicyDefinitionProperties.cs new file mode 100644 index 000000000000..44caad3f88d6 --- /dev/null +++ b/src/Resources/ResourceManager/Implementation/Policy/PsPolicyDefinitionProperties.cs @@ -0,0 +1,116 @@ +namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.Policy +{ + using System.Management.Automation; + using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.Policy; + using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions; + using Newtonsoft.Json.Linq; + + /// + /// The policy assignment properties. + /// + public class PsPolicyDefinitionProperties + { + public static PsPolicyType PolicyTypeToPsPolicyType(PolicyType policyType) + { + switch (policyType) + { + case Entities.Policy.PolicyType.BuiltIn: + return PsPolicyType.BuiltIn; + case Entities.Policy.PolicyType.Custom: + return PsPolicyType.Custom; + case Entities.Policy.PolicyType.Static: + return PsPolicyType.Static; + default: + return PsPolicyType.None; + } + } + + public PsPolicyDefinitionProperties(JToken input) + { + var properties = input.ToObject(JsonExtensions.JsonMediaTypeSerializer); + Description = properties.Description; + DisplayName = properties.DisplayName; + Metadata = properties.Metadata.ToPsObject(); + Mode = properties.Mode; + Parameters = properties.Parameters.ToPsObject(); + PolicyRule = properties.PolicyRule.ToPsObject(); + PolicyType = PsPolicyDefinitionProperties.PolicyTypeToPsPolicyType(properties.PolicyType); + } + + /// + /// The description. + /// + public string Description { get; set; } + + /// + /// The display name. + /// + public string DisplayName { get; set; } + + /// + /// The policy definition metadata. + /// + public PSObject Metadata { get; set; } + + /// + /// The mode. + /// + public string Mode { get; set; } + + /// + /// The parameters declaration. + /// + public PSObject Parameters { get; set; } + + /// + /// The policy rule. + /// + public PSObject PolicyRule { get; set; } + + /// + /// The policy type. + /// + public PsPolicyType PolicyType { get; set; } + + /// + /// Convert to JSON + /// + /// JSON representatnion of policy definition properties + public JToken ToJToken() + { + var returnValue = new JObject(); + if (this.Description != null) + { + returnValue["description"] = this.Description; + } + + if (this.DisplayName != null) + { + returnValue["displayName"] = this.DisplayName; + } + + if (this.Metadata != null) + { + returnValue["metaData"] = this.Metadata.ToJToken(); + } + + if (this.Mode != null) + { + returnValue["mode"] = this.Mode.ToString(); + } + + if (this.Parameters != null) + { + returnValue["parameters"] = this.Parameters.ToJToken(); + } + + if (this.PolicyRule != null) + { + returnValue["policyRule"] = this.PolicyRule.ToJToken(); + } + + returnValue["policyType"] = this.PolicyType.ToString(); + return returnValue; + } + } +} diff --git a/src/Resources/ResourceManager/Implementation/Policy/PsPolicySetDefinition.cs b/src/Resources/ResourceManager/Implementation/Policy/PsPolicySetDefinition.cs new file mode 100644 index 000000000000..57f7bea915b0 --- /dev/null +++ b/src/Resources/ResourceManager/Implementation/Policy/PsPolicySetDefinition.cs @@ -0,0 +1,33 @@ +namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.Policy +{ + using System.Management.Automation; + using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components; + using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions; + using Newtonsoft.Json.Linq; + + /// + /// Class that wraps a policy definition PSObject + /// + public class PsPolicySetDefinition + { + public PsPolicySetDefinition(JToken input) + { + var resource = input.ToResource(); + Name = resource.Name; + PolicySetDefinitionId = resource.Id; + Properties = new PsPolicySetDefinitionProperties(resource.Properties); + ResourceId = resource.Id; + ResourceName = resource.Name; + ResourceType = resource.Type; + SubscriptionId = string.IsNullOrEmpty(resource.Id) ? null : ResourceIdUtility.GetSubscriptionId(resource.Id); + } + + public string Name { get; set; } + public string ResourceId { get; set; } + public string ResourceName { get; set; } + public string ResourceType { get; set; } + public string SubscriptionId { get; set; } + public string PolicySetDefinitionId { get; set; } + public PsPolicySetDefinitionProperties Properties { get; set; } + } +} diff --git a/src/Resources/ResourceManager/Implementation/Policy/PsPolicySetDefinitionProperties.cs b/src/Resources/ResourceManager/Implementation/Policy/PsPolicySetDefinitionProperties.cs new file mode 100644 index 000000000000..3b3905e2dc94 --- /dev/null +++ b/src/Resources/ResourceManager/Implementation/Policy/PsPolicySetDefinitionProperties.cs @@ -0,0 +1,102 @@ +namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.Policy +{ + using System.Management.Automation; + using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.Policy; + using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions; + + using Newtonsoft.Json.Linq; + + /// + /// The policy assignment properties. + /// + public class PsPolicySetDefinitionProperties + { + public PsPolicySetDefinitionProperties(JToken input) + { + var properties = input.ToObject(JsonExtensions.JsonMediaTypeSerializer); + Description = properties.Description; + DisplayName = properties.DisplayName; + Metadata = properties.Metadata.ToPsObject(); + Parameters = properties.Parameters.ToPsObject(); + PolicyDefinitionGroups = properties.PolicyDefinitionGroups.ToPsObject(); + PolicyDefinitions = properties.PolicyDefinitions.ToPsObject(); + PolicyType = PsPolicyDefinitionProperties.PolicyTypeToPsPolicyType(properties.PolicyType); + } + + /// + /// The description. + /// + public string Description { get; set; } + + /// + /// The display name. + /// + public string DisplayName { get; set; } + + /// + /// The policy set definition metadata. + /// + public PSObject Metadata { get; set; } + + /// + /// The parameters declaration. + /// + public PSObject Parameters { get; set; } + + /// + /// The policy definition groups. + /// + public PSObject PolicyDefinitionGroups { get; set; } + + /// + /// The policy reference. + /// + public PSObject PolicyDefinitions { get; set; } + + /// + /// The policy type. + /// + public PsPolicyType PolicyType { get; set; } + + /// + /// Convert to JSON + /// + /// JSON representatnion of policy set definition properties + public JToken ToJToken() + { + var returnValue = new JObject(); + if (this.Description != null) + { + returnValue["description"] = this.Description; + } + + if (this.DisplayName != null) + { + returnValue["displayName"] = this.DisplayName; + } + + if (this.Metadata != null) + { + returnValue["metaData"] = this.Metadata.ToJToken(); + } + + if (this.Parameters != null) + { + returnValue["parameters"] = this.Parameters.ToJToken(); + } + + if (this.PolicyDefinitionGroups != null) + { + returnValue["policyDefinitionGroups"] = this.PolicyDefinitionGroups.ToJToken(); + } + + if (this.PolicyDefinitions != null) + { + returnValue["policyDefinitions"] = this.PolicyDefinitions.ToJToken(); + } + + returnValue["policyType"] = this.PolicyType.ToString(); + return returnValue; + } + } +} diff --git a/src/Resources/ResourceManager/Implementation/Policy/PsPolicyType.cs b/src/Resources/ResourceManager/Implementation/Policy/PsPolicyType.cs new file mode 100644 index 000000000000..0658e5c548cd --- /dev/null +++ b/src/Resources/ResourceManager/Implementation/Policy/PsPolicyType.cs @@ -0,0 +1,42 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.Policy +{ + /// + /// The policy assignment enforcement mode. + /// + public enum PsPolicyType + { + /// + /// Value representing no PsPolicyType + /// + None, + + /// + /// The policy policy [set] definition is custom + /// + Custom, + + /// + /// The policy policy [set] definition is built in + /// + BuiltIn, + + /// + /// The policy policy definition is static + /// + Static + } +} diff --git a/src/Resources/ResourceManager/Implementation/Policy/RemoveAzurePolicyAssignment.cs b/src/Resources/ResourceManager/Implementation/Policy/RemoveAzurePolicyAssignment.cs index 8faf53074802..3980e7a67fe9 100644 --- a/src/Resources/ResourceManager/Implementation/Policy/RemoveAzurePolicyAssignment.cs +++ b/src/Resources/ResourceManager/Implementation/Policy/RemoveAzurePolicyAssignment.cs @@ -46,6 +46,12 @@ public class RemoveAzurePolicyAssignmentCmdlet : PolicyCmdletBase [ValidateNotNullOrEmpty] public string Id { get; set; } + /// + /// Gets or sets the policy assignment input object parameter. + /// + [Parameter(ParameterSetName = PolicyCmdletBase.InputObjectParameterSet, Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, HelpMessage = PolicyHelpStrings.RemovePolicyAssignmentInputObjectHelp)] + public PsPolicyAssignment InputObject { get; set; } + /// /// Executes the cmdlet. /// @@ -98,7 +104,7 @@ private void RunCmdlet() /// private string GetResourceId() { - return this.Id ?? this.MakePolicyAssignmentId(this.Scope, this.Name); + return this.Id ?? this.InputObject?.ResourceId ?? this.MakePolicyAssignmentId(this.Scope, this.Name); } } } diff --git a/src/Resources/ResourceManager/Implementation/Policy/RemoveAzurePolicyDefinition.cs b/src/Resources/ResourceManager/Implementation/Policy/RemoveAzurePolicyDefinition.cs index d7592a98f79c..b5cba53d2f92 100644 --- a/src/Resources/ResourceManager/Implementation/Policy/RemoveAzurePolicyDefinition.cs +++ b/src/Resources/ResourceManager/Implementation/Policy/RemoveAzurePolicyDefinition.cs @@ -62,6 +62,12 @@ public class RemoveAzurePolicyDefinitionCmdlet : PolicyCmdletBase [ValidateNotNullOrEmpty] public Guid? SubscriptionId { get; set; } + /// + /// Gets or sets the policy definition input object parameter. + /// + [Parameter(ParameterSetName = PolicyCmdletBase.InputObjectParameterSet, Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, HelpMessage = PolicyHelpStrings.RemovePolicyDefinitionInputObjectHelp)] + public PsPolicyDefinition InputObject { get; set; } + /// /// Executes the cmdlet. /// @@ -116,7 +122,7 @@ private void RunCmdlet() /// private string GetResourceId() { - return this.Id ?? this.MakePolicyDefinitionId(this.ManagementGroupName, this.SubscriptionId, this.Name); + return this.Id ?? this.InputObject?.ResourceId ?? this.MakePolicyDefinitionId(this.ManagementGroupName, this.SubscriptionId, this.Name); } } } diff --git a/src/Resources/ResourceManager/Implementation/Policy/RemoveAzurePolicySetDefinition.cs b/src/Resources/ResourceManager/Implementation/Policy/RemoveAzurePolicySetDefinition.cs index 57303d6404d8..3849349e4848 100644 --- a/src/Resources/ResourceManager/Implementation/Policy/RemoveAzurePolicySetDefinition.cs +++ b/src/Resources/ResourceManager/Implementation/Policy/RemoveAzurePolicySetDefinition.cs @@ -62,6 +62,12 @@ public class RemoveAzurePolicySetDefinitionCmdlet : PolicyCmdletBase [ValidateNotNullOrEmpty] public Guid? SubscriptionId { get; set; } + /// + /// Gets or sets the policy set definition input object parameter. + /// + [Parameter(ParameterSetName = PolicyCmdletBase.InputObjectParameterSet, Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, HelpMessage = PolicyHelpStrings.RemovePolicySetDefinitionInputObjectHelp)] + public PsPolicySetDefinition InputObject { get; set; } + /// /// Executes the cmdlet. /// @@ -116,7 +122,7 @@ private void RunCmdlet() /// private string GetResourceId() { - return this.Id ?? this.MakePolicySetDefinitionId(this.ManagementGroupName, this.SubscriptionId, this.Name); + return this.Id ?? this.InputObject?.ResourceId ?? this.MakePolicySetDefinitionId(this.ManagementGroupName, this.SubscriptionId, this.Name); } } } diff --git a/src/Resources/ResourceManager/Implementation/Policy/SetAzurePolicyAssignment.cs b/src/Resources/ResourceManager/Implementation/Policy/SetAzurePolicyAssignment.cs index 82f9ebd193ec..311de9924575 100644 --- a/src/Resources/ResourceManager/Implementation/Policy/SetAzurePolicyAssignment.cs +++ b/src/Resources/ResourceManager/Implementation/Policy/SetAzurePolicyAssignment.cs @@ -29,7 +29,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation /// /// Sets the policy assignment. /// - [Cmdlet("Set", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "PolicyAssignment", DefaultParameterSetName = PolicyCmdletBase.NameParameterSet), OutputType(typeof(PSObject))] + [Cmdlet("Set", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "PolicyAssignment", DefaultParameterSetName = PolicyCmdletBase.NameParameterSet), OutputType(typeof(PsPolicyAssignment))] public class SetAzurePolicyAssignmentCmdlet : PolicyCmdletBase { /// @@ -123,6 +123,12 @@ public class SetAzurePolicyAssignmentCmdlet : PolicyCmdletBase [ValidateNotNullOrEmpty] public PolicyAssignmentEnforcementMode? EnforcementMode { get; set; } + /// + /// Gets or sets the policy assignment input object parameter. + /// + [Parameter(ParameterSetName = PolicyCmdletBase.InputObjectParameterSet, Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, HelpMessage = PolicyHelpStrings.SetPolicyAssignmentInputObjectHelp)] + public PsPolicyAssignment InputObject { get; set; } + /// /// Executes the cmdlet. /// @@ -151,7 +157,7 @@ protected override void OnProcessRecord() var result = this.GetLongRunningOperationTracker(activityName: activity, isResourceCreateOrUpdate: true) .WaitOnOperation(operationResult: operationResult); - this.WriteObject(this.GetOutputObjects("PolicyAssignmentId", JObject.Parse(result)), enumerateCollection: true); + this.WriteObject(this.GetOutputPolicyAssignments(JObject.Parse(result)), enumerateCollection: true); } /// @@ -195,7 +201,7 @@ private JToken GetResource(string resourceId, string apiVersion) /// private string GetResourceId() { - return this.Id ?? this.MakePolicyAssignmentId(this.Scope, this.Name); + return this.Id ?? this.InputObject?.ResourceId ?? this.MakePolicyAssignmentId(this.Scope, this.Name); } } } diff --git a/src/Resources/ResourceManager/Implementation/Policy/SetAzurePolicyDefinition.cs b/src/Resources/ResourceManager/Implementation/Policy/SetAzurePolicyDefinition.cs index cf0a3ea42daa..c2919990c573 100644 --- a/src/Resources/ResourceManager/Implementation/Policy/SetAzurePolicyDefinition.cs +++ b/src/Resources/ResourceManager/Implementation/Policy/SetAzurePolicyDefinition.cs @@ -26,7 +26,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation /// /// Sets the policy definition. /// - [Cmdlet("Set", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "PolicyDefinition", DefaultParameterSetName = PolicyCmdletBase.NameParameterSet), OutputType(typeof(PSObject))] + [Cmdlet("Set", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "PolicyDefinition", DefaultParameterSetName = PolicyCmdletBase.NameParameterSet), OutputType(typeof(PsPolicyDefinition))] public class SetAzurePolicyDefinitionCmdlet : PolicyCmdletBase { /// @@ -103,6 +103,12 @@ public class SetAzurePolicyDefinitionCmdlet : PolicyCmdletBase [ValidateNotNullOrEmpty] public Guid? SubscriptionId { get; set; } + /// + /// Gets or sets the policy definition input object parameter. + /// + [Parameter(ParameterSetName = PolicyCmdletBase.InputObjectParameterSet, Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, HelpMessage = PolicyHelpStrings.SetPolicyDefinitionInputObjectHelp)] + public PsPolicyDefinition InputObject { get; set; } + /// /// Executes the cmdlet. /// @@ -131,7 +137,7 @@ protected override void OnProcessRecord() var result = this.GetLongRunningOperationTracker(activityName: activity, isResourceCreateOrUpdate: true) .WaitOnOperation(operationResult: operationResult); - this.WriteObject(this.GetOutputObjects("PolicyDefinitionId", JObject.Parse(result)), enumerateCollection: true); + this.WriteObject(this.GetOutputPolicyDefinitions(JObject.Parse(result)), enumerateCollection: true); } /// @@ -141,6 +147,12 @@ private JToken GetResource(string resourceId, string apiVersion) { var resource = this.GetExistingResource(resourceId, apiVersion).Result.ToResource(); + // apply incoming object properties if present + if (this.InputObject != null) + { + resource.Properties = this.InputObject.Properties.ToJToken(); + } + var policyDefinitionObject = new PolicyDefinition { Name = this.Name ?? resource.Name, @@ -183,7 +195,7 @@ private JToken GetResource(string resourceId, string apiVersion) /// private string GetResourceId() { - return this.Id ?? this.MakePolicyDefinitionId(this.ManagementGroupName, this.SubscriptionId, this.Name); + return this.Id ?? this.InputObject?.ResourceId ?? this.MakePolicyDefinitionId(this.ManagementGroupName, this.SubscriptionId, this.Name); } } } diff --git a/src/Resources/ResourceManager/Implementation/Policy/SetAzurePolicySetDefinition.cs b/src/Resources/ResourceManager/Implementation/Policy/SetAzurePolicySetDefinition.cs index fd193e64d36d..0cdb644ba570 100644 --- a/src/Resources/ResourceManager/Implementation/Policy/SetAzurePolicySetDefinition.cs +++ b/src/Resources/ResourceManager/Implementation/Policy/SetAzurePolicySetDefinition.cs @@ -14,21 +14,18 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation { - using Commands.Common.Authentication.Abstractions; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.Policy; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions; - using Microsoft.WindowsAzure.Commands.Utilities.Common; using Newtonsoft.Json.Linq; using Policy; using System; - using System.IO; using System.Management.Automation; /// /// Sets the policy definition. /// - [Cmdlet("Set", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "PolicySetDefinition", DefaultParameterSetName = PolicyCmdletBase.NameParameterSet, SupportsShouldProcess = true), OutputType(typeof(PSObject))] + [Cmdlet("Set", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "PolicySetDefinition", DefaultParameterSetName = PolicyCmdletBase.NameParameterSet, SupportsShouldProcess = true), OutputType(typeof(PsPolicySetDefinition))] public class SetAzurePolicySetDefinitionCmdlet : PolicyCmdletBase { /// @@ -97,6 +94,12 @@ public class SetAzurePolicySetDefinitionCmdlet : PolicyCmdletBase [ValidateNotNullOrEmpty] public Guid? SubscriptionId { get; set; } + /// + /// Gets or sets the policy set definition input object parameter. + /// + [Parameter(ParameterSetName = PolicyCmdletBase.InputObjectParameterSet, Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, HelpMessage = PolicyHelpStrings.SetPolicySetDefinitionInputObjectHelp)] + public PsPolicySetDefinition InputObject { get; set; } + /// /// Gets or sets the policy definition groups parameter of the new policy set definition /// @@ -134,7 +137,7 @@ protected override void OnProcessRecord() var result = this.GetLongRunningOperationTracker(activityName: activity, isResourceCreateOrUpdate: true) .WaitOnOperation(operationResult: operationResult); - this.WriteObject(this.GetOutputObjects("PolicySetDefinitionId", JObject.Parse(result)), enumerateCollection: true); + this.WriteObject(this.GetOutputPolicySetDefinitions(JObject.Parse(result)), enumerateCollection: true); } } @@ -145,6 +148,12 @@ private JToken GetResource(string resourceId, string apiVersion) { var resource = this.GetExistingResource(resourceId, apiVersion).Result.ToResource(); + // apply incoming object properties if present + if (this.InputObject != null) + { + resource.Properties = this.InputObject.Properties.ToJToken(); + } + var metaDataJson = string.IsNullOrEmpty(this.Metadata) ? resource.Properties["metadata"]?.ToString() : this.GetObjectFromParameter(this.Metadata, nameof(this.Metadata)).ToString(); var parameterJson = string.IsNullOrEmpty(this.Parameter) ? resource.Properties["parameters"]?.ToString() : this.GetObjectFromParameter(this.Parameter, nameof(this.Parameter)).ToString(); var groupsJson = string.IsNullOrEmpty(this.GroupDefinition) ? resource.Properties["policyDefinitionGroups"]?.ToString() : this.GetArrayFromParameter(this.GroupDefinition, nameof(this.GroupDefinition)).ToString(); @@ -171,7 +180,7 @@ private JToken GetResource(string resourceId, string apiVersion) /// private string GetResourceId() { - return this.Id ?? this.MakePolicySetDefinitionId(this.ManagementGroupName, this.SubscriptionId, this.Name); + return this.Id ?? this.InputObject?.ResourceId ?? this.MakePolicySetDefinitionId(this.ManagementGroupName, this.SubscriptionId, this.Name); } } } diff --git a/src/Resources/Resources.Test/ScenarioTests/PolicyTests.cs b/src/Resources/Resources.Test/ScenarioTests/PolicyTests.cs index 8d9721c6a99a..dd3d0517a14b 100644 --- a/src/Resources/Resources.Test/ScenarioTests/PolicyTests.cs +++ b/src/Resources/Resources.Test/ScenarioTests/PolicyTests.cs @@ -129,6 +129,13 @@ public void TestPolicyDefinitionWithUri() TestRunner.RunTestScript("Test-PolicyDefinitionWithUri"); } + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestPolicyObjectPiping() + { + TestRunner.RunTestScript("Test-PolicyObjectPiping"); + } + [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestPolicyDefinitionWithFullObject() diff --git a/src/Resources/Resources.Test/ScenarioTests/PolicyTests.ps1 b/src/Resources/Resources.Test/ScenarioTests/PolicyTests.ps1 index b633eedeceff..1e8072091494 100644 --- a/src/Resources/Resources.Test/ScenarioTests/PolicyTests.ps1 +++ b/src/Resources/Resources.Test/ScenarioTests/PolicyTests.ps1 @@ -1106,6 +1106,106 @@ function Test-GetBuiltinsByName } } +<# +.SYNOPSIS +Tests Policy object piping +#> +function Test-PolicyObjectPiping +{ + # setup + $rgname = Get-ResourceGroupName + $policySetDefName = Get-ResourceName + $policyDefName = Get-ResourceName + $policyAssName = Get-ResourceName + $subscriptionId = (Get-AzureRmContext).Subscription.Id + + # make a policy definition and policy set definition that references it + $policyDefinition = New-AzureRmPolicyDefinition -Name $policyDefName -SubscriptionId $subscriptionId -Policy "$TestOutputRoot\SamplePolicyDefinition.json" -Description $description + $policySet = "[{""policyDefinitionId"":""" + $policyDefinition.PolicyDefinitionId + """}]" + $expected = New-AzureRmPolicySetDefinition -Name $policySetDefName -SubscriptionId $subscriptionId -PolicyDefinition $policySet -Description $description + + # make a policy assignment by piping the policy definition to New-AzureRmPolicyAssignment + $rg = New-AzureRmResourceGroup -Name $rgname -Location "west us" + + # assign the policy definition to the resource group, get the assignment back and validate + $actual = Get-AzureRmPolicyDefinition -Name $policyDefName -SubscriptionId $subscriptionId | New-AzureRmPolicyAssignment -Name $policyAssName -Scope $rg.ResourceId -Description $description + $expected = Get-AzureRmPolicyAssignment -Name $policyAssName -Scope $rg.ResourceId + Assert-AreEqual $expected.Name $actual.Name + Assert-AreEqual Microsoft.Authorization/policyAssignments $actual.ResourceType + Assert-NotNull $actual.Properties.PolicyDefinitionId + Assert-NotNull $expected.Properties.PolicyDefinitionId + Assert-AreEqual $expected.PolicyAssignmentId $actual.PolicyAssignmentId + Assert-AreEqual $expected.Properties.PolicyDefinitionId $actual.Properties.PolicyDefinitionId + Assert-AreEqual $expected.Properties.Scope $rg.ResourceId + # delete the policy assignment + $remove = Get-AzureRmPolicyAssignment -Name $policyAssName -Scope $rg.ResourceId | Remove-AzureRmPolicyAssignment + Assert-AreEqual True $remove + + # assign the policy set definition to the resource group, get the assignment back and validate + $actual = Get-AzureRmPolicySetDefinition -Name $policySetDefName -SubscriptionId $subscriptionId | New-AzureRmPolicyAssignment -Name $policyAssName -Scope $rg.ResourceId -Description $description + $expected = Get-AzureRmPolicyAssignment -Name $policyAssName -Scope $rg.ResourceId + Assert-AreEqual $expected.Name $actual.Name + Assert-AreEqual Microsoft.Authorization/policyAssignments $actual.ResourceType + Assert-NotNull $actual.Properties.PolicyDefinitionId + Assert-NotNull $expected.Properties.PolicyDefinitionId + Assert-AreEqual $expected.PolicyAssignmentId $actual.PolicyAssignmentId + Assert-AreEqual $expected.Properties.PolicyDefinitionId $actual.Properties.PolicyDefinitionId + Assert-AreEqual $expected.Properties.Scope $rg.ResourceId + + # update the policy definition + $actual = Get-AzureRmPolicyDefinition -Name $policyDefName | Set-AzureRmPolicyDefinition -Description $updatedDescription + $expected = Get-AzureRmPolicyDefinition -Name $policyDefName + Assert-AreEqual $policyDefName $expected.Name + Assert-AreEqual $expected.Name $actual.Name + Assert-AreEqual $expected.ResourceName $actual.ResourceName + Assert-AreEqual Microsoft.Authorization/policyDefinitions $actual.ResourceType + Assert-AreEqual $expected.ResourceType $actual.ResourceType + Assert-NotNull $expected.ResourceId + Assert-AreEqual $expected.ResourceId $actual.ResourceId + Assert-AreEqual $updatedDescription $actual.Properties.Description + Assert-AreEqual $updatedDescription $expected.Properties.Description + + # update the policy set definition + $actual = Get-AzureRmPolicySetDefinition -Name $policySetDefName | Set-AzureRmPolicySetDefinition -Description $updatedDescription + $expected = Get-AzureRmPolicySetDefinition -Name $policySetDefName + Assert-AreEqual $policySetDefName $expected.Name + Assert-AreEqual $expected.Name $actual.Name + Assert-AreEqual $expected.ResourceName $actual.ResourceName + Assert-AreEqual Microsoft.Authorization/policySetDefinitions $actual.ResourceType + Assert-AreEqual $expected.ResourceType $actual.ResourceType + Assert-NotNull $expected.ResourceId + Assert-AreEqual $expected.ResourceId $actual.ResourceId + Assert-AreEqual $updatedDescription $actual.Properties.Description + Assert-AreEqual $updatedDescription $expected.Properties.Description + + # update the policy assignment + $actual = Get-AzureRmPolicyAssignment -Name $policyAssName -Scope $rg.ResourceId | Set-AzureRmPolicyAssignment -Description $updatedDescription + $expected = Get-AzureRmPolicyAssignment -Name $policyAssName -Scope $rg.ResourceId + Assert-AreEqual $expected.Name $actual.Name + Assert-AreEqual Microsoft.Authorization/policyAssignments $actual.ResourceType + Assert-AreEqual $expected.ResourceType $actual.ResourceType + Assert-NotNull $actual.Properties.PolicyDefinitionId + Assert-NotNull $expected.Properties.PolicyDefinitionId + Assert-AreEqual $expected.PolicyAssignmentId $actual.PolicyAssignmentId + Assert-AreEqual $expected.Properties.PolicyDefinitionId $actual.Properties.PolicyDefinitionId + Assert-AreEqual $expected.Properties.Scope $rg.ResourceId + Assert-AreEqual $updatedDescription $actual.Properties.Description + Assert-AreEqual $updatedDescription $expected.Properties.Description + + # clean up + $remove = Get-AzureRmPolicyAssignment -Name $policyAssName -Scope $rg.ResourceId | Remove-AzureRmPolicyAssignment + Assert-AreEqual True $remove + + $remove = Remove-AzureRmResourceGroup -Name $rgname -Force + Assert-AreEqual True $remove + + $remove = Get-AzureRmPolicySetDefinition -Name $policySetDefName -SubscriptionId $subscriptionId | Remove-AzureRmPolicySetDefinition -Force + Assert-AreEqual True $remove + + $remove = Get-AzureRmPolicyDefinition -Name $policyDefName -SubscriptionId $subscriptionId | Remove-AzureRmPolicyDefinition -Force + Assert-AreEqual True $remove +} + <# The following section contains tests for each cmdlet that validate as many combinations of parameters as possible/reasonable. Tests for all combinations of parameters are present here diff --git a/src/Resources/Resources.Test/SessionRecords/Microsoft.Azure.Commands.Resources.Test.ScenarioTests.PolicyTests/TestPolicyObjectPiping.json b/src/Resources/Resources.Test/SessionRecords/Microsoft.Azure.Commands.Resources.Test.ScenarioTests.PolicyTests/TestPolicyObjectPiping.json new file mode 100644 index 000000000000..39b524836b18 --- /dev/null +++ b/src/Resources/Resources.Test/SessionRecords/Microsoft.Azure.Commands.Resources.Test.ScenarioTests.PolicyTests/TestPolicyObjectPiping.json @@ -0,0 +1,2311 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policydefinitions/ps1556?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9wczE1NTY/YXBpLXZlcnNpb249MjAxOS0wOS0wMQ==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"name\": \"ps1556\",\r\n \"properties\": {\r\n \"description\": \"Unit test junk: sorry for littering. Please delete me!\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"Microsoft.Resources/Subscriptions/ResourceGroups/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n },\r\n \"mode\": \"All\",\r\n \"policyType\": \"Custom\"\r\n }\r\n}", + "RequestHeaders": { + "User-Agent": [ + "AzurePowershell/v1.0.0", + "PSVersion/v6.1.0" + ], + "ParameterSetName": [ + "SubscriptionIdParameterSet" + ], + "CommandName": [ + "New-AzPolicyDefinition" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "386" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "westus:9c477310-d484-4d76-bc14-85d660159ac6" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-correlation-request-id": [ + "7672f134-6b44-4430-b45d-2b8fedad7e58" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004732Z:7672f134-6b44-4430-b45d-2b8fedad7e58" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:47:32 GMT" + ], + "Content-Length": [ + "579" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Unit test junk: sorry for littering. Please delete me!\",\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:32.5332141Z\",\r\n \"updatedBy\": null,\r\n \"updatedOn\": null\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"Microsoft.Resources/Subscriptions/ResourceGroups/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policyDefinitions/ps1556\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"ps1556\"\r\n}", + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policysetdefinitions/ps1081?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lzZXRkZWZpbml0aW9ucy9wczEwODE/YXBpLXZlcnNpb249MjAxOS0wOS0wMQ==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"name\": \"ps1081\",\r\n \"properties\": {\r\n \"description\": \"Unit test junk: sorry for littering. Please delete me!\",\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policyDefinitions/ps1556\"\r\n }\r\n ],\r\n \"policyType\": \"Custom\"\r\n }\r\n}", + "RequestHeaders": { + "User-Agent": [ + "AzurePowershell/v1.0.0", + "PSVersion/v6.1.0" + ], + "ParameterSetName": [ + "SubscriptionIdParameterSet" + ], + "CommandName": [ + "New-AzPolicySetDefinition" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "353" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "westus:68d51ed0-3248-4b04-b154-b127cd5a6015" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-correlation-request-id": [ + "f7c50640-2ef8-47f7-bc69-ae81b788d158" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004737Z:f7c50640-2ef8-47f7-bc69-ae81b788d158" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:47:36 GMT" + ], + "Content-Length": [ + "651" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"policyType\": \"Custom\",\r\n \"description\": \"Unit test junk: sorry for littering. Please delete me!\",\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:37.0988351Z\",\r\n \"updatedBy\": null,\r\n \"updatedOn\": null\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionReferenceId\": \"5594624486481855834\",\r\n \"policyDefinitionId\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policyDefinitions/ps1556\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policySetDefinitions/ps1081\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"ps1081\"\r\n}", + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourcegroups/ps3521?api-version=2019-07-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Jlc291cmNlZ3JvdXBzL3BzMzUyMT9hcGktdmVyc2lvbj0yMDE5LTA3LTAx", + "RequestMethod": "HEAD", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "ba074465-b0b1-474f-862e-9c75c27368c4" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28207.04", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/3.0.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": [ + "2e12634e-1442-4619-848f-3fb419cec193" + ], + "x-ms-correlation-request-id": [ + "2e12634e-1442-4619-848f-3fb419cec193" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004737Z:2e12634e-1442-4619-848f-3fb419cec193" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:47:37 GMT" + ], + "Content-Length": [ + "98" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 404 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourcegroups/ps3521?api-version=2019-07-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Jlc291cmNlZ3JvdXBzL3BzMzUyMT9hcGktdmVyc2lvbj0yMDE5LTA3LTAx", + "RequestMethod": "HEAD", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "7f1c332c-920d-4fc3-825a-be851b422e66" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28207.04", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/3.0.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "x-ms-request-id": [ + "c97450b3-a576-4411-aef6-452e12624af4" + ], + "x-ms-correlation-request-id": [ + "c97450b3-a576-4411-aef6-452e12624af4" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004744Z:c97450b3-a576-4411-aef6-452e12624af4" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:47:43 GMT" + ], + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 204 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourcegroups/ps3521?api-version=2019-07-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Jlc291cmNlZ3JvdXBzL3BzMzUyMT9hcGktdmVyc2lvbj0yMDE5LTA3LTAx", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"west us\"\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "381fd84f-fa3f-4579-9adb-4c177bc682e5" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28207.04", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/3.0.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "29" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "de5123c2-3edc-4827-a86c-d279a555084b" + ], + "x-ms-correlation-request-id": [ + "de5123c2-3edc-4827-a86c-d279a555084b" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004738Z:de5123c2-3edc-4827-a86c-d279a555084b" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:47:38 GMT" + ], + "Content-Length": [ + "209" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521\",\r\n \"name\": \"ps3521\",\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/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policydefinitions/ps1556?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9wczE1NTY/YXBpLXZlcnNpb249MjAxOS0wOS0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "AzurePowershell/v1.0.0", + "PSVersion/v6.1.0" + ], + "ParameterSetName": [ + "SubscriptionIdParameterSet" + ], + "CommandName": [ + "Get-AzPolicyDefinition" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "westus:5c6028bc-1a45-41b5-8b7c-a912498681c9" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "x-ms-correlation-request-id": [ + "d744954e-c797-48b5-ae6d-dade5da8d899" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004738Z:d744954e-c797-48b5-ae6d-dade5da8d899" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:47:37 GMT" + ], + "Content-Length": [ + "579" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Unit test junk: sorry for littering. Please delete me!\",\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:32.5332141Z\",\r\n \"updatedBy\": null,\r\n \"updatedOn\": null\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"Microsoft.Resources/Subscriptions/ResourceGroups/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policyDefinitions/ps1556\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"ps1556\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policydefinitions/ps1556?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9wczE1NTY/YXBpLXZlcnNpb249MjAxOS0wOS0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "AzurePowershell/v1.0.0", + "PSVersion/v6.1.0" + ], + "ParameterSetName": [ + "NameParameterSet" + ], + "CommandName": [ + "Get-AzPolicyDefinition" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "westus:267707cb-9400-435f-8662-6b7e0f207b0c" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "x-ms-correlation-request-id": [ + "b1752771-71cc-4444-bab0-3253ed351716" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004740Z:b1752771-71cc-4444-bab0-3253ed351716" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:47:40 GMT" + ], + "Content-Length": [ + "579" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Unit test junk: sorry for littering. Please delete me!\",\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:32.5332141Z\",\r\n \"updatedBy\": null,\r\n \"updatedOn\": null\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"Microsoft.Resources/Subscriptions/ResourceGroups/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policyDefinitions/ps1556\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"ps1556\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policydefinitions/ps1556?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9wczE1NTY/YXBpLXZlcnNpb249MjAxOS0wOS0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "AzurePowershell/v1.0.0", + "PSVersion/v6.1.0" + ], + "ParameterSetName": [ + "NameParameterSet" + ], + "CommandName": [ + "Get-AzPolicyDefinition" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "westus:e682987a-796d-4af0-bc73-83eafd1fc391" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "x-ms-correlation-request-id": [ + "8478affd-b86e-45c1-9674-4ccd47a7db9c" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004741Z:8478affd-b86e-45c1-9674-4ccd47a7db9c" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:47:40 GMT" + ], + "Content-Length": [ + "646" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Updated Unit test junk: sorry for littering. Please delete me!\",\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:32.5332141Z\",\r\n \"updatedBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"updatedOn\": \"2020-01-17T00:47:41.246804Z\"\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"Microsoft.Resources/Subscriptions/ResourceGroups/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policyDefinitions/ps1556\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"ps1556\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policydefinitions/ps1556?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9wczE1NTY/YXBpLXZlcnNpb249MjAxOS0wOS0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "AzurePowershell/v1.0.0", + "PSVersion/v6.1.0" + ], + "ParameterSetName": [ + "SubscriptionIdParameterSet" + ], + "CommandName": [ + "Get-AzPolicyDefinition" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "westus:7319457c-6d9f-4ccc-88a7-c3faf286e274" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "x-ms-correlation-request-id": [ + "7d686691-566a-4f3f-b38b-8a7ebfffa62c" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004830Z:7d686691-566a-4f3f-b38b-8a7ebfffa62c" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:48:29 GMT" + ], + "Content-Length": [ + "646" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Updated Unit test junk: sorry for littering. Please delete me!\",\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:32.5332141Z\",\r\n \"updatedBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"updatedOn\": \"2020-01-17T00:47:41.246804Z\"\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"Microsoft.Resources/Subscriptions/ResourceGroups/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policyDefinitions/ps1556\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"ps1556\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521/providers/Microsoft.Authorization/policyassignments/ps5563?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Jlc291cmNlR3JvdXBzL3BzMzUyMS9wcm92aWRlcnMvTWljcm9zb2Z0LkF1dGhvcml6YXRpb24vcG9saWN5YXNzaWdubWVudHMvcHM1NTYzP2FwaS12ZXJzaW9uPTIwMTktMDktMDE=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"scope\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521\",\r\n \"description\": \"Unit test junk: sorry for littering. Please delete me!\",\r\n \"enforcementMode\": \"Default\",\r\n \"policyDefinitionId\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policyDefinitions/ps1556\"\r\n },\r\n \"name\": \"ps5563\"\r\n}", + "RequestHeaders": { + "User-Agent": [ + "AzurePowershell/v1.0.0", + "PSVersion/v6.1.0" + ], + "ParameterSetName": [ + "DefaultParameterSet" + ], + "CommandName": [ + "New-AzPolicyAssignment" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "393" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "westus:e30245e9-7b43-4f26-95b3-89331e627c2e" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-correlation-request-id": [ + "9abd7ab7-a4b4-47b4-816f-de75b39a23e4" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004739Z:9abd7ab7-a4b4-47b4-816f-de75b39a23e4" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:47:39 GMT" + ], + "Content-Length": [ + "715" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"A0\",\r\n \"tier\": \"Free\"\r\n },\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policyDefinitions/ps1556\",\r\n \"scope\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521\",\r\n \"description\": \"Unit test junk: sorry for littering. Please delete me!\",\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:39.2333568Z\",\r\n \"updatedBy\": null,\r\n \"updatedOn\": null\r\n },\r\n \"enforcementMode\": \"Default\"\r\n },\r\n \"id\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521/providers/Microsoft.Authorization/policyAssignments/ps5563\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"ps5563\"\r\n}", + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521/providers/Microsoft.Authorization/policyassignments/ps5563?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Jlc291cmNlR3JvdXBzL3BzMzUyMS9wcm92aWRlcnMvTWljcm9zb2Z0LkF1dGhvcml6YXRpb24vcG9saWN5YXNzaWdubWVudHMvcHM1NTYzP2FwaS12ZXJzaW9uPTIwMTktMDktMDE=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"scope\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521\",\r\n \"description\": \"Unit test junk: sorry for littering. Please delete me!\",\r\n \"enforcementMode\": \"Default\",\r\n \"policyDefinitionId\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policySetDefinitions/ps1081\"\r\n },\r\n \"name\": \"ps5563\"\r\n}", + "RequestHeaders": { + "User-Agent": [ + "AzurePowershell/v1.0.0", + "PSVersion/v6.1.0" + ], + "ParameterSetName": [ + "DefaultParameterSet" + ], + "CommandName": [ + "New-AzPolicyAssignment" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "396" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "westus:539edba5-017c-4869-9df8-f9a81d337903" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1198" + ], + "x-ms-correlation-request-id": [ + "165bb72c-95bc-468f-a781-78667534b53e" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004740Z:165bb72c-95bc-468f-a781-78667534b53e" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:47:40 GMT" + ], + "Content-Length": [ + "718" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"A0\",\r\n \"tier\": \"Free\"\r\n },\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policySetDefinitions/ps1081\",\r\n \"scope\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521\",\r\n \"description\": \"Unit test junk: sorry for littering. Please delete me!\",\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:40.5306042Z\",\r\n \"updatedBy\": null,\r\n \"updatedOn\": null\r\n },\r\n \"enforcementMode\": \"Default\"\r\n },\r\n \"id\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521/providers/Microsoft.Authorization/policyAssignments/ps5563\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"ps5563\"\r\n}", + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521/providers/Microsoft.Authorization/policyassignments/ps5563?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Jlc291cmNlR3JvdXBzL3BzMzUyMS9wcm92aWRlcnMvTWljcm9zb2Z0LkF1dGhvcml6YXRpb24vcG9saWN5YXNzaWdubWVudHMvcHM1NTYzP2FwaS12ZXJzaW9uPTIwMTktMDktMDE=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "AzurePowershell/v1.0.0", + "PSVersion/v6.1.0" + ], + "ParameterSetName": [ + "NameParameterSet" + ], + "CommandName": [ + "Get-AzPolicyAssignment" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "westus:9dbef844-1e3f-4803-85c1-e24217f31930" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "x-ms-correlation-request-id": [ + "74e86ff4-978f-413a-8a17-63c21f3248ec" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004739Z:74e86ff4-978f-413a-8a17-63c21f3248ec" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:47:39 GMT" + ], + "Content-Length": [ + "715" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"A0\",\r\n \"tier\": \"Free\"\r\n },\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policyDefinitions/ps1556\",\r\n \"scope\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521\",\r\n \"description\": \"Unit test junk: sorry for littering. Please delete me!\",\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:39.2333568Z\",\r\n \"updatedBy\": null,\r\n \"updatedOn\": null\r\n },\r\n \"enforcementMode\": \"Default\"\r\n },\r\n \"id\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521/providers/Microsoft.Authorization/policyAssignments/ps5563\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"ps5563\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521/providers/Microsoft.Authorization/policyassignments/ps5563?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Jlc291cmNlR3JvdXBzL3BzMzUyMS9wcm92aWRlcnMvTWljcm9zb2Z0LkF1dGhvcml6YXRpb24vcG9saWN5YXNzaWdubWVudHMvcHM1NTYzP2FwaS12ZXJzaW9uPTIwMTktMDktMDE=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "AzurePowershell/v1.0.0", + "PSVersion/v6.1.0" + ], + "ParameterSetName": [ + "NameParameterSet" + ], + "CommandName": [ + "Get-AzPolicyAssignment" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "westus:770a7be2-f577-4abe-99c6-f7fb85b1a1c6" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "x-ms-correlation-request-id": [ + "587b5cb5-867c-4e72-878b-51b192b62ab7" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004739Z:587b5cb5-867c-4e72-878b-51b192b62ab7" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:47:38 GMT" + ], + "Content-Length": [ + "715" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"A0\",\r\n \"tier\": \"Free\"\r\n },\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policyDefinitions/ps1556\",\r\n \"scope\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521\",\r\n \"description\": \"Unit test junk: sorry for littering. Please delete me!\",\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:39.2333568Z\",\r\n \"updatedBy\": null,\r\n \"updatedOn\": null\r\n },\r\n \"enforcementMode\": \"Default\"\r\n },\r\n \"id\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521/providers/Microsoft.Authorization/policyAssignments/ps5563\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"ps5563\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521/providers/Microsoft.Authorization/policyassignments/ps5563?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Jlc291cmNlR3JvdXBzL3BzMzUyMS9wcm92aWRlcnMvTWljcm9zb2Z0LkF1dGhvcml6YXRpb24vcG9saWN5YXNzaWdubWVudHMvcHM1NTYzP2FwaS12ZXJzaW9uPTIwMTktMDktMDE=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "AzurePowershell/v1.0.0", + "PSVersion/v6.1.0" + ], + "ParameterSetName": [ + "NameParameterSet" + ], + "CommandName": [ + "Get-AzPolicyAssignment" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "westus:c8a85c6f-b9b1-4c2c-bcf0-8525ee095c4c" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "x-ms-correlation-request-id": [ + "dd7f50d5-a7f6-4ec4-a368-dd5dc377d286" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004740Z:dd7f50d5-a7f6-4ec4-a368-dd5dc377d286" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:47:39 GMT" + ], + "Content-Length": [ + "718" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"A0\",\r\n \"tier\": \"Free\"\r\n },\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policySetDefinitions/ps1081\",\r\n \"scope\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521\",\r\n \"description\": \"Unit test junk: sorry for littering. Please delete me!\",\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:40.5306042Z\",\r\n \"updatedBy\": null,\r\n \"updatedOn\": null\r\n },\r\n \"enforcementMode\": \"Default\"\r\n },\r\n \"id\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521/providers/Microsoft.Authorization/policyAssignments/ps5563\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"ps5563\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521/providers/Microsoft.Authorization/policyassignments/ps5563?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Jlc291cmNlR3JvdXBzL3BzMzUyMS9wcm92aWRlcnMvTWljcm9zb2Z0LkF1dGhvcml6YXRpb24vcG9saWN5YXNzaWdubWVudHMvcHM1NTYzP2FwaS12ZXJzaW9uPTIwMTktMDktMDE=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "AzurePowershell/v1.0.0", + "PSVersion/v6.1.0" + ], + "ParameterSetName": [ + "NameParameterSet" + ], + "CommandName": [ + "Get-AzPolicyAssignment" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "westus:6c34f8fa-3b07-464e-8b1b-fe04fe8cc411" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "x-ms-correlation-request-id": [ + "30374ee6-2934-47c0-b967-37441e8daaa9" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004742Z:30374ee6-2934-47c0-b967-37441e8daaa9" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:47:41 GMT" + ], + "Content-Length": [ + "718" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"A0\",\r\n \"tier\": \"Free\"\r\n },\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policySetDefinitions/ps1081\",\r\n \"scope\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521\",\r\n \"description\": \"Unit test junk: sorry for littering. Please delete me!\",\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:40.5306042Z\",\r\n \"updatedBy\": null,\r\n \"updatedOn\": null\r\n },\r\n \"enforcementMode\": \"Default\"\r\n },\r\n \"id\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521/providers/Microsoft.Authorization/policyAssignments/ps5563\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"ps5563\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521/providers/Microsoft.Authorization/policyassignments/ps5563?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Jlc291cmNlR3JvdXBzL3BzMzUyMS9wcm92aWRlcnMvTWljcm9zb2Z0LkF1dGhvcml6YXRpb24vcG9saWN5YXNzaWdubWVudHMvcHM1NTYzP2FwaS12ZXJzaW9uPTIwMTktMDktMDE=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "AzurePowershell/v1.0.0", + "PSVersion/v6.1.0" + ], + "ParameterSetName": [ + "NameParameterSet" + ], + "CommandName": [ + "Get-AzPolicyAssignment" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "westus:f501ffa3-42af-4ad6-941f-06d0f6752958" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "x-ms-correlation-request-id": [ + "0783b7bb-3d54-4f42-abf8-8f55f569459f" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004743Z:0783b7bb-3d54-4f42-abf8-8f55f569459f" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:47:42 GMT" + ], + "Content-Length": [ + "786" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"A0\",\r\n \"tier\": \"Free\"\r\n },\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policySetDefinitions/ps1081\",\r\n \"scope\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521\",\r\n \"description\": \"Updated Unit test junk: sorry for littering. Please delete me!\",\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:40.5306042Z\",\r\n \"updatedBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"updatedOn\": \"2020-01-17T00:47:42.9762361Z\"\r\n },\r\n \"enforcementMode\": \"Default\"\r\n },\r\n \"id\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521/providers/Microsoft.Authorization/policyAssignments/ps5563\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"ps5563\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521/providers/Microsoft.Authorization/policyassignments/ps5563?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Jlc291cmNlR3JvdXBzL3BzMzUyMS9wcm92aWRlcnMvTWljcm9zb2Z0LkF1dGhvcml6YXRpb24vcG9saWN5YXNzaWdubWVudHMvcHM1NTYzP2FwaS12ZXJzaW9uPTIwMTktMDktMDE=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "AzurePowershell/v1.0.0", + "PSVersion/v6.1.0" + ], + "ParameterSetName": [ + "NameParameterSet" + ], + "CommandName": [ + "Get-AzPolicyAssignment" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "westus:298cee18-0ea2-440b-ab58-d6be5e64d017" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "x-ms-correlation-request-id": [ + "373f3e7d-b0ca-428a-a066-b2dadeb11159" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004743Z:373f3e7d-b0ca-428a-a066-b2dadeb11159" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:47:42 GMT" + ], + "Content-Length": [ + "786" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"A0\",\r\n \"tier\": \"Free\"\r\n },\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policySetDefinitions/ps1081\",\r\n \"scope\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521\",\r\n \"description\": \"Updated Unit test junk: sorry for littering. Please delete me!\",\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:40.5306042Z\",\r\n \"updatedBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"updatedOn\": \"2020-01-17T00:47:42.9762361Z\"\r\n },\r\n \"enforcementMode\": \"Default\"\r\n },\r\n \"id\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521/providers/Microsoft.Authorization/policyAssignments/ps5563\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"ps5563\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521/providers/Microsoft.Authorization/policyAssignments/ps5563?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Jlc291cmNlR3JvdXBzL3BzMzUyMS9wcm92aWRlcnMvTWljcm9zb2Z0LkF1dGhvcml6YXRpb24vcG9saWN5QXNzaWdubWVudHMvcHM1NTYzP2FwaS12ZXJzaW9uPTIwMTktMDktMDE=", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "AzurePowershell/v1.0.0", + "PSVersion/v6.1.0" + ], + "ParameterSetName": [ + "InputObjectParameterSet" + ], + "CommandName": [ + "Remove-AzPolicyAssignment" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "westus:ae895604-3f4d-4253-a836-16ea0ebf40e5" + ], + "x-ms-ratelimit-remaining-subscription-deletes": [ + "14999" + ], + "x-ms-correlation-request-id": [ + "f0bf84dc-f59f-4215-ab7b-cfe985bce948" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004740Z:f0bf84dc-f59f-4215-ab7b-cfe985bce948" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:47:40 GMT" + ], + "Content-Length": [ + "715" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"A0\",\r\n \"tier\": \"Free\"\r\n },\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policyDefinitions/ps1556\",\r\n \"scope\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521\",\r\n \"description\": \"Unit test junk: sorry for littering. Please delete me!\",\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:39.2333568Z\",\r\n \"updatedBy\": null,\r\n \"updatedOn\": null\r\n },\r\n \"enforcementMode\": \"Default\"\r\n },\r\n \"id\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521/providers/Microsoft.Authorization/policyAssignments/ps5563\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"ps5563\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521/providers/Microsoft.Authorization/policyAssignments/ps5563?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Jlc291cmNlR3JvdXBzL3BzMzUyMS9wcm92aWRlcnMvTWljcm9zb2Z0LkF1dGhvcml6YXRpb24vcG9saWN5QXNzaWdubWVudHMvcHM1NTYzP2FwaS12ZXJzaW9uPTIwMTktMDktMDE=", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "AzurePowershell/v1.0.0", + "PSVersion/v6.1.0" + ], + "ParameterSetName": [ + "InputObjectParameterSet" + ], + "CommandName": [ + "Remove-AzPolicyAssignment" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "westus:9b24f11a-e146-41cf-81d9-bdc53ae7a6fd" + ], + "x-ms-ratelimit-remaining-subscription-deletes": [ + "14999" + ], + "x-ms-correlation-request-id": [ + "61d46d46-4556-46c0-a73d-3d8bdccf3b1b" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004744Z:61d46d46-4556-46c0-a73d-3d8bdccf3b1b" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:47:43 GMT" + ], + "Content-Length": [ + "786" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"A0\",\r\n \"tier\": \"Free\"\r\n },\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policySetDefinitions/ps1081\",\r\n \"scope\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521\",\r\n \"description\": \"Updated Unit test junk: sorry for littering. Please delete me!\",\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:40.5306042Z\",\r\n \"updatedBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"updatedOn\": \"2020-01-17T00:47:42.9762361Z\"\r\n },\r\n \"enforcementMode\": \"Default\"\r\n },\r\n \"id\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521/providers/Microsoft.Authorization/policyAssignments/ps5563\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"ps5563\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policysetdefinitions/ps1081?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lzZXRkZWZpbml0aW9ucy9wczEwODE/YXBpLXZlcnNpb249MjAxOS0wOS0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "AzurePowershell/v1.0.0", + "PSVersion/v6.1.0" + ], + "ParameterSetName": [ + "SubscriptionIdParameterSet" + ], + "CommandName": [ + "Get-AzPolicySetDefinition" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "westus:7ab21e34-c8bf-4aab-8cca-ae02242291d1" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "x-ms-correlation-request-id": [ + "d813628d-170b-4c09-98e1-95f1887451eb" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004740Z:d813628d-170b-4c09-98e1-95f1887451eb" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:47:39 GMT" + ], + "Content-Length": [ + "651" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"policyType\": \"Custom\",\r\n \"description\": \"Unit test junk: sorry for littering. Please delete me!\",\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:37.0988351Z\",\r\n \"updatedBy\": null,\r\n \"updatedOn\": null\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionReferenceId\": \"5594624486481855834\",\r\n \"policyDefinitionId\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policyDefinitions/ps1556\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policySetDefinitions/ps1081\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"ps1081\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policysetdefinitions/ps1081?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lzZXRkZWZpbml0aW9ucy9wczEwODE/YXBpLXZlcnNpb249MjAxOS0wOS0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "AzurePowershell/v1.0.0", + "PSVersion/v6.1.0" + ], + "ParameterSetName": [ + "NameParameterSet" + ], + "CommandName": [ + "Get-AzPolicySetDefinition" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "westus:f935605b-2626-49e9-8c1d-5114269ed7d2" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "x-ms-correlation-request-id": [ + "1a887a59-2501-416b-9aa7-ad594ceb4c82" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004741Z:1a887a59-2501-416b-9aa7-ad594ceb4c82" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:47:41 GMT" + ], + "Content-Length": [ + "651" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"policyType\": \"Custom\",\r\n \"description\": \"Unit test junk: sorry for littering. Please delete me!\",\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:37.0988351Z\",\r\n \"updatedBy\": null,\r\n \"updatedOn\": null\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionReferenceId\": \"5594624486481855834\",\r\n \"policyDefinitionId\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policyDefinitions/ps1556\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policySetDefinitions/ps1081\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"ps1081\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policysetdefinitions/ps1081?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lzZXRkZWZpbml0aW9ucy9wczEwODE/YXBpLXZlcnNpb249MjAxOS0wOS0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "AzurePowershell/v1.0.0", + "PSVersion/v6.1.0" + ], + "ParameterSetName": [ + "NameParameterSet" + ], + "CommandName": [ + "Get-AzPolicySetDefinition" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "westus:29fb90ba-11f0-4eba-abcd-2357cf62ef00" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "x-ms-correlation-request-id": [ + "9949a9ae-ae8c-470e-85c8-82ff55d18209" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004742Z:9949a9ae-ae8c-470e-85c8-82ff55d18209" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:47:41 GMT" + ], + "Content-Length": [ + "719" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"policyType\": \"Custom\",\r\n \"description\": \"Updated Unit test junk: sorry for littering. Please delete me!\",\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:37.0988351Z\",\r\n \"updatedBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"updatedOn\": \"2020-01-17T00:47:42.2206235Z\"\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionReferenceId\": \"5594624486481855834\",\r\n \"policyDefinitionId\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policyDefinitions/ps1556\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policySetDefinitions/ps1081\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"ps1081\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policysetdefinitions/ps1081?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lzZXRkZWZpbml0aW9ucy9wczEwODE/YXBpLXZlcnNpb249MjAxOS0wOS0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "AzurePowershell/v1.0.0", + "PSVersion/v6.1.0" + ], + "ParameterSetName": [ + "SubscriptionIdParameterSet" + ], + "CommandName": [ + "Get-AzPolicySetDefinition" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "westus:d6bba9af-8cf2-4b6a-8034-3cceca8fb9ce" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "x-ms-correlation-request-id": [ + "65d81460-0ae7-44ad-8996-7b4110cc5b50" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004829Z:65d81460-0ae7-44ad-8996-7b4110cc5b50" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:48:28 GMT" + ], + "Content-Length": [ + "719" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"policyType\": \"Custom\",\r\n \"description\": \"Updated Unit test junk: sorry for littering. Please delete me!\",\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:37.0988351Z\",\r\n \"updatedBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"updatedOn\": \"2020-01-17T00:47:42.2206235Z\"\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionReferenceId\": \"5594624486481855834\",\r\n \"policyDefinitionId\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policyDefinitions/ps1556\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policySetDefinitions/ps1081\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"ps1081\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policyDefinitions/ps1556?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lEZWZpbml0aW9ucy9wczE1NTY/YXBpLXZlcnNpb249MjAxOS0wOS0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "AzurePowershell/v1.0.0", + "PSVersion/v6.1.0" + ], + "ParameterSetName": [ + "InputObjectParameterSet" + ], + "CommandName": [ + "Set-AzPolicyDefinition" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "westus:d01fb242-64b4-4d6a-80a2-824180faa326" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11998" + ], + "x-ms-correlation-request-id": [ + "a755434f-c376-47f3-b119-3a5a3329d4bb" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004741Z:a755434f-c376-47f3-b119-3a5a3329d4bb" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:47:40 GMT" + ], + "Content-Length": [ + "579" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Unit test junk: sorry for littering. Please delete me!\",\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:32.5332141Z\",\r\n \"updatedBy\": null,\r\n \"updatedOn\": null\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"Microsoft.Resources/Subscriptions/ResourceGroups/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policyDefinitions/ps1556\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"ps1556\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policyDefinitions/ps1556?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lEZWZpbml0aW9ucy9wczE1NTY/YXBpLXZlcnNpb249MjAxOS0wOS0wMQ==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"name\": \"ps1556\",\r\n \"properties\": {\r\n \"description\": \"Updated Unit test junk: sorry for littering. Please delete me!\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"Microsoft.Resources/Subscriptions/ResourceGroups/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n },\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:32.5332141Z\",\r\n \"updatedBy\": null,\r\n \"updatedOn\": null\r\n },\r\n \"mode\": \"All\",\r\n \"policyType\": \"Custom\"\r\n }\r\n}", + "RequestHeaders": { + "User-Agent": [ + "AzurePowershell/v1.0.0", + "PSVersion/v6.1.0" + ], + "ParameterSetName": [ + "InputObjectParameterSet" + ], + "CommandName": [ + "Set-AzPolicyDefinition" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "584" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "westus:4110d8c8-626a-4492-a586-f81232c31908" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-correlation-request-id": [ + "753087b2-9fb1-4f64-894b-68aeb196d0f6" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004741Z:753087b2-9fb1-4f64-894b-68aeb196d0f6" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:47:40 GMT" + ], + "Content-Length": [ + "646" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Updated Unit test junk: sorry for littering. Please delete me!\",\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:32.5332141Z\",\r\n \"updatedBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"updatedOn\": \"2020-01-17T00:47:41.246804Z\"\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"Microsoft.Resources/Subscriptions/ResourceGroups/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policyDefinitions/ps1556\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"ps1556\"\r\n}", + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policySetDefinitions/ps1081?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lTZXREZWZpbml0aW9ucy9wczEwODE/YXBpLXZlcnNpb249MjAxOS0wOS0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "AzurePowershell/v1.0.0", + "PSVersion/v6.1.0" + ], + "ParameterSetName": [ + "InputObjectParameterSet" + ], + "CommandName": [ + "Set-AzPolicySetDefinition" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "westus:2aa53c38-b740-432b-a8c4-e8eeaaac04e6" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "x-ms-correlation-request-id": [ + "867d03fb-87f4-46d2-85dd-a479e9fb0a63" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004741Z:867d03fb-87f4-46d2-85dd-a479e9fb0a63" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:47:40 GMT" + ], + "Content-Length": [ + "651" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"policyType\": \"Custom\",\r\n \"description\": \"Unit test junk: sorry for littering. Please delete me!\",\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:37.0988351Z\",\r\n \"updatedBy\": null,\r\n \"updatedOn\": null\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionReferenceId\": \"5594624486481855834\",\r\n \"policyDefinitionId\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policyDefinitions/ps1556\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policySetDefinitions/ps1081\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"ps1081\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policySetDefinitions/ps1081?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lTZXREZWZpbml0aW9ucy9wczEwODE/YXBpLXZlcnNpb249MjAxOS0wOS0wMQ==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"name\": \"ps1081\",\r\n \"properties\": {\r\n \"description\": \"Updated Unit test junk: sorry for littering. Please delete me!\",\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:37.0988351Z\",\r\n \"updatedBy\": null,\r\n \"updatedOn\": null\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionReferenceId\": \"5594624486481855834\",\r\n \"policyDefinitionId\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policyDefinitions/ps1556\"\r\n }\r\n ],\r\n \"policyType\": \"Custom\"\r\n }\r\n}", + "RequestHeaders": { + "User-Agent": [ + "AzurePowershell/v1.0.0", + "PSVersion/v6.1.0" + ], + "ParameterSetName": [ + "InputObjectParameterSet" + ], + "CommandName": [ + "Set-AzPolicySetDefinition" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "614" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "westus:a920154e-2f97-499c-8fe4-41e9f19ba38a" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-correlation-request-id": [ + "ac65316b-ae73-453d-bd0d-1e6d089db0d5" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004742Z:ac65316b-ae73-453d-bd0d-1e6d089db0d5" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:47:42 GMT" + ], + "Content-Length": [ + "719" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"policyType\": \"Custom\",\r\n \"description\": \"Updated Unit test junk: sorry for littering. Please delete me!\",\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:37.0988351Z\",\r\n \"updatedBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"updatedOn\": \"2020-01-17T00:47:42.2206235Z\"\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionReferenceId\": \"5594624486481855834\",\r\n \"policyDefinitionId\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policyDefinitions/ps1556\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policySetDefinitions/ps1081\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"ps1081\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521/providers/Microsoft.Authorization/policyAssignments/ps5563?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Jlc291cmNlR3JvdXBzL3BzMzUyMS9wcm92aWRlcnMvTWljcm9zb2Z0LkF1dGhvcml6YXRpb24vcG9saWN5QXNzaWdubWVudHMvcHM1NTYzP2FwaS12ZXJzaW9uPTIwMTktMDktMDE=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "AzurePowershell/v1.0.0", + "PSVersion/v6.1.0" + ], + "ParameterSetName": [ + "InputObjectParameterSet" + ], + "CommandName": [ + "Set-AzPolicyAssignment" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "westus:ee01ef70-964e-47fe-874d-08f6127ce444" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "x-ms-correlation-request-id": [ + "008e96ba-0435-4206-8200-97f840505f05" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004742Z:008e96ba-0435-4206-8200-97f840505f05" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:47:41 GMT" + ], + "Content-Length": [ + "718" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"A0\",\r\n \"tier\": \"Free\"\r\n },\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policySetDefinitions/ps1081\",\r\n \"scope\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521\",\r\n \"description\": \"Unit test junk: sorry for littering. Please delete me!\",\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:40.5306042Z\",\r\n \"updatedBy\": null,\r\n \"updatedOn\": null\r\n },\r\n \"enforcementMode\": \"Default\"\r\n },\r\n \"id\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521/providers/Microsoft.Authorization/policyAssignments/ps5563\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"ps5563\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521/providers/Microsoft.Authorization/policyAssignments/ps5563?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Jlc291cmNlR3JvdXBzL3BzMzUyMS9wcm92aWRlcnMvTWljcm9zb2Z0LkF1dGhvcml6YXRpb24vcG9saWN5QXNzaWdubWVudHMvcHM1NTYzP2FwaS12ZXJzaW9uPTIwMTktMDktMDE=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"scope\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521\",\r\n \"description\": \"Updated Unit test junk: sorry for littering. Please delete me!\",\r\n \"enforcementMode\": \"Default\",\r\n \"policyDefinitionId\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policySetDefinitions/ps1081\"\r\n },\r\n \"name\": \"ps5563\"\r\n}", + "RequestHeaders": { + "User-Agent": [ + "AzurePowershell/v1.0.0", + "PSVersion/v6.1.0" + ], + "ParameterSetName": [ + "InputObjectParameterSet" + ], + "CommandName": [ + "Set-AzPolicyAssignment" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "404" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "westus:79be4601-966b-40f4-8f30-78eb666038da" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-correlation-request-id": [ + "e2999a4f-083e-4cd0-b64e-516917649cdc" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004743Z:e2999a4f-083e-4cd0-b64e-516917649cdc" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:47:43 GMT" + ], + "Content-Length": [ + "786" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"A0\",\r\n \"tier\": \"Free\"\r\n },\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policySetDefinitions/ps1081\",\r\n \"scope\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521\",\r\n \"description\": \"Updated Unit test junk: sorry for littering. Please delete me!\",\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:40.5306042Z\",\r\n \"updatedBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"updatedOn\": \"2020-01-17T00:47:42.9762361Z\"\r\n },\r\n \"enforcementMode\": \"Default\"\r\n },\r\n \"id\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourceGroups/ps3521/providers/Microsoft.Authorization/policyAssignments/ps5563\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"ps5563\"\r\n}", + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/resourcegroups/ps3521?api-version=2019-07-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Jlc291cmNlZ3JvdXBzL3BzMzUyMT9hcGktdmVyc2lvbj0yMDE5LTA3LTAx", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "f318a616-bc48-4831-a996-596e290a803e" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28207.04", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/3.0.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Location": [ + "https://management.azure.com/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1QUzM1MjEtV0VTVFVTIiwiam9iTG9jYXRpb24iOiJ3ZXN0dXMifQ?api-version=2019-07-01" + ], + "Retry-After": [ + "0" + ], + "x-ms-ratelimit-remaining-subscription-deletes": [ + "14999" + ], + "x-ms-request-id": [ + "0544b347-6fae-4721-baf3-67c5f5a5fe05" + ], + "x-ms-correlation-request-id": [ + "0544b347-6fae-4721-baf3-67c5f5a5fe05" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004744Z:0544b347-6fae-4721-baf3-67c5f5a5fe05" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:47:44 GMT" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1QUzM1MjEtV0VTVFVTIiwiam9iTG9jYXRpb24iOiJ3ZXN0dXMifQ?api-version=2019-07-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFRVXpNMU1qRXRWMFZUVkZWVElpd2lhbTlpVEc5allYUnBiMjRpT2lKM1pYTjBkWE1pZlE/YXBpLXZlcnNpb249MjAxOS0wNy0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28207.04", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/3.0.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Location": [ + "https://management.azure.com/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1QUzM1MjEtV0VTVFVTIiwiam9iTG9jYXRpb24iOiJ3ZXN0dXMifQ?api-version=2019-07-01" + ], + "Retry-After": [ + "0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11998" + ], + "x-ms-request-id": [ + "6327d276-05bf-44a7-892f-f3b1fd025528" + ], + "x-ms-correlation-request-id": [ + "6327d276-05bf-44a7-892f-f3b1fd025528" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004759Z:6327d276-05bf-44a7-892f-f3b1fd025528" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:47:59 GMT" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1QUzM1MjEtV0VTVFVTIiwiam9iTG9jYXRpb24iOiJ3ZXN0dXMifQ?api-version=2019-07-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFRVXpNMU1qRXRWMFZUVkZWVElpd2lhbTlpVEc5allYUnBiMjRpT2lKM1pYTjBkWE1pZlE/YXBpLXZlcnNpb249MjAxOS0wNy0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28207.04", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/3.0.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Location": [ + "https://management.azure.com/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1QUzM1MjEtV0VTVFVTIiwiam9iTG9jYXRpb24iOiJ3ZXN0dXMifQ?api-version=2019-07-01" + ], + "Retry-After": [ + "0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11997" + ], + "x-ms-request-id": [ + "f5d81b22-d56d-4854-9bdd-ce54dfb71b52" + ], + "x-ms-correlation-request-id": [ + "f5d81b22-d56d-4854-9bdd-ce54dfb71b52" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004814Z:f5d81b22-d56d-4854-9bdd-ce54dfb71b52" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:48:13 GMT" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1QUzM1MjEtV0VTVFVTIiwiam9iTG9jYXRpb24iOiJ3ZXN0dXMifQ?api-version=2019-07-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFRVXpNMU1qRXRWMFZUVkZWVElpd2lhbTlpVEc5allYUnBiMjRpT2lKM1pYTjBkWE1pZlE/YXBpLXZlcnNpb249MjAxOS0wNy0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28207.04", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/3.0.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11996" + ], + "x-ms-request-id": [ + "28eaf921-67c1-475e-9797-d9deb2f4416c" + ], + "x-ms-correlation-request-id": [ + "28eaf921-67c1-475e-9797-d9deb2f4416c" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004829Z:28eaf921-67c1-475e-9797-d9deb2f4416c" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:48:28 GMT" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "0" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1QUzM1MjEtV0VTVFVTIiwiam9iTG9jYXRpb24iOiJ3ZXN0dXMifQ?api-version=2019-07-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFRVXpNMU1qRXRWMFZUVkZWVElpd2lhbTlpVEc5allYUnBiMjRpT2lKM1pYTjBkWE1pZlE/YXBpLXZlcnNpb249MjAxOS0wNy0wMQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28207.04", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/3.0.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11995" + ], + "x-ms-request-id": [ + "7eb4df49-ee69-43b3-b897-bb18bd582c33" + ], + "x-ms-correlation-request-id": [ + "7eb4df49-ee69-43b3-b897-bb18bd582c33" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004829Z:7eb4df49-ee69-43b3-b897-bb18bd582c33" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:48:28 GMT" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "0" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policySetDefinitions/ps1081?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lTZXREZWZpbml0aW9ucy9wczEwODE/YXBpLXZlcnNpb249MjAxOS0wOS0wMQ==", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "AzurePowershell/v1.0.0", + "PSVersion/v6.1.0" + ], + "ParameterSetName": [ + "InputObjectParameterSet" + ], + "CommandName": [ + "Remove-AzPolicySetDefinition" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "westus:a33af1ef-360a-4dd5-9f70-424f8a76b989" + ], + "x-ms-ratelimit-remaining-subscription-deletes": [ + "14999" + ], + "x-ms-correlation-request-id": [ + "0b4a493d-f560-4b35-9af3-fbea20e6af53" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004830Z:0b4a493d-f560-4b35-9af3-fbea20e6af53" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:48:29 GMT" + ], + "Content-Length": [ + "719" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"policyType\": \"Custom\",\r\n \"description\": \"Updated Unit test junk: sorry for littering. Please delete me!\",\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:37.0988351Z\",\r\n \"updatedBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"updatedOn\": \"2020-01-17T00:47:42.2206235Z\"\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionReferenceId\": \"5594624486481855834\",\r\n \"policyDefinitionId\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policyDefinitions/ps1556\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policySetDefinitions/ps1081\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"ps1081\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policyDefinitions/ps1556?api-version=2019-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDBkNzdmOGUtNTk4Mi00ZTdlLWJhZmEtYjdjZDIzYjEyM2U2L3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lEZWZpbml0aW9ucy9wczE1NTY/YXBpLXZlcnNpb249MjAxOS0wOS0wMQ==", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "AzurePowershell/v1.0.0", + "PSVersion/v6.1.0" + ], + "ParameterSetName": [ + "InputObjectParameterSet" + ], + "CommandName": [ + "Remove-AzPolicyDefinition" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "westus:474e419d-1182-4a5c-9e4b-5edc593f2be0" + ], + "x-ms-ratelimit-remaining-subscription-deletes": [ + "14999" + ], + "x-ms-correlation-request-id": [ + "714715dd-0dc3-4629-92bb-baa443ce0c5c" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200117T004830Z:714715dd-0dc3-4629-92bb-baa443ce0c5c" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 17 Jan 2020 00:48:30 GMT" + ], + "Content-Length": [ + "646" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Retry-After": [ + "0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Updated Unit test junk: sorry for littering. Please delete me!\",\r\n \"metadata\": {\r\n \"createdBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"createdOn\": \"2020-01-17T00:47:32.5332141Z\",\r\n \"updatedBy\": \"094435f3-a5d5-4c38-abfb-238662bec758\",\r\n \"updatedOn\": \"2020-01-17T00:47:41.246804Z\"\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"Microsoft.Resources/Subscriptions/ResourceGroups/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/40d77f8e-5982-4e7e-bafa-b7cd23b123e6/providers/Microsoft.Authorization/policyDefinitions/ps1556\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"ps1556\"\r\n}", + "StatusCode": 200 + } + ], + "Names": { + "Test-PolicyObjectPiping": [ + "ps3521", + "ps1081", + "ps1556", + "ps5563" + ] + }, + "Variables": { + "SubscriptionId": "40d77f8e-5982-4e7e-bafa-b7cd23b123e6" + } +} \ No newline at end of file diff --git a/src/Resources/Resources/ChangeLog.md b/src/Resources/Resources/ChangeLog.md index 049987695bec..bfa05df00220 100644 --- a/src/Resources/Resources/ChangeLog.md +++ b/src/Resources/Resources/ChangeLog.md @@ -19,6 +19,7 @@ --> ## Upcoming Release * Fix for null reference bug in GetAzureRoleAssignmentCommand +* Breaking changes for policy cmdlets to support typed pipeline objects ## Version 1.11.0 * Refactored template deployment cmdlets diff --git a/src/Resources/Resources/help/New-AzPolicyAssignment.md b/src/Resources/Resources/help/New-AzPolicyAssignment.md index 4951879a3b9e..3ee8720de5f6 100644 --- a/src/Resources/Resources/help/New-AzPolicyAssignment.md +++ b/src/Resources/Resources/help/New-AzPolicyAssignment.md @@ -16,7 +16,8 @@ Creates a policy assignment. ### DefaultParameterSet (Default) ``` New-AzPolicyAssignment -Name [-Scope ] [-NotScope ] [-DisplayName ] - [-Description ] [-PolicyDefinition ] [-PolicySetDefinition ] [-Metadata ] + [-Description ] [-PolicyDefinition ] + [-PolicySetDefinition ] [-Metadata ] [-EnforcementMode ] [-AssignIdentity] [-Location ] [-ApiVersion ] [-Pre] [-DefaultProfile ] [] ``` @@ -24,7 +25,7 @@ New-AzPolicyAssignment -Name [-Scope ] [-NotScope ] [ ### PolicyParameterObjectParameterSet ``` New-AzPolicyAssignment -Name [-Scope ] [-NotScope ] [-DisplayName ] - [-Description ] -PolicyDefinition [-PolicySetDefinition ] + [-Description ] -PolicyDefinition [-PolicySetDefinition ] -PolicyParameterObject [-Metadata ] [-EnforcementMode ] [-AssignIdentity] [-Location ] [-ApiVersion ] [-Pre] [-DefaultProfile ] [] @@ -33,7 +34,7 @@ New-AzPolicyAssignment -Name [-Scope ] [-NotScope ] [ ### PolicyParameterStringParameterSet ``` New-AzPolicyAssignment -Name [-Scope ] [-NotScope ] [-DisplayName ] - [-Description ] -PolicyDefinition [-PolicySetDefinition ] + [-Description ] -PolicyDefinition [-PolicySetDefinition ] -PolicyParameter [-Metadata ] [-EnforcementMode ] [-AssignIdentity] [-Location ] [-ApiVersion ] [-Pre] [-DefaultProfile ] [] @@ -42,7 +43,7 @@ New-AzPolicyAssignment -Name [-Scope ] [-NotScope ] [ ### PolicySetParameterObjectParameterSet ``` New-AzPolicyAssignment -Name [-Scope ] [-NotScope ] [-DisplayName ] - [-Description ] [-PolicyDefinition ] -PolicySetDefinition + [-Description ] [-PolicyDefinition ] -PolicySetDefinition -PolicyParameterObject [-Metadata ] [-EnforcementMode ] [-AssignIdentity] [-Location ] [-ApiVersion ] [-Pre] [-DefaultProfile ] [] @@ -51,7 +52,7 @@ New-AzPolicyAssignment -Name [-Scope ] [-NotScope ] [ ### PolicySetParameterStringParameterSet ``` New-AzPolicyAssignment -Name [-Scope ] [-NotScope ] [-DisplayName ] - [-Description ] [-PolicyDefinition ] -PolicySetDefinition + [-Description ] [-PolicyDefinition ] -PolicySetDefinition -PolicyParameter [-Metadata ] [-EnforcementMode ] [-AssignIdentity] [-Location ] [-ApiVersion ] [-Pre] [-DefaultProfile ] [] @@ -309,7 +310,7 @@ Accept wildcard characters: False Specifies a policy, as a **PsPolicyDefinition** object that contains the policy rule. ```yaml -Type: System.Management.Automation.PSObject +Type: Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.Policy.PsPolicyDefinition Parameter Sets: DefaultParameterSet Aliases: @@ -321,7 +322,7 @@ Accept wildcard characters: False ``` ```yaml -Type: System.Management.Automation.PSObject +Type: Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.Policy.PsPolicyDefinition Parameter Sets: PolicyParameterObjectParameterSet, PolicyParameterStringParameterSet Aliases: @@ -333,7 +334,7 @@ Accept wildcard characters: False ``` ```yaml -Type: System.Management.Automation.PSObject +Type: Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.Policy.PsPolicyDefinition Parameter Sets: PolicySetParameterObjectParameterSet, PolicySetParameterStringParameterSet Aliases: @@ -378,7 +379,7 @@ Accept wildcard characters: False The policy set definition object. ```yaml -Type: System.Management.Automation.PSObject +Type: Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.Policy.PsPolicySetDefinition Parameter Sets: DefaultParameterSet Aliases: @@ -390,7 +391,7 @@ Accept wildcard characters: False ``` ```yaml -Type: System.Management.Automation.PSObject +Type: Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.Policy.PsPolicySetDefinition Parameter Sets: PolicyParameterObjectParameterSet, PolicyParameterStringParameterSet Aliases: @@ -402,7 +403,7 @@ Accept wildcard characters: False ``` ```yaml -Type: System.Management.Automation.PSObject +Type: Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.Policy.PsPolicySetDefinition Parameter Sets: PolicySetParameterObjectParameterSet, PolicySetParameterStringParameterSet Aliases: diff --git a/src/Resources/Resources/help/Remove-AzPolicyAssignment.md b/src/Resources/Resources/help/Remove-AzPolicyAssignment.md index 8393118b139d..3d991dd7e32c 100644 --- a/src/Resources/Resources/help/Remove-AzPolicyAssignment.md +++ b/src/Resources/Resources/help/Remove-AzPolicyAssignment.md @@ -25,6 +25,12 @@ Remove-AzPolicyAssignment -Id [-ApiVersion ] [-Pre] [-DefaultPr [-WhatIf] [-Confirm] [] ``` +### InputObjectParameterSet +``` +Remove-AzPolicyAssignment -InputObject [-ApiVersion ] [-Pre] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + ## DESCRIPTION The **Remove-AzPolicyAssignment** cmdlet removes the specified policy assignment. @@ -101,6 +107,21 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -InputObject +The policy assignment object to remove that was output from another cmdlet. + +```yaml +Type: Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.Policy.PsPolicyAssignment +Parameter Sets: InputObjectParameterSet +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName, ByValue) +Accept wildcard characters: False +``` + ### -Name Specifies the name of the policy assignment that this cmdlet removes. diff --git a/src/Resources/Resources/help/Remove-AzPolicyDefinition.md b/src/Resources/Resources/help/Remove-AzPolicyDefinition.md index 7fc9bb497793..95709bc3df3b 100644 --- a/src/Resources/Resources/help/Remove-AzPolicyDefinition.md +++ b/src/Resources/Resources/help/Remove-AzPolicyDefinition.md @@ -37,6 +37,12 @@ Remove-AzPolicyDefinition -Id [-Force] [-ApiVersion ] [-Pre] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` +### InputObjectParameterSet +``` +Remove-AzPolicyDefinition [-Force] -InputObject [-ApiVersion ] [-Pre] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + ## DESCRIPTION The **Remove-AzPolicyDefinition** cmdlet removes a policy definition. @@ -122,6 +128,21 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -InputObject +The policy definition object to remove that was output from another cmdlet. + +```yaml +Type: Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.Policy.PsPolicyDefinition +Parameter Sets: InputObjectParameterSet +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName, ByValue) +Accept wildcard characters: False +``` + ### -ManagementGroupName The name of the management group of the policy definition to delete. diff --git a/src/Resources/Resources/help/Remove-AzPolicySetDefinition.md b/src/Resources/Resources/help/Remove-AzPolicySetDefinition.md index e8452d9d88f3..8e4275fc24ca 100644 --- a/src/Resources/Resources/help/Remove-AzPolicySetDefinition.md +++ b/src/Resources/Resources/help/Remove-AzPolicySetDefinition.md @@ -36,6 +36,12 @@ Remove-AzPolicySetDefinition -Id [-Force] [-ApiVersion ] [-Pre] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` +### InputObjectParameterSet +``` +Remove-AzPolicySetDefinition [-Force] -InputObject [-ApiVersion ] [-Pre] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + ## DESCRIPTION The **Remove-AzPolicySetDefinition** cmdlet removes a policy definition. @@ -116,6 +122,21 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -InputObject +The policy set definition object to remove that was output from another cmdlet. + +```yaml +Type: Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.Policy.PsPolicySetDefinition +Parameter Sets: InputObjectParameterSet +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName, ByValue) +Accept wildcard characters: False +``` + ### -ManagementGroupName The name of the management group of the policy set definition to delete. diff --git a/src/Resources/Resources/help/Set-AzPolicyAssignment.md b/src/Resources/Resources/help/Set-AzPolicyAssignment.md index 60f017720367..b8e243947c0d 100644 --- a/src/Resources/Resources/help/Set-AzPolicyAssignment.md +++ b/src/Resources/Resources/help/Set-AzPolicyAssignment.md @@ -61,6 +61,14 @@ Set-AzPolicyAssignment [-NotScope ] -Id [-DisplayName ] [] ``` +### InputObjectParameterSet +``` +Set-AzPolicyAssignment [-NotScope ] [-DisplayName ] [-Description ] + [-Metadata ] [-AssignIdentity] [-Location ] + [-EnforcementMode ] -InputObject [-ApiVersion ] + [-Pre] [-DefaultProfile ] [] +``` + ## DESCRIPTION The **Set-AzPolicyAssignment** cmdlet modifies a policy assignment. Specify an assignment by ID or by name and scope. @@ -248,6 +256,21 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -InputObject +The policy assignment object to update that was output from another cmdlet. + +```yaml +Type: Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.Policy.PsPolicyAssignment +Parameter Sets: InputObjectParameterSet +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName, ByValue) +Accept wildcard characters: False +``` + ### -Location The location of the policy assignment's resource identity. This is required when the -AssignIdentity switch is used. diff --git a/src/Resources/Resources/help/Set-AzPolicyDefinition.md b/src/Resources/Resources/help/Set-AzPolicyDefinition.md index c2fa2680cbe1..07e9f16f00e7 100644 --- a/src/Resources/Resources/help/Set-AzPolicyDefinition.md +++ b/src/Resources/Resources/help/Set-AzPolicyDefinition.md @@ -41,6 +41,13 @@ Set-AzPolicyDefinition -Id [-DisplayName ] [-Description ] [] ``` +### InputObjectParameterSet +``` +Set-AzPolicyDefinition [-DisplayName ] [-Description ] [-Policy ] [-Metadata ] + [-Parameter ] [-Mode ] -InputObject [-ApiVersion ] [-Pre] + [-DefaultProfile ] [] +``` + ## DESCRIPTION The **Set-AzPolicyDefinition** cmdlet modifies a policy definition. @@ -158,6 +165,21 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -InputObject +The policy definition object to update that was output from another cmdlet. + +```yaml +Type: Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.Policy.PsPolicyDefinition +Parameter Sets: InputObjectParameterSet +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName, ByValue) +Accept wildcard characters: False +``` + ### -ManagementGroupName The name of the management group of the policy definition to update. diff --git a/src/Resources/Resources/help/Set-AzPolicySetDefinition.md b/src/Resources/Resources/help/Set-AzPolicySetDefinition.md index 0a17606305eb..746eb4a24184 100644 --- a/src/Resources/Resources/help/Set-AzPolicySetDefinition.md +++ b/src/Resources/Resources/help/Set-AzPolicySetDefinition.md @@ -44,6 +44,14 @@ Set-AzPolicySetDefinition -Id [-DisplayName ] [-Description ] ``` +### InputObjectParameterSet +``` +Set-AzPolicySetDefinition [-DisplayName ] [-Description ] [-PolicyDefinition ] + [-Metadata ] [-Parameter ] -InputObject [-GroupDefinition ] + [-ApiVersion ] [-Pre] [-DefaultProfile ] [-WhatIf] [-Confirm] + [] +``` + ## DESCRIPTION The **Set-AzPolicySetDefinition** cmdlet modifies a policy definition. @@ -185,6 +193,21 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -InputObject +The policy set definition object to update that was output from another cmdlet. + +```yaml +Type: Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.Policy.PsPolicySetDefinition +Parameter Sets: InputObjectParameterSet +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName, ByValue) +Accept wildcard characters: False +``` + ### -ManagementGroupName The name of the management group of the policy set definition to update. diff --git a/tools/StaticAnalysis/Exceptions/Az.Resources/BreakingChangeIssues.csv b/tools/StaticAnalysis/Exceptions/Az.Resources/BreakingChangeIssues.csv index 94820352a0d7..9922509dda3f 100644 --- a/tools/StaticAnalysis/Exceptions/Az.Resources/BreakingChangeIssues.csv +++ b/tools/StaticAnalysis/Exceptions/Az.Resources/BreakingChangeIssues.csv @@ -105,6 +105,8 @@ "Microsoft.Azure.PowerShell.Cmdlets.ResourceManager.Cmdlets.dll","Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzurePolicyAssignmentCmdlet","New-AzPolicyAssignment","0","1050","The parameter set 'PolicyParameterStringParameterSet' for cmdlet 'New-AzPolicyAssignment' has been removed.","Add parameter set 'PolicyParameterStringParameterSet' back to cmdlet 'New-AzPolicyAssignment'." "Microsoft.Azure.PowerShell.Cmdlets.ResourceManager.Cmdlets.dll","Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzurePolicyAssignmentCmdlet","New-AzPolicyAssignment","0","1050","The parameter set 'PolicySetParameterObjectParameterSet' for cmdlet 'New-AzPolicyAssignment' has been removed.","Add parameter set 'PolicySetParameterObjectParameterSet' back to cmdlet 'New-AzPolicyAssignment'." "Microsoft.Azure.PowerShell.Cmdlets.ResourceManager.Cmdlets.dll","Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzurePolicyAssignmentCmdlet","New-AzPolicyAssignment","0","1050","The parameter set 'PolicySetParameterStringParameterSet' for cmdlet 'New-AzPolicyAssignment' has been removed.","Add parameter set 'PolicySetParameterStringParameterSet' back to cmdlet 'New-AzPolicyAssignment'." +"Microsoft.Azure.PowerShell.Cmdlets.ResourceManager.dll","Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzurePolicyAssignmentCmdlet","New-AzPolicyAssignment","0","2020","The cmdlet 'New-AzPolicyAssignment' no longer supports the type 'System.Management.Automation.PSObject' for parameter 'PolicyDefinition'.","Change the type for parameter 'PolicyDefinition' back to 'System.Management.Automation.PSObject'." +"Microsoft.Azure.PowerShell.Cmdlets.ResourceManager.dll","Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzurePolicyAssignmentCmdlet","New-AzPolicyAssignment","0","2020","The cmdlet 'New-AzPolicyAssignment' no longer supports the type 'System.Management.Automation.PSObject' for parameter 'PolicySetDefinition'.","Change the type for parameter 'PolicySetDefinition' back to 'System.Management.Automation.PSObject'." "Microsoft.Azure.PowerShell.Cmdlets.ResourceManager.Cmdlets.dll","Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.SetAzurePolicyAssignmentCmdlet","Set-AzPolicyAssignment","0","2000","The cmdlet 'Set-AzPolicyAssignment' no longer supports the parameter 'Sku' and no alias was found for the original parameter name.","Add the parameter 'Sku' back to the cmdlet 'Set-AzPolicyAssignment', or add an alias to the original parameter name." "Microsoft.Azure.PowerShell.Cmdlets.ResourceManager.Cmdlets.dll","Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.SetAzurePolicyAssignmentCmdlet","Set-AzPolicyAssignment","0","1050","The parameter set 'NameParameterSet' for cmdlet 'Set-AzPolicyAssignment' has been removed.","Add parameter set 'NameParameterSet' back to cmdlet 'Set-AzPolicyAssignment'." "Microsoft.Azure.PowerShell.Cmdlets.ResourceManager.Cmdlets.dll","Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.SetAzurePolicyAssignmentCmdlet","Set-AzPolicyAssignment","0","1050","The parameter set '__AllParameterSets' for cmdlet 'Set-AzPolicyAssignment' has been removed.","Add parameter set '__AllParameterSets' back to cmdlet 'Set-AzPolicyAssignment'."