diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Components/Constants.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Components/Constants.cs
index f07ac4c69e79..6d1f11c00104 100644
--- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Components/Constants.cs
+++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Components/Constants.cs
@@ -63,7 +63,7 @@ public static class Constants
///
/// The default policy API version.
///
- public static readonly string PolicyApiVersion = "2016-04-01";
+ public static readonly string PolicyApiVersion = "2016-12-01";
///
/// The default providers API version.
diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Entities/Policy/PolicyAssignmentProperties.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Entities/Policy/PolicyAssignmentProperties.cs
index 228c08c32b44..4e012de2d347 100644
--- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Entities/Policy/PolicyAssignmentProperties.cs
+++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Entities/Policy/PolicyAssignmentProperties.cs
@@ -15,6 +15,7 @@
namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.Policy
{
using Newtonsoft.Json;
+ using Newtonsoft.Json.Linq;
///
/// The policy assignment properties.
@@ -38,5 +39,11 @@ public class PolicyAssignmentProperties
///
[JsonProperty(Required = Required.Always)]
public string PolicyDefinitionId { get; set; }
+
+ ///
+ /// The parameter values.
+ ///
+ [JsonProperty(Required = Required.Default)]
+ public JObject Parameters { get; set; }
}
}
\ No newline at end of file
diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Entities/Policy/PolicyDefinitionProperties.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Entities/Policy/PolicyDefinitionProperties.cs
index be4ebb066e33..fcddb0645fae 100644
--- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Entities/Policy/PolicyDefinitionProperties.cs
+++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Entities/Policy/PolicyDefinitionProperties.cs
@@ -39,5 +39,11 @@ public class PolicyDefinitionProperties
///
[JsonProperty(Required = Required.Always)]
public JObject PolicyRule { get; set; }
+
+ ///
+ /// The parameters declaration.
+ ///
+ [JsonProperty(Required = Required.Default)]
+ public JObject Parameters { get; set; }
}
}
diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Extensions/JsonExtensions.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Extensions/JsonExtensions.cs
index 15d4f893a713..cc78c412bb0f 100644
--- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Extensions/JsonExtensions.cs
+++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Extensions/JsonExtensions.cs
@@ -19,6 +19,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System;
+ using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
@@ -212,5 +213,31 @@ public static bool TryConvertTo(this JToken jobject, out TType result)
result = default(TType);
return false;
}
+
+ ///
+ /// Converts an object to with an extra level labeled as "value".
+ ///
+ /// The object.
+ /// The key set to extract from the object. Default is all keys.
+ /// The conversion result.
+ public static JObject ToJObjectWithValue(this IDictionary dict, IEnumerable keys = null)
+ {
+ if (dict == null)
+ {
+ return null;
+ }
+ if (keys == null)
+ {
+ keys = dict.Keys;
+ }
+ var parameterObject = new JObject();
+ foreach (string paramKey in keys)
+ {
+ var valueObject = new JObject();
+ valueObject.Add("value", dict[paramKey].ToJToken());
+ parameterObject.Add(paramKey, valueObject);
+ }
+ return parameterObject;
+ }
}
-}
\ No newline at end of file
+}
diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Extensions/PsObjectExtensions.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Extensions/PsObjectExtensions.cs
index 9e5270ceae9b..39bcea747bc8 100644
--- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Extensions/PsObjectExtensions.cs
+++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Extensions/PsObjectExtensions.cs
@@ -133,5 +133,32 @@ private static JToken ToJToken(object value)
return new JValue(value.ToString());
}
+
+ ///
+ /// Gets nested property values from a easily using property path.
+ ///
+ /// The to get property value from.
+ /// The nested property path, e.g. "metadata.description".
+ /// The value of the specified property.
+ internal static object GetPSObjectProperty(this PSObject propertyObject, string propertyPath)
+ {
+ var propertyNames = propertyPath.Split('.');
+ var tmpObject = propertyObject;
+ foreach (var propertyName in propertyNames)
+ {
+ var propertyInfo = tmpObject.Properties[propertyName];
+ if (propertyInfo != null)
+ {
+ if (propertyInfo.Value is PSObject)
+ {
+ tmpObject = propertyInfo.Value as PSObject;
+ continue;
+ }
+ return propertyInfo.Value;
+ }
+ return null;
+ }
+ return tmpObject;
+ }
}
}
diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/NewAzurePolicyAssignment.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/NewAzurePolicyAssignment.cs
index 7d5ebca5f24f..77dea304ffc6 100644
--- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/NewAzurePolicyAssignment.cs
+++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/NewAzurePolicyAssignment.cs
@@ -17,15 +17,26 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components;
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.Policy;
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions;
+ using Microsoft.Azure.Commands.Common.Authentication;
+ using Microsoft.WindowsAzure.Commands.Utilities.Common;
using Newtonsoft.Json.Linq;
using System.Management.Automation;
+ using System;
+ using System.Linq;
+ using System.Collections;
///
/// Creates a policy assignment.
///
- [Cmdlet(VerbsCommon.New, "AzureRmPolicyAssignment"), OutputType(typeof(PSObject))]
- public class NewAzurePolicyAssignmentCmdlet : PolicyAssignmentCmdletBase
+ [Cmdlet(VerbsCommon.New, "AzureRmPolicyAssignment", DefaultParameterSetName = ParameterlessPolicyParameterSetName), OutputType(typeof(PSObject))]
+ public class NewAzurePolicyAssignmentCmdlet : PolicyAssignmentCmdletBase, IDynamicParameters
{
+ protected RuntimeDefinedParameterDictionary dynamicParameters = new RuntimeDefinedParameterDictionary();
+
+ protected const string PolicyParameterObjectParameterSetName = "Policy assignment with parameters via policy parameter object";
+ protected const string PolicyParameterStringParameterSetName = "Policy assignment with parameters via policy parameter string";
+ protected const string ParameterlessPolicyParameterSetName = "Policy assignment without parameters";
+
///
/// Gets or sets the policy assignment name parameter.
///
@@ -50,9 +61,30 @@ public class NewAzurePolicyAssignmentCmdlet : PolicyAssignmentCmdletBase
///
/// Gets or sets the policy assignment policy definition parameter.
///
- [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The pollicy definition object.")]
+ [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The policy definition object.")]
+ [Parameter(ParameterSetName = ParameterlessPolicyParameterSetName,
+ Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The policy definition object.")]
+ [Parameter(ParameterSetName = PolicyParameterObjectParameterSetName,
+ Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The policy definition object.")]
+ [Parameter(ParameterSetName = PolicyParameterStringParameterSetName,
+ Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The policy definition object.")]
public PSObject PolicyDefinition { get; set; }
+ ///
+ /// Gets or sets the policy assignment policy parameter object.
+ ///
+ [Parameter(ParameterSetName = PolicyParameterObjectParameterSetName,
+ Mandatory = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The policy parameter object.")]
+ public Hashtable PolicyParameterObject { get; set; }
+
+ ///
+ /// Gets or sets the policy assignment policy parameter file path or policy parameter string.
+ ///
+ [Parameter(ParameterSetName = PolicyParameterStringParameterSetName,
+ Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The policy parameter file path or policy parameter string.")]
+ [ValidateNotNullOrEmpty]
+ public string PolicyParameter { get; set; }
+
///
/// Executes the cmdlet.
///
@@ -112,11 +144,72 @@ private JToken GetResource()
{
DisplayName = this.DisplayName ?? null,
PolicyDefinitionId = this.PolicyDefinition.Properties["policyDefinitionId"].Value.ToString(),
- Scope = this.Scope
+ Scope = this.Scope,
+ Parameters = this.GetParameters()
}
};
return policyassignmentObject.ToJToken();
}
+
+ object IDynamicParameters.GetDynamicParameters()
+ {
+ if (this.PolicyDefinition != null)
+ {
+ var parameters = this.PolicyDefinition.GetPSObjectProperty("Properties.parameters") as PSObject;
+ if (parameters != null)
+ {
+ foreach (var param in parameters.Properties)
+ {
+ var type = (param.Value as PSObject).Properties["type"];
+ var typeString = type != null ? type.Value.ToString() : string.Empty;
+ var description = (param.Value as PSObject).GetPSObjectProperty("metadata.description");
+ var helpString = description != null ? description.ToString() : string.Format("The {0} policy parameter.", param.Name);
+ var dp = new RuntimeDefinedParameter
+ {
+ Name = param.Name,
+ ParameterType = typeString.Equals("array", StringComparison.OrdinalIgnoreCase) ? typeof(string[]) : typeof(string)
+ };
+ dp.Attributes.Add(new ParameterAttribute
+ {
+ ParameterSetName = ParameterlessPolicyParameterSetName,
+ Mandatory = true,
+ ValueFromPipelineByPropertyName = false,
+ HelpMessage = helpString
+ });
+ this.dynamicParameters.Add(param.Name, dp);
+ }
+ }
+ }
+
+ return this.dynamicParameters;
+ }
+
+ private JObject GetParameters()
+ {
+ // Load parameters from local file or literal
+ if (this.PolicyParameter != null)
+ {
+ string policyParameterFilePath = this.TryResolvePath(this.PolicyParameter);
+ return FileUtilities.DataStore.FileExists(policyParameterFilePath)
+ ? JObject.Parse(FileUtilities.DataStore.ReadFileAsText(policyParameterFilePath))
+ : JObject.Parse(this.PolicyParameter);
+ }
+
+ // Load from PS object
+ if (this.PolicyParameterObject != null)
+ {
+ return this.PolicyParameterObject.ToJObjectWithValue();
+ }
+
+ // Load dynamic parameters
+ var parameters = PowerShellUtilities.GetUsedDynamicParameters(dynamicParameters, MyInvocation);
+ if (parameters.Count() > 0)
+ {
+ return MyInvocation.BoundParameters.ToJObjectWithValue(parameters.Select(p => p.Name));
+ }
+
+ return null;
+ }
}
-}
\ No newline at end of file
+}
diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/NewAzurePolicyDefinition.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/NewAzurePolicyDefinition.cs
index 437de5605823..f870a94ab855 100644
--- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/NewAzurePolicyDefinition.cs
+++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/NewAzurePolicyDefinition.cs
@@ -52,12 +52,19 @@ public class NewAzurePolicyDefinitionCmdlet : PolicyDefinitionCmdletBase
public string Description { get; set; }
///
- /// Gets or sets the policy parameter
+ /// Gets or sets the policy definition policy rule parameter
///
[Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The rule for policy definition. This can either be a path to a file name containing the rule, or the rule as string.")]
[ValidateNotNullOrEmpty]
public string Policy { get; set; }
+ ///
+ /// Gets or sets the policy definition parameters parameter
+ ///
+ [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The parameters declaration for policy definition. This can either be a path to a file name containing the parameters declaration, or the parameters declaration as string.")]
+ [ValidateNotNullOrEmpty]
+ public string Parameter { get; set; }
+
///
/// Executes the cmdlet.
///
@@ -113,7 +120,8 @@ private JToken GetResource()
{
Description = this.Description ?? null,
DisplayName = this.DisplayName ?? null,
- PolicyRule = JObject.Parse(GetPolicyRuleObject().ToString())
+ PolicyRule = JObject.Parse(this.GetPolicyRuleObject().ToString()),
+ Parameters = this.Parameter == null ? null : JObject.Parse(this.GetParametersObject().ToString())
}
};
@@ -131,5 +139,17 @@ private JToken GetPolicyRuleObject()
? JToken.FromObject(FileUtilities.DataStore.ReadFileAsText(policyFilePath))
: JToken.FromObject(this.Policy);
}
+
+ ///
+ /// Gets the parameters object
+ ///
+ private JToken GetParametersObject()
+ {
+ string parametersFilePath = this.TryResolvePath(this.Parameter);
+
+ return File.Exists(parametersFilePath)
+ ? JToken.FromObject(FileUtilities.DataStore.ReadFileAsText(parametersFilePath))
+ : JToken.FromObject(this.Parameter);
+ }
}
}
diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/SetAzurePolicyAssignment.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/SetAzurePolicyAssignment.cs
index 30395458d071..2ddb698da5cd 100644
--- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/SetAzurePolicyAssignment.cs
+++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/SetAzurePolicyAssignment.cs
@@ -145,4 +145,4 @@ protected string GetResourceId()
extensionResourceName: this.Name);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/ResourceManager/Resources/Commands.Resources.Test/Commands.Resources.Test.csproj b/src/ResourceManager/Resources/Commands.Resources.Test/Commands.Resources.Test.csproj
index ce0316f8d881..d3523cd506ab 100644
--- a/src/ResourceManager/Resources/Commands.Resources.Test/Commands.Resources.Test.csproj
+++ b/src/ResourceManager/Resources/Commands.Resources.Test/Commands.Resources.Test.csproj
@@ -274,6 +274,15 @@
Always
+
+ Always
+
+
+ Always
+
+
+ Always
+
Always
@@ -395,8 +404,14 @@
Always
+
+ Always
+
- PreserveNewest
+ Always
+
+
+ Always
Always
diff --git a/src/ResourceManager/Resources/Commands.Resources.Test/SamplePolicyAssignmentParameters.json b/src/ResourceManager/Resources/Commands.Resources.Test/SamplePolicyAssignmentParameters.json
new file mode 100644
index 000000000000..cdcb50dd9cc9
--- /dev/null
+++ b/src/ResourceManager/Resources/Commands.Resources.Test/SamplePolicyAssignmentParameters.json
@@ -0,0 +1,8 @@
+{
+ "listOfAllowedLocations": {
+ "value": [
+ "West US",
+ "West US 2"
+ ]
+ }
+}
\ No newline at end of file
diff --git a/src/ResourceManager/Resources/Commands.Resources.Test/SamplePolicyDefinitionParameters.json b/src/ResourceManager/Resources/Commands.Resources.Test/SamplePolicyDefinitionParameters.json
new file mode 100644
index 000000000000..107d61e1c1ec
--- /dev/null
+++ b/src/ResourceManager/Resources/Commands.Resources.Test/SamplePolicyDefinitionParameters.json
@@ -0,0 +1,10 @@
+{
+ "listOfAllowedLocations": {
+ "type": "array",
+ "metadata": {
+ "description": "An array of permitted locations for resources.",
+ "strongType": "location",
+ "displayName": "List of locations"
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/ResourceManager/Resources/Commands.Resources.Test/SamplePolicyDefinitionWithParameters.json b/src/ResourceManager/Resources/Commands.Resources.Test/SamplePolicyDefinitionWithParameters.json
new file mode 100644
index 000000000000..61ed90935ecc
--- /dev/null
+++ b/src/ResourceManager/Resources/Commands.Resources.Test/SamplePolicyDefinitionWithParameters.json
@@ -0,0 +1,11 @@
+{
+ "if": {
+ "not": {
+ "field": "location",
+ "in": "[parameters('listOfAllowedLocations')]"
+ }
+ },
+ "then": {
+ "effect": "deny"
+ }
+}
\ No newline at end of file
diff --git a/src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/PolicyTests.cs b/src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/PolicyTests.cs
index b7b48fa7a5c8..9464d5455b9c 100644
--- a/src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/PolicyTests.cs
+++ b/src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/PolicyTests.cs
@@ -41,5 +41,19 @@ public void TestPolicyAssignmentCRUD()
{
ResourcesController.NewInstance.RunPsTest("Test-PolicyAssignmentCRUD");
}
+
+ [Fact]
+ [Trait(Category.AcceptanceType, Category.CheckIn)]
+ public void TestPolicyDefinitionWithParameters()
+ {
+ ResourcesController.NewInstance.RunPsTest("Test-PolicyDefinitionWithParameters");
+ }
+
+ [Fact]
+ [Trait(Category.AcceptanceType, Category.CheckIn)]
+ public void TestPolicyAssignmentWithParameters()
+ {
+ ResourcesController.NewInstance.RunPsTest("Test-PolicyAssignmentWithParameters");
+ }
}
}
diff --git a/src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/PolicyTests.ps1 b/src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/PolicyTests.ps1
index 2ce8cb858b06..90d006736e44 100644
--- a/src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/PolicyTests.ps1
+++ b/src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/PolicyTests.ps1
@@ -78,3 +78,88 @@ function Test-PolicyAssignmentCRUD
Assert-AreEqual True $remove
}
+
+<#
+.SYNOPSIS
+Tests Policy definition creation with parameters
+#>
+function Test-PolicyDefinitionWithParameters
+{
+ # Test
+ $actual = New-AzureRMPolicyDefinition -Name testPDWP -Policy "$TestOutputRoot\SamplePolicyDefinitionWithParameters.json" -Parameter "$TestOutputRoot\SamplePolicyDefinitionParameters.json"
+ $expected = Get-AzureRMPolicyDefinition -Name testPDWP
+ Assert-AreEqual $expected.Name $actual.Name
+ Assert-AreEqual $expected.PolicyDefinitionId $actual.PolicyDefinitionId
+ Assert-NotNull($actual.Properties.PolicyRule)
+ Assert-NotNull($actual.Properties.Parameters)
+ Assert-NotNull($expected.Properties.Parameters)
+ $remove = Remove-AzureRMPolicyDefinition -Name testPDWP -Force
+ Assert-AreEqual True $remove
+
+ $actual = New-AzureRMPolicyDefinition -Name testPDWP -Policy "$TestOutputRoot\SamplePolicyDefinitionWithParameters.json" -Parameter '{ "listOfAllowedLocations": { "type": "array", "metadata": { "description": "An array of permitted locations for resources.", "strongType": "location", "displayName": "List of locations" } } }'
+ $expected = Get-AzureRMPolicyDefinition -Name testPDWP
+ Assert-AreEqual $expected.Name $actual.Name
+ Assert-AreEqual $expected.PolicyDefinitionId $actual.PolicyDefinitionId
+ Assert-NotNull($actual.Properties.PolicyRule)
+ Assert-NotNull($actual.Properties.Parameters)
+ Assert-NotNull($expected.Properties.Parameters)
+ $remove = Remove-AzureRMPolicyDefinition -Name testPDWP -Force
+ Assert-AreEqual True $remove
+}
+
+<#
+.SYNOPSIS
+Tests Policy assignment creation with parameters
+#>
+function Test-PolicyAssignmentWithParameters
+{
+ # Setup
+ $rgname = Get-ResourceGroupName
+ $policyName = Get-ResourceName
+
+ # Test
+ $rg = New-AzureRMResourceGroup -Name $rgname -Location "west us"
+ $policy = New-AzureRMPolicyDefinition -Name $policyName -Policy "$TestOutputRoot\SamplePolicyDefinitionWithParameters.json" -Parameter "$TestOutputRoot\SamplePolicyDefinitionParameters.json"
+ $array = @("West US", "West US 2")
+ $param = @{"listOfAllowedLocations"=$array}
+
+ $actual = New-AzureRMPolicyAssignment -Name testPAWP -Scope $rg.ResourceId -PolicyDefinition $policy -PolicyParameterObject $param
+ $expected = Get-AzureRMPolicyAssignment -Name testPAWP -Scope $rg.ResourceId
+ Assert-AreEqual $expected.Name $actual.Name
+ Assert-AreEqual Microsoft.Authorization/policyAssignments $actual.ResourceType
+ Assert-AreEqual $expected.PolicyAssignmentId $actual.PolicyAssignmentId
+ Assert-AreEqual $expected.Properties.PolicyDefinitionId $policy.PolicyDefinitionId
+ Assert-AreEqual $expected.Properties.Scope $rg.ResourceId
+ $remove = Remove-AzureRMPolicyAssignment -Name testPAWP -Scope $rg.ResourceId
+ Assert-AreEqual True $remove
+
+ $actual = New-AzureRMPolicyAssignment -Name testPAWP -Scope $rg.ResourceId -PolicyDefinition $policy -PolicyParameter "$TestOutputRoot\SamplePolicyAssignmentParameters.json"
+ $expected = Get-AzureRMPolicyAssignment -Name testPAWP -Scope $rg.ResourceId
+ Assert-AreEqual $expected.Name $actual.Name
+ Assert-AreEqual Microsoft.Authorization/policyAssignments $actual.ResourceType
+ Assert-AreEqual $expected.PolicyAssignmentId $actual.PolicyAssignmentId
+ Assert-AreEqual $expected.Properties.PolicyDefinitionId $policy.PolicyDefinitionId
+ Assert-AreEqual $expected.Properties.Scope $rg.ResourceId
+ $remove = Remove-AzureRMPolicyAssignment -Name testPAWP -Scope $rg.ResourceId
+ Assert-AreEqual True $remove
+
+ $actual = New-AzureRMPolicyAssignment -Name testPAWP -Scope $rg.ResourceId -PolicyDefinition $policy -PolicyParameter '{ "listOfAllowedLocations": { "value": [ "West US", "West US 2" ] } }'
+ $expected = Get-AzureRMPolicyAssignment -Name testPAWP -Scope $rg.ResourceId
+ Assert-AreEqual $expected.Name $actual.Name
+ Assert-AreEqual Microsoft.Authorization/policyAssignments $actual.ResourceType
+ Assert-AreEqual $expected.PolicyAssignmentId $actual.PolicyAssignmentId
+ Assert-AreEqual $expected.Properties.PolicyDefinitionId $policy.PolicyDefinitionId
+ Assert-AreEqual $expected.Properties.Scope $rg.ResourceId
+ $remove = Remove-AzureRMPolicyAssignment -Name testPAWP -Scope $rg.ResourceId
+ Assert-AreEqual True $remove
+
+ $actual = New-AzureRMPolicyAssignment -Name testPAWP -Scope $rg.ResourceId -PolicyDefinition $policy -listOfAllowedLocations $array
+ $expected = Get-AzureRMPolicyAssignment -Name testPAWP -Scope $rg.ResourceId
+ Assert-AreEqual $expected.Name $actual.Name
+ Assert-AreEqual Microsoft.Authorization/policyAssignments $actual.ResourceType
+ Assert-AreEqual $expected.PolicyAssignmentId $actual.PolicyAssignmentId
+ Assert-AreEqual $expected.Properties.PolicyDefinitionId $policy.PolicyDefinitionId
+ Assert-AreEqual $expected.Properties.Scope $rg.ResourceId
+ $remove = Remove-AzureRMPolicyAssignment -Name testPAWP -Scope $rg.ResourceId
+ Assert-AreEqual True $remove
+}
diff --git a/src/ResourceManager/Resources/Commands.Resources.Test/SessionRecords/Microsoft.Azure.Commands.Resources.Test.ScenarioTests.PolicyTests/TestPolicyAssignmentWithParameters.json b/src/ResourceManager/Resources/Commands.Resources.Test/SessionRecords/Microsoft.Azure.Commands.Resources.Test.ScenarioTests.PolicyTests/TestPolicyAssignmentWithParameters.json
new file mode 100644
index 000000000000..e7c3dba66064
--- /dev/null
+++ b/src/ResourceManager/Resources/Commands.Resources.Test/SessionRecords/Microsoft.Azure.Commands.Resources.Test.ScenarioTests.PolicyTests/TestPolicyAssignmentWithParameters.json
@@ -0,0 +1,907 @@
+{
+ "Entries": [
+ {
+ "RequestUri": "/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourcegroups/onesdk4191?api-version=2016-07-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMTFlMjNkNDQtNWY4NC00ZjJmLTkwOGYtZTNiZDMxOTUyNDNkL3Jlc291cmNlZ3JvdXBzL29uZXNkazQxOTE/YXBpLXZlcnNpb249MjAxNi0wNy0wMQ==",
+ "RequestMethod": "HEAD",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "x-ms-client-request-id": [
+ "192af517-144b-4f76-a018-c48770655ccc"
+ ],
+ "accept-language": [
+ "en-US"
+ ],
+ "User-Agent": [
+ "FxVersion/4.6.1586.0",
+ "OSName/Windows_10_Pro",
+ "OSVersion/6.3.14393",
+ "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.2.0-preview"
+ ]
+ },
+ "ResponseBody": "",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "102"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-failure-cause": [
+ "gateway"
+ ],
+ "x-ms-ratelimit-remaining-subscription-reads": [
+ "14998"
+ ],
+ "x-ms-request-id": [
+ "1b685686-5e50-4b72-a163-8f2a3bccc440"
+ ],
+ "x-ms-correlation-request-id": [
+ "1b685686-5e50-4b72-a163-8f2a3bccc440"
+ ],
+ "x-ms-routing-request-id": [
+ "WESTUS2:20170213T220917Z:1b685686-5e50-4b72-a163-8f2a3bccc440"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Mon, 13 Feb 2017 22:09:16 GMT"
+ ]
+ },
+ "StatusCode": 404
+ },
+ {
+ "RequestUri": "/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourcegroups/onesdk4191?api-version=2016-07-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMTFlMjNkNDQtNWY4NC00ZjJmLTkwOGYtZTNiZDMxOTUyNDNkL3Jlc291cmNlZ3JvdXBzL29uZXNkazQxOTE/YXBpLXZlcnNpb249MjAxNi0wNy0wMQ==",
+ "RequestMethod": "PUT",
+ "RequestBody": "{\r\n \"location\": \"west us\"\r\n}",
+ "RequestHeaders": {
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Content-Length": [
+ "29"
+ ],
+ "x-ms-client-request-id": [
+ "a8fa9a97-b02d-4098-9893-cbd68669d3af"
+ ],
+ "accept-language": [
+ "en-US"
+ ],
+ "User-Agent": [
+ "FxVersion/4.6.1586.0",
+ "OSName/Windows_10_Pro",
+ "OSVersion/6.3.14393",
+ "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.2.0-preview"
+ ]
+ },
+ "ResponseBody": "{\r\n \"id\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191\",\r\n \"name\": \"onesdk4191\",\r\n \"location\": \"westus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "173"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-ratelimit-remaining-subscription-writes": [
+ "1199"
+ ],
+ "x-ms-request-id": [
+ "21e0b91b-1909-40ea-9e00-e8c6a59c1238"
+ ],
+ "x-ms-correlation-request-id": [
+ "21e0b91b-1909-40ea-9e00-e8c6a59c1238"
+ ],
+ "x-ms-routing-request-id": [
+ "WESTUS2:20170213T220917Z:21e0b91b-1909-40ea-9e00-e8c6a59c1238"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Mon, 13 Feb 2017 22:09:17 GMT"
+ ]
+ },
+ "StatusCode": 201
+ },
+ {
+ "RequestUri": "/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policydefinitions/onesdk559?api-version=2016-12-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMTFlMjNkNDQtNWY4NC00ZjJmLTkwOGYtZTNiZDMxOTUyNDNkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9vbmVzZGs1NTk/YXBpLXZlcnNpb249MjAxNi0xMi0wMQ==",
+ "RequestMethod": "PUT",
+ "RequestBody": "{\r\n \"name\": \"onesdk559\",\r\n \"properties\": {\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": \"[parameters('listOfAllowedLocations')]\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n },\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"type\": \"array\",\r\n \"metadata\": {\r\n \"description\": \"An array of permitted locations for resources.\",\r\n \"strongType\": \"location\",\r\n \"displayName\": \"List of locations\"\r\n }\r\n }\r\n }\r\n }\r\n}",
+ "RequestHeaders": {
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Content-Length": [
+ "568"
+ ],
+ "User-Agent": [
+ "AzurePowershell/v3.4.0.0",
+ "PSVersion/v5.1.14393.693"
+ ],
+ "ParameterSetName": [
+ "__AllParameterSets"
+ ],
+ "CommandName": [
+ "New-AzureRmPolicyDefinition"
+ ]
+ },
+ "ResponseBody": "{\r\n \"properties\": {\r\n \"policyType\": \"Custom\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array of permitted locations for resources.\",\r\n \"strongType\": \"location\",\r\n \"displayName\": \"List of locations\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": \"[parameters('listOfAllowedLocations')]\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policyDefinitions/onesdk559\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"onesdk559\"\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "540"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-request-id": [
+ "westus2:c4bdd64e-3284-48a1-8832-3a0574307ff7"
+ ],
+ "x-ms-ratelimit-remaining-subscription-writes": [
+ "1198"
+ ],
+ "x-ms-correlation-request-id": [
+ "cb03cdf7-bd41-4fdf-8da9-0ac3b16f09e4"
+ ],
+ "x-ms-routing-request-id": [
+ "WESTUS2:20170213T220918Z:cb03cdf7-bd41-4fdf-8da9-0ac3b16f09e4"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Mon, 13 Feb 2017 22:09:17 GMT"
+ ]
+ },
+ "StatusCode": 201
+ },
+ {
+ "RequestUri": "/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191/providers/Microsoft.Authorization/policyassignments/testPAWP?api-version=2016-12-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMTFlMjNkNDQtNWY4NC00ZjJmLTkwOGYtZTNiZDMxOTUyNDNkL3Jlc291cmNlR3JvdXBzL29uZXNkazQxOTEvcHJvdmlkZXJzL01pY3Jvc29mdC5BdXRob3JpemF0aW9uL3BvbGljeWFzc2lnbm1lbnRzL3Rlc3RQQT9hcGktdmVyc2lvbj0yMDE2LTEyLTAx",
+ "RequestMethod": "PUT",
+ "RequestBody": "{\r\n \"properties\": {\r\n \"scope\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191\",\r\n \"policyDefinitionId\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policyDefinitions/onesdk559\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"value\": [\r\n \"West US\",\r\n \"West US 2\"\r\n ]\r\n }\r\n }\r\n },\r\n \"name\": \"testPAWP\"\r\n}",
+ "RequestHeaders": {
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Content-Length": [
+ "436"
+ ],
+ "User-Agent": [
+ "AzurePowershell/v3.4.0.0",
+ "PSVersion/v5.1.14393.693"
+ ],
+ "ParameterSetName": [
+ "Policy assignment with parameters via policy parameter object"
+ ],
+ "CommandName": [
+ "New-AzureRmPolicyAssignment"
+ ]
+ },
+ "ResponseBody": "{\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policyDefinitions/onesdk559\",\r\n \"scope\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"value\": [\r\n \"West US\",\r\n \"West US 2\"\r\n ]\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191/providers/Microsoft.Authorization/policyAssignments/testPAWP\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"testPAWP\"\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "526"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-request-id": [
+ "westus2:4bcfa522-8875-4d96-ad88-3048cef17af7"
+ ],
+ "x-ms-ratelimit-remaining-subscription-writes": [
+ "1199"
+ ],
+ "x-ms-correlation-request-id": [
+ "27cd6461-969d-4c6e-9654-b21677107cdd"
+ ],
+ "x-ms-routing-request-id": [
+ "WESTUS2:20170213T220919Z:27cd6461-969d-4c6e-9654-b21677107cdd"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Mon, 13 Feb 2017 22:09:18 GMT"
+ ]
+ },
+ "StatusCode": 201
+ },
+ {
+ "RequestUri": "/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191/providers/Microsoft.Authorization/policyassignments/testPAWP?api-version=2016-12-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMTFlMjNkNDQtNWY4NC00ZjJmLTkwOGYtZTNiZDMxOTUyNDNkL3Jlc291cmNlR3JvdXBzL29uZXNkazQxOTEvcHJvdmlkZXJzL01pY3Jvc29mdC5BdXRob3JpemF0aW9uL3BvbGljeWFzc2lnbm1lbnRzL3Rlc3RQQT9hcGktdmVyc2lvbj0yMDE2LTEyLTAx",
+ "RequestMethod": "PUT",
+ "RequestBody": "{\r\n \"properties\": {\r\n \"scope\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191\",\r\n \"policyDefinitionId\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policyDefinitions/onesdk559\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"value\": [\r\n \"West US\",\r\n \"West US 2\"\r\n ]\r\n }\r\n }\r\n },\r\n \"name\": \"testPAWP\"\r\n}",
+ "RequestHeaders": {
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Content-Length": [
+ "436"
+ ],
+ "User-Agent": [
+ "AzurePowershell/v3.4.0.0",
+ "PSVersion/v5.1.14393.693"
+ ],
+ "ParameterSetName": [
+ "Policy assignment with parameters via policy parameter string"
+ ],
+ "CommandName": [
+ "New-AzureRmPolicyAssignment"
+ ]
+ },
+ "ResponseBody": "{\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policyDefinitions/onesdk559\",\r\n \"scope\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"value\": [\r\n \"West US\",\r\n \"West US 2\"\r\n ]\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191/providers/Microsoft.Authorization/policyAssignments/testPAWP\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"testPAWP\"\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "526"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-request-id": [
+ "westus2:53302bce-b878-4045-8655-6078abfbae55"
+ ],
+ "x-ms-ratelimit-remaining-subscription-writes": [
+ "1199"
+ ],
+ "x-ms-correlation-request-id": [
+ "3e967c79-1e57-4126-8f0d-c42640c78815"
+ ],
+ "x-ms-routing-request-id": [
+ "WESTUS2:20170213T220920Z:3e967c79-1e57-4126-8f0d-c42640c78815"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Mon, 13 Feb 2017 22:09:20 GMT"
+ ]
+ },
+ "StatusCode": 201
+ },
+ {
+ "RequestUri": "/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191/providers/Microsoft.Authorization/policyassignments/testPAWP?api-version=2016-12-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMTFlMjNkNDQtNWY4NC00ZjJmLTkwOGYtZTNiZDMxOTUyNDNkL3Jlc291cmNlR3JvdXBzL29uZXNkazQxOTEvcHJvdmlkZXJzL01pY3Jvc29mdC5BdXRob3JpemF0aW9uL3BvbGljeWFzc2lnbm1lbnRzL3Rlc3RQQT9hcGktdmVyc2lvbj0yMDE2LTEyLTAx",
+ "RequestMethod": "PUT",
+ "RequestBody": "{\r\n \"properties\": {\r\n \"scope\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191\",\r\n \"policyDefinitionId\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policyDefinitions/onesdk559\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"value\": [\r\n \"West US\",\r\n \"West US 2\"\r\n ]\r\n }\r\n }\r\n },\r\n \"name\": \"testPAWP\"\r\n}",
+ "RequestHeaders": {
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Content-Length": [
+ "436"
+ ],
+ "User-Agent": [
+ "AzurePowershell/v3.4.0.0",
+ "PSVersion/v5.1.14393.693"
+ ],
+ "ParameterSetName": [
+ "Policy assignment with parameters via policy parameter string"
+ ],
+ "CommandName": [
+ "New-AzureRmPolicyAssignment"
+ ]
+ },
+ "ResponseBody": "{\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policyDefinitions/onesdk559\",\r\n \"scope\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"value\": [\r\n \"West US\",\r\n \"West US 2\"\r\n ]\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191/providers/Microsoft.Authorization/policyAssignments/testPAWP\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"testPAWP\"\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "526"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-request-id": [
+ "westus2:5d1ec133-6783-464a-b4dd-a8ef460917b6"
+ ],
+ "x-ms-ratelimit-remaining-subscription-writes": [
+ "1197"
+ ],
+ "x-ms-correlation-request-id": [
+ "1552d731-3d5f-473f-aaf1-ac8edd949e47"
+ ],
+ "x-ms-routing-request-id": [
+ "WESTUS2:20170213T220922Z:1552d731-3d5f-473f-aaf1-ac8edd949e47"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Mon, 13 Feb 2017 22:09:22 GMT"
+ ]
+ },
+ "StatusCode": 201
+ },
+ {
+ "RequestUri": "/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191/providers/Microsoft.Authorization/policyassignments/testPAWP?api-version=2016-12-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMTFlMjNkNDQtNWY4NC00ZjJmLTkwOGYtZTNiZDMxOTUyNDNkL3Jlc291cmNlR3JvdXBzL29uZXNkazQxOTEvcHJvdmlkZXJzL01pY3Jvc29mdC5BdXRob3JpemF0aW9uL3BvbGljeWFzc2lnbm1lbnRzL3Rlc3RQQT9hcGktdmVyc2lvbj0yMDE2LTEyLTAx",
+ "RequestMethod": "PUT",
+ "RequestBody": "{\r\n \"properties\": {\r\n \"scope\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191\",\r\n \"policyDefinitionId\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policyDefinitions/onesdk559\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"value\": [\r\n \"West US\",\r\n \"West US 2\"\r\n ]\r\n }\r\n }\r\n },\r\n \"name\": \"testPAWP\"\r\n}",
+ "RequestHeaders": {
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Content-Length": [
+ "436"
+ ],
+ "User-Agent": [
+ "AzurePowershell/v3.4.0.0",
+ "PSVersion/v5.1.14393.693"
+ ],
+ "ParameterSetName": [
+ "Policy assignment without parameters"
+ ],
+ "CommandName": [
+ "New-AzureRmPolicyAssignment"
+ ]
+ },
+ "ResponseBody": "{\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policyDefinitions/onesdk559\",\r\n \"scope\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"value\": [\r\n \"West US\",\r\n \"West US 2\"\r\n ]\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191/providers/Microsoft.Authorization/policyAssignments/testPAWP\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"testPAWP\"\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "526"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-request-id": [
+ "westus2:984d553e-318e-4923-bb90-42a8ba52ab18"
+ ],
+ "x-ms-ratelimit-remaining-subscription-writes": [
+ "1199"
+ ],
+ "x-ms-correlation-request-id": [
+ "96eddeff-3b22-4c17-a452-33ea241a08bb"
+ ],
+ "x-ms-routing-request-id": [
+ "WESTUS2:20170213T220922Z:96eddeff-3b22-4c17-a452-33ea241a08bb"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Mon, 13 Feb 2017 22:09:22 GMT"
+ ]
+ },
+ "StatusCode": 201
+ },
+ {
+ "RequestUri": "/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191/providers/Microsoft.Authorization/policyassignments/testPAWP?api-version=2016-12-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMTFlMjNkNDQtNWY4NC00ZjJmLTkwOGYtZTNiZDMxOTUyNDNkL3Jlc291cmNlR3JvdXBzL29uZXNkazQxOTEvcHJvdmlkZXJzL01pY3Jvc29mdC5BdXRob3JpemF0aW9uL3BvbGljeWFzc2lnbm1lbnRzL3Rlc3RQQT9hcGktdmVyc2lvbj0yMDE2LTEyLTAx",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "User-Agent": [
+ "AzurePowershell/v3.4.0.0",
+ "PSVersion/v5.1.14393.693"
+ ],
+ "ParameterSetName": [
+ "The policy assignment name parameter set."
+ ],
+ "CommandName": [
+ "Get-AzureRmPolicyAssignment"
+ ]
+ },
+ "ResponseBody": "{\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policyDefinitions/onesdk559\",\r\n \"scope\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"value\": [\r\n \"West US\",\r\n \"West US 2\"\r\n ]\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191/providers/Microsoft.Authorization/policyAssignments/testPAWP\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"testPAWP\"\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "526"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "Vary": [
+ "Accept-Encoding"
+ ],
+ "x-ms-request-id": [
+ "westus2:a433311e-50e2-4406-92ea-c50abbec1fdc"
+ ],
+ "x-ms-ratelimit-remaining-subscription-reads": [
+ "14997"
+ ],
+ "x-ms-correlation-request-id": [
+ "1ab118a1-1c69-4f79-ae31-cb1283c8fa8e"
+ ],
+ "x-ms-routing-request-id": [
+ "WESTUS2:20170213T220919Z:1ab118a1-1c69-4f79-ae31-cb1283c8fa8e"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Mon, 13 Feb 2017 22:09:19 GMT"
+ ]
+ },
+ "StatusCode": 200
+ },
+ {
+ "RequestUri": "/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191/providers/Microsoft.Authorization/policyassignments/testPAWP?api-version=2016-12-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMTFlMjNkNDQtNWY4NC00ZjJmLTkwOGYtZTNiZDMxOTUyNDNkL3Jlc291cmNlR3JvdXBzL29uZXNkazQxOTEvcHJvdmlkZXJzL01pY3Jvc29mdC5BdXRob3JpemF0aW9uL3BvbGljeWFzc2lnbm1lbnRzL3Rlc3RQQT9hcGktdmVyc2lvbj0yMDE2LTEyLTAx",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "User-Agent": [
+ "AzurePowershell/v3.4.0.0",
+ "PSVersion/v5.1.14393.693"
+ ],
+ "ParameterSetName": [
+ "The policy assignment name parameter set."
+ ],
+ "CommandName": [
+ "Get-AzureRmPolicyAssignment"
+ ]
+ },
+ "ResponseBody": "{\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policyDefinitions/onesdk559\",\r\n \"scope\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"value\": [\r\n \"West US\",\r\n \"West US 2\"\r\n ]\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191/providers/Microsoft.Authorization/policyAssignments/testPAWP\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"testPAWP\"\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "526"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "Vary": [
+ "Accept-Encoding"
+ ],
+ "x-ms-request-id": [
+ "westus2:f3e626d0-9751-42f7-9c0f-14252675f9b5"
+ ],
+ "x-ms-ratelimit-remaining-subscription-reads": [
+ "14997"
+ ],
+ "x-ms-correlation-request-id": [
+ "3c5f5b38-e114-4696-b935-e89cca418d15"
+ ],
+ "x-ms-routing-request-id": [
+ "WESTUS2:20170213T220921Z:3c5f5b38-e114-4696-b935-e89cca418d15"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Mon, 13 Feb 2017 22:09:20 GMT"
+ ]
+ },
+ "StatusCode": 200
+ },
+ {
+ "RequestUri": "/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191/providers/Microsoft.Authorization/policyassignments/testPAWP?api-version=2016-12-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMTFlMjNkNDQtNWY4NC00ZjJmLTkwOGYtZTNiZDMxOTUyNDNkL3Jlc291cmNlR3JvdXBzL29uZXNkazQxOTEvcHJvdmlkZXJzL01pY3Jvc29mdC5BdXRob3JpemF0aW9uL3BvbGljeWFzc2lnbm1lbnRzL3Rlc3RQQT9hcGktdmVyc2lvbj0yMDE2LTEyLTAx",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "User-Agent": [
+ "AzurePowershell/v3.4.0.0",
+ "PSVersion/v5.1.14393.693"
+ ],
+ "ParameterSetName": [
+ "The policy assignment name parameter set."
+ ],
+ "CommandName": [
+ "Get-AzureRmPolicyAssignment"
+ ]
+ },
+ "ResponseBody": "{\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policyDefinitions/onesdk559\",\r\n \"scope\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"value\": [\r\n \"West US\",\r\n \"West US 2\"\r\n ]\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191/providers/Microsoft.Authorization/policyAssignments/testPAWP\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"testPAWP\"\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "526"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "Vary": [
+ "Accept-Encoding"
+ ],
+ "x-ms-request-id": [
+ "westus2:0b4febff-a241-4478-82f5-436edd793579"
+ ],
+ "x-ms-ratelimit-remaining-subscription-reads": [
+ "14997"
+ ],
+ "x-ms-correlation-request-id": [
+ "41855a71-2ab0-4e4b-a7a0-edf7e1c1d1a2"
+ ],
+ "x-ms-routing-request-id": [
+ "WESTUS2:20170213T220922Z:41855a71-2ab0-4e4b-a7a0-edf7e1c1d1a2"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Mon, 13 Feb 2017 22:09:21 GMT"
+ ]
+ },
+ "StatusCode": 200
+ },
+ {
+ "RequestUri": "/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191/providers/Microsoft.Authorization/policyassignments/testPAWP?api-version=2016-12-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMTFlMjNkNDQtNWY4NC00ZjJmLTkwOGYtZTNiZDMxOTUyNDNkL3Jlc291cmNlR3JvdXBzL29uZXNkazQxOTEvcHJvdmlkZXJzL01pY3Jvc29mdC5BdXRob3JpemF0aW9uL3BvbGljeWFzc2lnbm1lbnRzL3Rlc3RQQT9hcGktdmVyc2lvbj0yMDE2LTEyLTAx",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "User-Agent": [
+ "AzurePowershell/v3.4.0.0",
+ "PSVersion/v5.1.14393.693"
+ ],
+ "ParameterSetName": [
+ "The policy assignment name parameter set."
+ ],
+ "CommandName": [
+ "Get-AzureRmPolicyAssignment"
+ ]
+ },
+ "ResponseBody": "{\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policyDefinitions/onesdk559\",\r\n \"scope\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"value\": [\r\n \"West US\",\r\n \"West US 2\"\r\n ]\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191/providers/Microsoft.Authorization/policyAssignments/testPAWP\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"testPAWP\"\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "526"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "Vary": [
+ "Accept-Encoding"
+ ],
+ "x-ms-request-id": [
+ "westus2:8b248107-8932-4501-8fc4-d1766e1219e9"
+ ],
+ "x-ms-ratelimit-remaining-subscription-reads": [
+ "14997"
+ ],
+ "x-ms-correlation-request-id": [
+ "572132aa-7225-4549-bbc9-0601927b4767"
+ ],
+ "x-ms-routing-request-id": [
+ "WESTUS2:20170213T220922Z:572132aa-7225-4549-bbc9-0601927b4767"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Mon, 13 Feb 2017 22:09:22 GMT"
+ ]
+ },
+ "StatusCode": 200
+ },
+ {
+ "RequestUri": "/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191/providers/Microsoft.Authorization/policyassignments/testPAWP?api-version=2016-12-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMTFlMjNkNDQtNWY4NC00ZjJmLTkwOGYtZTNiZDMxOTUyNDNkL3Jlc291cmNlR3JvdXBzL29uZXNkazQxOTEvcHJvdmlkZXJzL01pY3Jvc29mdC5BdXRob3JpemF0aW9uL3BvbGljeWFzc2lnbm1lbnRzL3Rlc3RQQT9hcGktdmVyc2lvbj0yMDE2LTEyLTAx",
+ "RequestMethod": "DELETE",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "User-Agent": [
+ "AzurePowershell/v3.4.0.0",
+ "PSVersion/v5.1.14393.693"
+ ],
+ "ParameterSetName": [
+ "The policy assignment name parameter set."
+ ],
+ "CommandName": [
+ "Remove-AzureRmPolicyAssignment"
+ ]
+ },
+ "ResponseBody": "{\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policyDefinitions/onesdk559\",\r\n \"scope\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"value\": [\r\n \"West US\",\r\n \"West US 2\"\r\n ]\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191/providers/Microsoft.Authorization/policyAssignments/testPAWP\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"testPAWP\"\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "526"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "Vary": [
+ "Accept-Encoding"
+ ],
+ "x-ms-request-id": [
+ "westus2:03f0cba7-d37e-40d6-b859-398efd69bcb6"
+ ],
+ "x-ms-ratelimit-remaining-subscription-writes": [
+ "1199"
+ ],
+ "x-ms-correlation-request-id": [
+ "fb15e263-6a8b-4d54-bf08-4db00f65c5bf"
+ ],
+ "x-ms-routing-request-id": [
+ "WESTUS2:20170213T220920Z:fb15e263-6a8b-4d54-bf08-4db00f65c5bf"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Mon, 13 Feb 2017 22:09:19 GMT"
+ ]
+ },
+ "StatusCode": 200
+ },
+ {
+ "RequestUri": "/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191/providers/Microsoft.Authorization/policyassignments/testPAWP?api-version=2016-12-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMTFlMjNkNDQtNWY4NC00ZjJmLTkwOGYtZTNiZDMxOTUyNDNkL3Jlc291cmNlR3JvdXBzL29uZXNkazQxOTEvcHJvdmlkZXJzL01pY3Jvc29mdC5BdXRob3JpemF0aW9uL3BvbGljeWFzc2lnbm1lbnRzL3Rlc3RQQT9hcGktdmVyc2lvbj0yMDE2LTEyLTAx",
+ "RequestMethod": "DELETE",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "User-Agent": [
+ "AzurePowershell/v3.4.0.0",
+ "PSVersion/v5.1.14393.693"
+ ],
+ "ParameterSetName": [
+ "The policy assignment name parameter set."
+ ],
+ "CommandName": [
+ "Remove-AzureRmPolicyAssignment"
+ ]
+ },
+ "ResponseBody": "{\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policyDefinitions/onesdk559\",\r\n \"scope\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"value\": [\r\n \"West US\",\r\n \"West US 2\"\r\n ]\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191/providers/Microsoft.Authorization/policyAssignments/testPAWP\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"testPAWP\"\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "526"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "Vary": [
+ "Accept-Encoding"
+ ],
+ "x-ms-request-id": [
+ "westus2:504aae6b-bae0-4980-a8f5-5d33c4e1bea0"
+ ],
+ "x-ms-ratelimit-remaining-subscription-writes": [
+ "1198"
+ ],
+ "x-ms-correlation-request-id": [
+ "d626c497-bd22-4851-81c1-867883f00d1b"
+ ],
+ "x-ms-routing-request-id": [
+ "WESTUS2:20170213T220922Z:d626c497-bd22-4851-81c1-867883f00d1b"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Mon, 13 Feb 2017 22:09:21 GMT"
+ ]
+ },
+ "StatusCode": 200
+ },
+ {
+ "RequestUri": "/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191/providers/Microsoft.Authorization/policyassignments/testPAWP?api-version=2016-12-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMTFlMjNkNDQtNWY4NC00ZjJmLTkwOGYtZTNiZDMxOTUyNDNkL3Jlc291cmNlR3JvdXBzL29uZXNkazQxOTEvcHJvdmlkZXJzL01pY3Jvc29mdC5BdXRob3JpemF0aW9uL3BvbGljeWFzc2lnbm1lbnRzL3Rlc3RQQT9hcGktdmVyc2lvbj0yMDE2LTEyLTAx",
+ "RequestMethod": "DELETE",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "User-Agent": [
+ "AzurePowershell/v3.4.0.0",
+ "PSVersion/v5.1.14393.693"
+ ],
+ "ParameterSetName": [
+ "The policy assignment name parameter set."
+ ],
+ "CommandName": [
+ "Remove-AzureRmPolicyAssignment"
+ ]
+ },
+ "ResponseBody": "{\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policyDefinitions/onesdk559\",\r\n \"scope\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"value\": [\r\n \"West US\",\r\n \"West US 2\"\r\n ]\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191/providers/Microsoft.Authorization/policyAssignments/testPAWP\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"testPAWP\"\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "526"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "Vary": [
+ "Accept-Encoding"
+ ],
+ "x-ms-request-id": [
+ "westus2:d46db13c-1963-4427-969d-227474c3d5cf"
+ ],
+ "x-ms-ratelimit-remaining-subscription-writes": [
+ "1198"
+ ],
+ "x-ms-correlation-request-id": [
+ "ad535275-5a2e-493d-83e4-452991eb1008"
+ ],
+ "x-ms-routing-request-id": [
+ "WESTUS2:20170213T220922Z:ad535275-5a2e-493d-83e4-452991eb1008"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Mon, 13 Feb 2017 22:09:22 GMT"
+ ]
+ },
+ "StatusCode": 200
+ },
+ {
+ "RequestUri": "/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191/providers/Microsoft.Authorization/policyassignments/testPAWP?api-version=2016-12-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMTFlMjNkNDQtNWY4NC00ZjJmLTkwOGYtZTNiZDMxOTUyNDNkL3Jlc291cmNlR3JvdXBzL29uZXNkazQxOTEvcHJvdmlkZXJzL01pY3Jvc29mdC5BdXRob3JpemF0aW9uL3BvbGljeWFzc2lnbm1lbnRzL3Rlc3RQQT9hcGktdmVyc2lvbj0yMDE2LTEyLTAx",
+ "RequestMethod": "DELETE",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "User-Agent": [
+ "AzurePowershell/v3.4.0.0",
+ "PSVersion/v5.1.14393.693"
+ ],
+ "ParameterSetName": [
+ "The policy assignment name parameter set."
+ ],
+ "CommandName": [
+ "Remove-AzureRmPolicyAssignment"
+ ]
+ },
+ "ResponseBody": "{\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policyDefinitions/onesdk559\",\r\n \"scope\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"value\": [\r\n \"West US\",\r\n \"West US 2\"\r\n ]\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/resourceGroups/onesdk4191/providers/Microsoft.Authorization/policyAssignments/testPAWP\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"testPAWP\"\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "526"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "Vary": [
+ "Accept-Encoding"
+ ],
+ "x-ms-request-id": [
+ "westus2:abf87272-b127-4292-a687-cd0ceda516b7"
+ ],
+ "x-ms-ratelimit-remaining-subscription-writes": [
+ "1198"
+ ],
+ "x-ms-correlation-request-id": [
+ "94830f50-3394-4f51-bb82-907a2818bcb4"
+ ],
+ "x-ms-routing-request-id": [
+ "WESTUS2:20170213T220923Z:94830f50-3394-4f51-bb82-907a2818bcb4"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Mon, 13 Feb 2017 22:09:22 GMT"
+ ]
+ },
+ "StatusCode": 200
+ }
+ ],
+ "Names": {
+ "Test-PolicyAssignmentWithParameters": [
+ "onesdk4191",
+ "onesdk559"
+ ]
+ },
+ "Variables": {
+ "SubscriptionId": "11e23d44-5f84-4f2f-908f-e3bd3195243d",
+ "TenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
+ "Domain": "microsoft.com"
+ }
+}
\ No newline at end of file
diff --git a/src/ResourceManager/Resources/Commands.Resources.Test/SessionRecords/Microsoft.Azure.Commands.Resources.Test.ScenarioTests.PolicyTests/TestPolicyDefinitionWithParameters.json b/src/ResourceManager/Resources/Commands.Resources.Test/SessionRecords/Microsoft.Azure.Commands.Resources.Test.ScenarioTests.PolicyTests/TestPolicyDefinitionWithParameters.json
new file mode 100644
index 000000000000..f45f0f0c568c
--- /dev/null
+++ b/src/ResourceManager/Resources/Commands.Resources.Test/SessionRecords/Microsoft.Azure.Commands.Resources.Test.ScenarioTests.PolicyTests/TestPolicyDefinitionWithParameters.json
@@ -0,0 +1,368 @@
+{
+ "Entries": [
+ {
+ "RequestUri": "/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policydefinitions/testPDWP?api-version=2016-12-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMTFlMjNkNDQtNWY4NC00ZjJmLTkwOGYtZTNiZDMxOTUyNDNkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9vbmVzZGs3Mjc/YXBpLXZlcnNpb249MjAxNi0xMi0wMQ==",
+ "RequestMethod": "PUT",
+ "RequestBody": "{\r\n \"name\": \"testPDWP\",\r\n \"properties\": {\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": \"[parameters('listOfAllowedLocations')]\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n },\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"type\": \"array\",\r\n \"metadata\": {\r\n \"description\": \"An array of permitted locations for resources.\",\r\n \"strongType\": \"location\",\r\n \"displayName\": \"List of locations\"\r\n }\r\n }\r\n }\r\n }\r\n}",
+ "RequestHeaders": {
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Content-Length": [
+ "568"
+ ],
+ "User-Agent": [
+ "AzurePowershell/v3.4.0.0",
+ "PSVersion/v5.1.14393.693"
+ ],
+ "ParameterSetName": [
+ "__AllParameterSets"
+ ],
+ "CommandName": [
+ "New-AzureRmPolicyDefinition"
+ ]
+ },
+ "ResponseBody": "{\r\n \"properties\": {\r\n \"policyType\": \"Custom\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array of permitted locations for resources.\",\r\n \"strongType\": \"location\",\r\n \"displayName\": \"List of locations\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": \"[parameters('listOfAllowedLocations')]\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policyDefinitions/testPDWP\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"testPDWP\"\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "540"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-request-id": [
+ "westus2:0140be8c-fa79-4db6-abff-5ab6373c1aff"
+ ],
+ "x-ms-ratelimit-remaining-subscription-writes": [
+ "1199"
+ ],
+ "x-ms-correlation-request-id": [
+ "6d8e783d-2ba8-45ab-8d16-2afc5754397a"
+ ],
+ "x-ms-routing-request-id": [
+ "WESTUS2:20170213T220435Z:6d8e783d-2ba8-45ab-8d16-2afc5754397a"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Mon, 13 Feb 2017 22:04:35 GMT"
+ ]
+ },
+ "StatusCode": 201
+ },
+ {
+ "RequestUri": "/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policydefinitions/testPDWP?api-version=2016-12-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMTFlMjNkNDQtNWY4NC00ZjJmLTkwOGYtZTNiZDMxOTUyNDNkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9vbmVzZGs3Mjc/YXBpLXZlcnNpb249MjAxNi0xMi0wMQ==",
+ "RequestMethod": "PUT",
+ "RequestBody": "{\r\n \"name\": \"testPDWP\",\r\n \"properties\": {\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": \"[parameters('listOfAllowedLocations')]\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n },\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"type\": \"array\",\r\n \"metadata\": {\r\n \"description\": \"An array of permitted locations for resources.\",\r\n \"strongType\": \"location\",\r\n \"displayName\": \"List of locations\"\r\n }\r\n }\r\n }\r\n }\r\n}",
+ "RequestHeaders": {
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Content-Length": [
+ "568"
+ ],
+ "User-Agent": [
+ "AzurePowershell/v3.4.0.0",
+ "PSVersion/v5.1.14393.693"
+ ],
+ "ParameterSetName": [
+ "__AllParameterSets"
+ ],
+ "CommandName": [
+ "New-AzureRmPolicyDefinition"
+ ]
+ },
+ "ResponseBody": "{\r\n \"properties\": {\r\n \"policyType\": \"Custom\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array of permitted locations for resources.\",\r\n \"strongType\": \"location\",\r\n \"displayName\": \"List of locations\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": \"[parameters('listOfAllowedLocations')]\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policyDefinitions/testPDWP\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"testPDWP\"\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "540"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-request-id": [
+ "westus2:4fae63f2-f4dd-4af4-9f54-c5a7c6b14263"
+ ],
+ "x-ms-ratelimit-remaining-subscription-writes": [
+ "1199"
+ ],
+ "x-ms-correlation-request-id": [
+ "aef09e8b-c570-4635-baf5-1e9dd229a0dd"
+ ],
+ "x-ms-routing-request-id": [
+ "WESTUS2:20170213T220437Z:aef09e8b-c570-4635-baf5-1e9dd229a0dd"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Mon, 13 Feb 2017 22:04:36 GMT"
+ ]
+ },
+ "StatusCode": 201
+ },
+ {
+ "RequestUri": "/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policydefinitions/testPDWP?api-version=2016-12-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMTFlMjNkNDQtNWY4NC00ZjJmLTkwOGYtZTNiZDMxOTUyNDNkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9vbmVzZGs3Mjc/YXBpLXZlcnNpb249MjAxNi0xMi0wMQ==",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "User-Agent": [
+ "AzurePowershell/v3.4.0.0",
+ "PSVersion/v5.1.14393.693"
+ ],
+ "ParameterSetName": [
+ "The policy definition name parameter set."
+ ],
+ "CommandName": [
+ "Get-AzureRmPolicyDefinition"
+ ]
+ },
+ "ResponseBody": "{\r\n \"properties\": {\r\n \"policyType\": \"Custom\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array of permitted locations for resources.\",\r\n \"strongType\": \"location\",\r\n \"displayName\": \"List of locations\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": \"[parameters('listOfAllowedLocations')]\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policyDefinitions/testPDWP\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"testPDWP\"\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "540"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "Vary": [
+ "Accept-Encoding"
+ ],
+ "x-ms-request-id": [
+ "westus2:b23ef78e-9303-4023-819f-ca677eef38bb"
+ ],
+ "x-ms-ratelimit-remaining-subscription-reads": [
+ "14999"
+ ],
+ "x-ms-correlation-request-id": [
+ "0139bfee-3943-469e-839e-636fcb417040"
+ ],
+ "x-ms-routing-request-id": [
+ "WESTUS2:20170213T220436Z:0139bfee-3943-469e-839e-636fcb417040"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Mon, 13 Feb 2017 22:04:35 GMT"
+ ]
+ },
+ "StatusCode": 200
+ },
+ {
+ "RequestUri": "/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policydefinitions/testPDWP?api-version=2016-12-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMTFlMjNkNDQtNWY4NC00ZjJmLTkwOGYtZTNiZDMxOTUyNDNkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9vbmVzZGs3Mjc/YXBpLXZlcnNpb249MjAxNi0xMi0wMQ==",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "User-Agent": [
+ "AzurePowershell/v3.4.0.0",
+ "PSVersion/v5.1.14393.693"
+ ],
+ "ParameterSetName": [
+ "The policy definition name parameter set."
+ ],
+ "CommandName": [
+ "Get-AzureRmPolicyDefinition"
+ ]
+ },
+ "ResponseBody": "{\r\n \"properties\": {\r\n \"policyType\": \"Custom\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array of permitted locations for resources.\",\r\n \"strongType\": \"location\",\r\n \"displayName\": \"List of locations\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": \"[parameters('listOfAllowedLocations')]\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policyDefinitions/testPDWP\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"testPDWP\"\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "540"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "Vary": [
+ "Accept-Encoding"
+ ],
+ "x-ms-request-id": [
+ "westus2:f2b72388-4dda-4722-9c62-a3fbe3ac9f34"
+ ],
+ "x-ms-ratelimit-remaining-subscription-reads": [
+ "14998"
+ ],
+ "x-ms-correlation-request-id": [
+ "4eb2f78e-e12a-426a-9bd4-40ee3cf98ee4"
+ ],
+ "x-ms-routing-request-id": [
+ "WESTUS2:20170213T220437Z:4eb2f78e-e12a-426a-9bd4-40ee3cf98ee4"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Mon, 13 Feb 2017 22:04:37 GMT"
+ ]
+ },
+ "StatusCode": 200
+ },
+ {
+ "RequestUri": "/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policydefinitions/testPDWP?api-version=2016-12-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMTFlMjNkNDQtNWY4NC00ZjJmLTkwOGYtZTNiZDMxOTUyNDNkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9vbmVzZGs3Mjc/YXBpLXZlcnNpb249MjAxNi0xMi0wMQ==",
+ "RequestMethod": "DELETE",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "User-Agent": [
+ "AzurePowershell/v3.4.0.0",
+ "PSVersion/v5.1.14393.693"
+ ],
+ "ParameterSetName": [
+ "The policy definition name parameter set."
+ ],
+ "CommandName": [
+ "Remove-AzureRmPolicyDefinition"
+ ]
+ },
+ "ResponseBody": "{\r\n \"properties\": {\r\n \"policyType\": \"Custom\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array of permitted locations for resources.\",\r\n \"strongType\": \"location\",\r\n \"displayName\": \"List of locations\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": \"[parameters('listOfAllowedLocations')]\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policyDefinitions/testPDWP\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"testPDWP\"\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "540"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "Vary": [
+ "Accept-Encoding"
+ ],
+ "x-ms-request-id": [
+ "westus2:c8d8035d-a49f-46fd-af03-40d66f56ab70"
+ ],
+ "x-ms-ratelimit-remaining-subscription-writes": [
+ "1198"
+ ],
+ "x-ms-correlation-request-id": [
+ "ed460ec2-c00e-43cd-a1ed-8bdad5481507"
+ ],
+ "x-ms-routing-request-id": [
+ "WESTUS2:20170213T220437Z:ed460ec2-c00e-43cd-a1ed-8bdad5481507"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Mon, 13 Feb 2017 22:04:36 GMT"
+ ]
+ },
+ "StatusCode": 200
+ },
+ {
+ "RequestUri": "/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policydefinitions/testPDWP?api-version=2016-12-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMTFlMjNkNDQtNWY4NC00ZjJmLTkwOGYtZTNiZDMxOTUyNDNkL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9vbmVzZGs3Mjc/YXBpLXZlcnNpb249MjAxNi0xMi0wMQ==",
+ "RequestMethod": "DELETE",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "User-Agent": [
+ "AzurePowershell/v3.4.0.0",
+ "PSVersion/v5.1.14393.693"
+ ],
+ "ParameterSetName": [
+ "The policy definition name parameter set."
+ ],
+ "CommandName": [
+ "Remove-AzureRmPolicyDefinition"
+ ]
+ },
+ "ResponseBody": "{\r\n \"properties\": {\r\n \"policyType\": \"Custom\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array of permitted locations for resources.\",\r\n \"strongType\": \"location\",\r\n \"displayName\": \"List of locations\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": \"[parameters('listOfAllowedLocations')]\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d/providers/Microsoft.Authorization/policyDefinitions/testPDWP\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"testPDWP\"\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "540"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "Vary": [
+ "Accept-Encoding"
+ ],
+ "x-ms-request-id": [
+ "westus2:b31bd4fe-2bef-46ad-bcbf-93b8a3017dde"
+ ],
+ "x-ms-ratelimit-remaining-subscription-writes": [
+ "1198"
+ ],
+ "x-ms-correlation-request-id": [
+ "edc56751-1d62-4183-89e7-706dcadfa169"
+ ],
+ "x-ms-routing-request-id": [
+ "WESTUS2:20170213T220437Z:edc56751-1d62-4183-89e7-706dcadfa169"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Mon, 13 Feb 2017 22:04:36 GMT"
+ ]
+ },
+ "StatusCode": 200
+ }
+ ],
+ "Names": {
+ "Test-PolicyDefinitionWithParameters": [
+ "testPDWP"
+ ]
+ },
+ "Variables": {
+ "SubscriptionId": "11e23d44-5f84-4f2f-908f-e3bd3195243d",
+ "TenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
+ "Domain": "microsoft.com"
+ }
+}
\ No newline at end of file
diff --git a/src/ResourceManager/Resources/Commands.Resources/help/New-AzureRmPolicyAssignment.md b/src/ResourceManager/Resources/Commands.Resources/help/New-AzureRmPolicyAssignment.md
index 917940075028..d8fd7bb40446 100644
--- a/src/ResourceManager/Resources/Commands.Resources/help/New-AzureRmPolicyAssignment.md
+++ b/src/ResourceManager/Resources/Commands.Resources/help/New-AzureRmPolicyAssignment.md
@@ -12,12 +12,27 @@ Creates a policy assignment.
## SYNTAX
+### Policy assignment without parameters
```
New-AzureRmPolicyAssignment -Name -Scope [-DisplayName ] -PolicyDefinition
[-ApiVersion ] [-Pre] [-InformationAction ] [-InformationVariable ]
[]
```
+### Policy assignment with parameters via policy parameter object
+```
+New-AzureRmPolicyAssignment -Name -Scope [-DisplayName ] -PolicyDefinition
+ -PolicyParameterObject [-ApiVersion ] [-Pre] [-InformationAction ]
+ [-InformationVariable ] []
+```
+
+### Policy assignment with parameters via policy parameter string
+```
+New-AzureRmPolicyAssignment -Name -Scope [-DisplayName ] -PolicyDefinition
+ -PolicyParameter [-ApiVersion ] [-Pre] [-InformationAction ]
+ [-InformationVariable ] []
+```
+
## DESCRIPTION
The **New-AzureRmPolicyAssignment** cmdlet creates a policy assignment.
Specify a policy and scope.
@@ -175,6 +190,36 @@ Accept pipeline input: False
Accept wildcard characters: False
```
+### -PolicyParameter
+The policy parameter file path or policy parameter string.
+
+```yaml
+Type: String
+Parameter Sets: Policy assignment with parameters via policy parameter string
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: True (ByPropertyName)
+Accept wildcard characters: False
+```
+
+### -PolicyParameterObject
+The policy parameter object.
+
+```yaml
+Type: Hashtable
+Parameter Sets: Policy assignment with parameters via policy parameter object
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: True (ByPropertyName)
+Accept wildcard characters: False
+```
+
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
diff --git a/src/ResourceManager/Resources/Commands.Resources/help/New-AzureRmPolicyDefinition.md b/src/ResourceManager/Resources/Commands.Resources/help/New-AzureRmPolicyDefinition.md
index b1b4bfcff549..b31d90b955e3 100644
--- a/src/ResourceManager/Resources/Commands.Resources/help/New-AzureRmPolicyDefinition.md
+++ b/src/ResourceManager/Resources/Commands.Resources/help/New-AzureRmPolicyDefinition.md
@@ -14,8 +14,8 @@ Creates a policy definition.
```
New-AzureRmPolicyDefinition -Name [-DisplayName ] [-Description ] -Policy
- [-ApiVersion ] [-Pre] [-InformationAction ] [-InformationVariable ]
- []
+ [-Parameter ] [-ApiVersion ] [-Pre] [-InformationAction ]
+ [-InformationVariable ] []
```
## DESCRIPTION
@@ -171,6 +171,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```
+### -Parameter
+The parameters declaration for policy definition. This can either be a path to a file name containing the parameters declaration, or the parameters declaration as string.
+
+```yaml
+Type: String
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: True (ByPropertyName)
+Accept wildcard characters: False
+```
+
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).