Skip to content

Commit 7d49bec

Browse files
YanaXumentat9
andauthored
Add warnings for future breaking changes in Az.Resources policy CRUD cmdlets (#22691)
* Get-AzPolicyAlias: optmize common path for single namespace * Update changelog. * Fox for #15828 * Update changelog * Add breaking change warnings to Policy CRUD cmdlets. * Minor changelog correction * Added per-cmdlet information about upcoming changes Corrected deprecation version per feedback * update changelog --------- Co-authored-by: Chris Stackhouse <[email protected]>
1 parent cd7916b commit 7d49bec

13 files changed

+46
-0
lines changed

src/Resources/ResourceManager/Implementation/Policy/GetAzurePolicyAssignment.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
2727
/// <summary>
2828
/// Gets the policy assignment.
2929
/// </summary>
30+
[CmdletOutputBreakingChangeWithVersion(
31+
typeof(PsPolicyAssignment), deprecateByAzVersion: "11.0.0", deprecateByVersion: "7.0.0", DeprecatedOutputProperties = new[] { "Properties" },
32+
NewOutputProperties = new[] { "Description", "DisplayName", "EnforcementMode", "Metadata", "NonComplianceMessages", "NotScopes", "Parameters", "PolicyDefinitionId", "Scope" })]
3033
[Cmdlet(VerbsCommon.Get, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "PolicyAssignment", DefaultParameterSetName = PolicyCmdletBase.DefaultParameterSet), OutputType(typeof(PsPolicyAssignment))]
3134
public class GetAzurePolicyAssignmentCmdlet : PolicyCmdletBase
3235
{

src/Resources/ResourceManager/Implementation/Policy/GetAzurePolicyDefinition.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
1818
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.ErrorResponses;
1919
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions;
2020
using Microsoft.Azure.Commands.ResourceManager.Common;
21+
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
2122

2223
using Newtonsoft.Json.Linq;
2324
using Policy;
@@ -28,6 +29,9 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
2829
/// <summary>
2930
/// Gets the policy definition.
3031
/// </summary>
32+
[CmdletOutputBreakingChangeWithVersion(
33+
typeof(PsPolicyDefinition), deprecateByAzVersion: "11.0.0", deprecateByVersion: "7.0.0", DeprecatedOutputProperties = new[] { "Properties" },
34+
NewOutputProperties = new[] { "Description", "DisplayName", "Metadata", "Mode", "Parameters", "PolicyRule", "PolicyType" })]
3135
[Cmdlet(VerbsCommon.Get, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "PolicyDefinition", DefaultParameterSetName = PolicyCmdletBase.NameParameterSet), OutputType(typeof(PsPolicyDefinition))]
3236
public class GetAzurePolicyDefinitionCmdlet : PolicyCmdletBase
3337
{

src/Resources/ResourceManager/Implementation/Policy/GetAzurePolicyExemption.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
1717
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components;
1818
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions;
1919
using Microsoft.Azure.Commands.ResourceManager.Common;
20+
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
2021

2122
using Newtonsoft.Json.Linq;
2223
using Policy;
@@ -26,6 +27,9 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
2627
/// <summary>
2728
/// Gets the policy exemption.
2829
/// </summary>
30+
[CmdletOutputBreakingChangeWithVersion(
31+
typeof(PsPolicyExemption), deprecateByAzVersion: "11.0.0", deprecateByVersion: "7.0.0", DeprecatedOutputProperties = new[] { "Properties" },
32+
NewOutputProperties = new[] { "Description", "DisplayName", "ExemptionCategory", "ExpiresOn", "Metadata", "PolicyAssignmentId", "PolicyDefinitionReferenceIds" })]
2933
[Cmdlet(VerbsCommon.Get, AzureRMConstants.AzureRMPrefix + "PolicyExemption", DefaultParameterSetName = PolicyCmdletBase.NameParameterSet), OutputType(typeof(PsPolicyExemption))]
3034
public class GetAzurePolicyExemptionCmdlet : PolicyCmdletBase
3135
{

src/Resources/ResourceManager/Implementation/Policy/GetAzurePolicySetDefinition.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
1818
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.ErrorResponses;
1919
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions;
2020
using Microsoft.Azure.Commands.ResourceManager.Common;
21+
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
2122

2223
using Newtonsoft.Json.Linq;
2324
using Policy;
@@ -28,6 +29,9 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
2829
/// <summary>
2930
/// Gets the policy set definition.
3031
/// </summary>
32+
[CmdletOutputBreakingChangeWithVersion(
33+
typeof(PsPolicySetDefinition), deprecateByAzVersion: "11.0.0", deprecateByVersion: "7.0.0", DeprecatedOutputProperties = new[] { "Properties" },
34+
NewOutputProperties = new[] { "Description", "DisplayName", "Metadata", "Parameters", "PolicyDefinitionGroups", "PolicyDefinitions", "PolicyType" })]
3135
[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "PolicySetDefinition", DefaultParameterSetName = PolicyCmdletBase.NameParameterSet), OutputType(typeof(PsPolicySetDefinition))]
3236
public class GetAzurePolicySetDefinitionCmdlet : PolicyCmdletBase
3337
{

src/Resources/ResourceManager/Implementation/Policy/NewAzurePolicyAssignment.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
3434
/// <summary>
3535
/// Creates a policy assignment.
3636
/// </summary>
37+
[CmdletOutputBreakingChangeWithVersion(
38+
typeof(PsPolicyAssignment), deprecateByAzVersion: "11.0.0", deprecateByVersion: "7.0.0", DeprecatedOutputProperties = new[] { "Properties" },
39+
NewOutputProperties = new[] { "Description", "DisplayName", "EnforcementMode", "Metadata", "NonComplianceMessages", "NotScopes", "Parameters", "PolicyDefinitionId", "Scope" })]
3740
[Cmdlet(VerbsCommon.New, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "PolicyAssignment", DefaultParameterSetName = PolicyCmdletBase.DefaultParameterSet), OutputType(typeof(PsPolicyAssignment))]
3841
public class NewAzurePolicyAssignmentCmdlet : PolicyCmdletBase, IDynamicParameters
3942
{

src/Resources/ResourceManager/Implementation/Policy/NewAzurePolicyDefinition.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
1818
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.Policy;
1919
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions;
2020
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
21+
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
2122

2223
using Newtonsoft.Json.Linq;
2324
using Policy;
@@ -27,6 +28,9 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
2728
/// <summary>
2829
/// Creates the new policy definition.
2930
/// </summary>
31+
[CmdletOutputBreakingChangeWithVersion(
32+
typeof(PsPolicyDefinition), deprecateByAzVersion: "11.0.0", deprecateByVersion: "7.0.0", DeprecatedOutputProperties = new[] { "Properties" },
33+
NewOutputProperties = new[] { "Description", "DisplayName", "Metadata", "Mode", "Parameters", "PolicyRule", "PolicyType" })]
3034
[Cmdlet(VerbsCommon.New, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "PolicyDefinition", DefaultParameterSetName = PolicyCmdletBase.NameParameterSet), OutputType(typeof(PsPolicyDefinition))]
3135
public class NewAzurePolicyDefinitionCmdlet : PolicyCmdletBase
3236
{

src/Resources/ResourceManager/Implementation/Policy/NewAzurePolicyExemption.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,17 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
2121
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.Policy;
2222
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions;
2323
using Microsoft.Azure.Commands.ResourceManager.Common;
24+
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
2425

2526
using Newtonsoft.Json.Linq;
2627
using Policy;
2728

2829
/// <summary>
2930
/// Creates a policy exemption.
3031
/// </summary>
32+
[CmdletOutputBreakingChangeWithVersion(
33+
typeof(PsPolicyExemption), deprecateByAzVersion: "11.0.0", deprecateByVersion: "7.0.0", DeprecatedOutputProperties = new[] { "Properties" },
34+
NewOutputProperties = new[] { "Description", "DisplayName", "ExemptionCategory", "ExpiresOn", "Metadata", "PolicyAssignmentId", "PolicyDefinitionReferenceIds" })]
3135
[Cmdlet(VerbsCommon.New, AzureRMConstants.AzureRMPrefix + "PolicyExemption", DefaultParameterSetName = PolicyCmdletBase.DefaultParameterSet, SupportsShouldProcess = true), OutputType(typeof(PsPolicyExemption))]
3236
public class NewAzurePolicyExemptionCmdlet : PolicyCmdletBase
3337
{

src/Resources/ResourceManager/Implementation/Policy/NewAzurePolicySetDefinition.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
1717
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components;
1818
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.Policy;
1919
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions;
20+
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
2021

2122
using Newtonsoft.Json.Linq;
2223
using Policy;
@@ -26,6 +27,9 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
2627
/// <summary>
2728
/// Creates the policy set definition.
2829
/// </summary>
30+
[CmdletOutputBreakingChangeWithVersion(
31+
typeof(PsPolicySetDefinition), deprecateByAzVersion: "11.0.0", deprecateByVersion: "7.0.0", DeprecatedOutputProperties = new[] { "Properties" },
32+
NewOutputProperties = new[] { "Description", "DisplayName", "Metadata", "Parameters", "PolicyDefinitionGroups", "PolicyDefinitions", "PolicyType" })]
2933
[Cmdlet(VerbsCommon.New, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "PolicySetDefinition", DefaultParameterSetName = PolicyCmdletBase.NameParameterSet, SupportsShouldProcess = true), OutputType(typeof(PsPolicySetDefinition))]
3034
public class NewAzurePolicySetDefinitionCmdlet : PolicyCmdletBase
3135
{

src/Resources/ResourceManager/Implementation/Policy/SetAzurePolicyAssignment.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
3232
/// <summary>
3333
/// Sets the policy assignment.
3434
/// </summary>
35+
[CmdletOutputBreakingChangeWithVersion(
36+
typeof(PsPolicyAssignment), deprecateByAzVersion: "11.0.0", deprecateByVersion: "7.0.0", DeprecatedOutputProperties = new[] { "Properties" },
37+
NewOutputProperties = new[] { "Description", "DisplayName", "EnforcementMode", "Metadata", "NonComplianceMessages", "NotScopes", "Parameters", "PolicyDefinitionId", "Scope" })]
3538
[Cmdlet(VerbsCommon.Set, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "PolicyAssignment", DefaultParameterSetName = PolicyCmdletBase.NameParameterSet), OutputType(typeof(PsPolicyAssignment))]
3639
public class SetAzurePolicyAssignmentCmdlet : PolicyCmdletBase
3740
{

src/Resources/ResourceManager/Implementation/Policy/SetAzurePolicyDefinition.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
1818
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.Policy;
1919
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions;
2020
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
21+
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
2122

2223
using Newtonsoft.Json.Linq;
2324
using Policy;
@@ -27,6 +28,9 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
2728
/// <summary>
2829
/// Sets the policy definition.
2930
/// </summary>
31+
[CmdletOutputBreakingChangeWithVersion(
32+
typeof(PsPolicyDefinition), deprecateByAzVersion: "11.0.0", deprecateByVersion: "7.0.0", DeprecatedOutputProperties = new[] { "Properties" },
33+
NewOutputProperties = new[] { "Description", "DisplayName", "Metadata", "Mode", "Parameters", "PolicyRule", "PolicyType" })]
3034
[Cmdlet(VerbsCommon.Set, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "PolicyDefinition", DefaultParameterSetName = PolicyCmdletBase.NameParameterSet), OutputType(typeof(PsPolicyDefinition))]
3135
public class SetAzurePolicyDefinitionCmdlet : PolicyCmdletBase
3236
{

0 commit comments

Comments
 (0)