diff --git a/src/PolicyInsights/PolicyInsights/ChangeLog.md b/src/PolicyInsights/PolicyInsights/ChangeLog.md index 5d3782c96f83..14a56e5b16a8 100644 --- a/src/PolicyInsights/PolicyInsights/ChangeLog.md +++ b/src/PolicyInsights/PolicyInsights/ChangeLog.md @@ -18,6 +18,7 @@ - Additional information about change #1 --> ## Upcoming Release +* Added Breaking Change notifications to many of the cmdlets in Az.PolicyInsights. ## Version 1.7.3 * Updated Azure.Core from 1.47.3 to 1.50.0 diff --git a/src/PolicyInsights/PolicyInsights/Cmdlets/Attestations/GetAzureRmPolicyAttestation.cs b/src/PolicyInsights/PolicyInsights/Cmdlets/Attestations/GetAzureRmPolicyAttestation.cs index 8ada1d62dc80..f7b69d4cbd88 100644 --- a/src/PolicyInsights/PolicyInsights/Cmdlets/Attestations/GetAzureRmPolicyAttestation.cs +++ b/src/PolicyInsights/PolicyInsights/Cmdlets/Attestations/GetAzureRmPolicyAttestation.cs @@ -12,29 +12,38 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.Azure.Commands.Common.Exceptions; using Microsoft.Azure.Commands.PolicyInsights.Common; +using Microsoft.Azure.Commands.PolicyInsights.Models; +using Microsoft.Azure.Commands.PolicyInsights.Models.Attestations; using Microsoft.Azure.Commands.PolicyInsights.Models.Remediation; +using Microsoft.Azure.Commands.PolicyInsights.Properties; using Microsoft.Azure.Commands.ResourceManager.Common; using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters; using Microsoft.Azure.Management.Internal.Resources.Models; -using Microsoft.Azure.Management.PolicyInsights.Models; using Microsoft.Azure.Management.PolicyInsights; +using Microsoft.Azure.Management.PolicyInsights.Models; +using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; using Microsoft.WindowsAzure.Commands.Utilities.Common; using System; using System.Collections.Generic; +using System.Linq; using System.Management.Automation; using System.Text; -using Microsoft.Azure.Commands.PolicyInsights.Properties; -using Microsoft.Azure.Commands.PolicyInsights.Models; -using System.Linq; -using Microsoft.Azure.Commands.PolicyInsights.Models.Attestations; -using Microsoft.Azure.Commands.Common.Exceptions; namespace Microsoft.Azure.Commands.PolicyInsights.Cmdlets.Attestations { /// /// Gets policy attestations. /// + [CmdletOutputBreakingChangeWithVersion( + typeof(PSAttestation), + deprecateByAzVersion: "16.0.0", + deprecateByVersion: "2.0.0", + ReplacementCmdletOutputTypeName = "Attestation", + DeprecatedOutputProperties = new string[] { "SystemData" }, + NewOutputProperties = new string[] { "ResourceGroupName", "SystemDataCreatedAt", "SystemDataCreatedBy", "SystemDataCreatedByType", "SystemDataLastModifiedAt", "SystemDataLastModifiedBy", "SystemDataLastModifiedByType" } + )] [Cmdlet(VerbsCommon.Get, AzureRMConstants.AzureRMPrefix + "PolicyAttestation", DefaultParameterSetName = ParameterSetNames.SubscriptionScope), OutputType(typeof(PSAttestation))] public class GetAzureRmPolicyAttestation : AttestationCmdletBase { diff --git a/src/PolicyInsights/PolicyInsights/Cmdlets/Attestations/NewAzureRmPolicyAttestation.cs b/src/PolicyInsights/PolicyInsights/Cmdlets/Attestations/NewAzureRmPolicyAttestation.cs index 43b7452321f7..87ccdb5c0864 100644 --- a/src/PolicyInsights/PolicyInsights/Cmdlets/Attestations/NewAzureRmPolicyAttestation.cs +++ b/src/PolicyInsights/PolicyInsights/Cmdlets/Attestations/NewAzureRmPolicyAttestation.cs @@ -20,7 +20,7 @@ using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters; using Microsoft.Azure.Management.PolicyInsights; using Microsoft.Azure.Management.PolicyInsights.Models; - +using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; using System; using System.Globalization; using System.Linq; @@ -31,6 +31,14 @@ namespace Microsoft.Azure.Commands.PolicyInsights.Cmdlets.Attestations /// /// Creates a new Policy Attestation /// + [CmdletOutputBreakingChangeWithVersion( + typeof(PSAttestation), + deprecateByAzVersion: "16.0.0", + deprecateByVersion: "2.0.0", + ReplacementCmdletOutputTypeName = "Attestation", + DeprecatedOutputProperties = new string[] { "SystemData" }, + NewOutputProperties = new string[] { "ResourceGroupName", "SystemDataCreatedAt", "SystemDataCreatedBy", "SystemDataCreatedByType", "SystemDataLastModifiedAt", "SystemDataLastModifiedBy", "SystemDataLastModifiedByType" } + )] [Cmdlet(VerbsCommon.New, AzureRMConstants.AzureRMPrefix + "PolicyAttestation", DefaultParameterSetName = ParameterSetNames.ByName, SupportsShouldProcess = true), OutputType(typeof(PSAttestation))] public class NewAzureRmPolicyAttestation : AttestationCmdletBase { diff --git a/src/PolicyInsights/PolicyInsights/Cmdlets/Attestations/SetAzureRmPolicyAttestation.cs b/src/PolicyInsights/PolicyInsights/Cmdlets/Attestations/SetAzureRmPolicyAttestation.cs index 742e46a4832f..c4b744573011 100644 --- a/src/PolicyInsights/PolicyInsights/Cmdlets/Attestations/SetAzureRmPolicyAttestation.cs +++ b/src/PolicyInsights/PolicyInsights/Cmdlets/Attestations/SetAzureRmPolicyAttestation.cs @@ -21,6 +21,7 @@ using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters; using Microsoft.Azure.Management.PolicyInsights; using Microsoft.Azure.Management.PolicyInsights.Models; +using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; using Microsoft.WindowsAzure.Commands.Utilities.Common; using System; using System.Collections.Generic; @@ -34,6 +35,14 @@ namespace Microsoft.Azure.Commands.PolicyInsights.Cmdlets.Attestations /// /// Updates a policy attestation. /// + [CmdletOutputBreakingChangeWithVersion( + typeof(PSAttestation), + deprecateByAzVersion: "16.0.0", + deprecateByVersion: "2.0.0", + ReplacementCmdletOutputTypeName = "Attestation", + DeprecatedOutputProperties = new string[] { "SystemData" }, + NewOutputProperties = new string[] { "ResourceGroupName", "SystemDataCreatedAt", "SystemDataCreatedBy", "SystemDataCreatedByType", "SystemDataLastModifiedAt", "SystemDataLastModifiedBy", "SystemDataLastModifiedByType" } + )] [Cmdlet(verbName: VerbsCommon.Set, AzureRMConstants.AzureRMPrefix + "PolicyAttestation", DefaultParameterSetName = ParameterSetNames.ByName, SupportsShouldProcess = true), OutputType(typeof(PSAttestation))] public class SetAzureRmPolicyAttestation : AttestationCmdletBase { diff --git a/src/PolicyInsights/PolicyInsights/Cmdlets/GetAzPolicyMetadata.cs b/src/PolicyInsights/PolicyInsights/Cmdlets/GetAzPolicyMetadata.cs index f3a549dae6dc..86d587260398 100644 --- a/src/PolicyInsights/PolicyInsights/Cmdlets/GetAzPolicyMetadata.cs +++ b/src/PolicyInsights/PolicyInsights/Cmdlets/GetAzPolicyMetadata.cs @@ -14,19 +14,27 @@ namespace Microsoft.Azure.Commands.PolicyInsights.Cmdlets { - using System.Linq; - using System.Management.Automation; - using System.Threading; using Microsoft.Azure.Commands.PolicyInsights.Common; using Microsoft.Azure.Commands.PolicyInsights.Models; using Microsoft.Azure.Commands.ResourceManager.Common; using Microsoft.Azure.Management.PolicyInsights; using Microsoft.Azure.Management.PolicyInsights.Models; + using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; using Microsoft.WindowsAzure.Commands.Utilities.Common; + using System.Linq; + using System.Management.Automation; + using System.Threading; /// /// Gets policy metadata. /// + [CmdletOutputBreakingChangeWithVersion( + typeof(PSPolicyMetadata), + deprecateByAzVersion: "16.0.0", + deprecateByVersion: "2.0.0", + ReplacementCmdletOutputTypeName = "PolicyMetadata", + NewOutputProperties = new string[] { "ResourceGroupName" } + )] [Cmdlet("Get", AzureRMConstants.AzureRMPrefix + "PolicyMetadata"), OutputType(typeof(PSPolicyMetadata))] public class GetAzPolicyMetadata : PolicyInsightsCmdletBase { diff --git a/src/PolicyInsights/PolicyInsights/Cmdlets/GetAzureRmPolicyEvent.cs b/src/PolicyInsights/PolicyInsights/Cmdlets/GetAzureRmPolicyEvent.cs index 5b50fb3da478..47c5ea7176fc 100644 --- a/src/PolicyInsights/PolicyInsights/Cmdlets/GetAzureRmPolicyEvent.cs +++ b/src/PolicyInsights/PolicyInsights/Cmdlets/GetAzureRmPolicyEvent.cs @@ -14,19 +14,28 @@ namespace Microsoft.Azure.Commands.PolicyInsights.Cmdlets { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Management.Automation; using Microsoft.Azure.Commands.PolicyInsights.Common; using Microsoft.Azure.Commands.PolicyInsights.Models; using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters; using Microsoft.Azure.Management.PolicyInsights; + using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; + using System; + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; using RestApiModels = Microsoft.Azure.Management.PolicyInsights.Models; /// /// Gets policy events /// + [CmdletOutputBreakingChangeWithVersion( + typeof(PolicyEvent), + deprecateByAzVersion: "16.0.0", + deprecateByVersion: "2.0.0", + DeprecatedOutputProperties = new string[] { "ResourceTags", "ManagementGroupIds" }, + NewOutputProperties = new string[] { "ResourceTag", "ManagementGroupId", "ComplianceState", "Component", "EffectiveParameter", "OdataContext", "OdataId", + "Keys", "Values", "Count", "AdditionalProperties" } + )] [Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "PolicyEvent", DefaultParameterSetName = ParameterSetNames.SubscriptionScope), OutputType(typeof(PolicyEvent))] public class GetAzureRmPolicyEvent : PolicyInsightsCmdletBase { diff --git a/src/PolicyInsights/PolicyInsights/Cmdlets/GetAzureRmPolicyState.cs b/src/PolicyInsights/PolicyInsights/Cmdlets/GetAzureRmPolicyState.cs index 71aab994640c..c950bfe13664 100644 --- a/src/PolicyInsights/PolicyInsights/Cmdlets/GetAzureRmPolicyState.cs +++ b/src/PolicyInsights/PolicyInsights/Cmdlets/GetAzureRmPolicyState.cs @@ -14,19 +14,27 @@ namespace Microsoft.Azure.Commands.PolicyInsights.Cmdlets { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Management.Automation; using Microsoft.Azure.Commands.PolicyInsights.Common; using Microsoft.Azure.Commands.PolicyInsights.Models; using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters; using Microsoft.Azure.Management.PolicyInsights; + using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; + using System; + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; using RestApiModels = Microsoft.Azure.Management.PolicyInsights.Models; /// /// Gets policy states /// + [CmdletOutputBreakingChangeWithVersion( + typeof(PolicyState), + deprecateByAzVersion: "16.0.0", + deprecateByVersion: "2.0.0", + DeprecatedOutputProperties = new string[] { "ResourceTags", "ManagementGroupIds" }, + NewOutputProperties = new string[] { "ResourceGroupName", "ResourceTag", "ManagementGroupId" } + )] [Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "PolicyState", DefaultParameterSetName = ParameterSetNames.SubscriptionScope), OutputType(typeof(PolicyState))] public class GetAzureRmPolicyState : PolicyInsightsCmdletBase { diff --git a/src/PolicyInsights/PolicyInsights/Cmdlets/GetAzureRmPolicyStateSummary.cs b/src/PolicyInsights/PolicyInsights/Cmdlets/GetAzureRmPolicyStateSummary.cs index 89cc63976a5f..3793167bd5be 100644 --- a/src/PolicyInsights/PolicyInsights/Cmdlets/GetAzureRmPolicyStateSummary.cs +++ b/src/PolicyInsights/PolicyInsights/Cmdlets/GetAzureRmPolicyStateSummary.cs @@ -14,19 +14,28 @@ namespace Microsoft.Azure.Commands.PolicyInsights.Cmdlets { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Management.Automation; using Microsoft.Azure.Commands.PolicyInsights.Common; using Microsoft.Azure.Commands.PolicyInsights.Models; using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters; using Microsoft.Azure.Management.PolicyInsights; + using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; + using System; + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; using RestApiModels = Microsoft.Azure.Management.PolicyInsights.Models; /// /// Gets policy states /// + [CmdletOutputBreakingChangeWithVersion( + typeof(PolicyStateSummary), + deprecateByAzVersion: "16.0.0", + deprecateByVersion: "2.0.0", + DeprecatedOutputProperties = new string[] { "PolicyAssignments", "Results" }, + NewOutputProperties = new string[] { "PolicyAssignment", "ResultCompliantResource", "ResultNonCompliantPolicy", "ResultNonCompliantResource", "ResultPolicyDetail", + "ResultPolicyGroupDetail", "ResultQueryResultsUri", "ResultResourceDetail", "OdataId", "OdataContext" } + )] [Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "PolicyStateSummary", DefaultParameterSetName = ParameterSetNames.SubscriptionScope), OutputType(typeof(PolicyStateSummary))] public class GetAzureRmPolicyStateSummary : PolicyInsightsCmdletBase { diff --git a/src/PolicyInsights/PolicyInsights/Cmdlets/Remediation/GetAzureRmPolicyRemediation.cs b/src/PolicyInsights/PolicyInsights/Cmdlets/Remediation/GetAzureRmPolicyRemediation.cs index 8d679603fc90..a11a29472a13 100644 --- a/src/PolicyInsights/PolicyInsights/Cmdlets/Remediation/GetAzureRmPolicyRemediation.cs +++ b/src/PolicyInsights/PolicyInsights/Cmdlets/Remediation/GetAzureRmPolicyRemediation.cs @@ -14,9 +14,6 @@ namespace Microsoft.Azure.Commands.PolicyInsights.Cmdlets.Remediation { - using System.Collections.Generic; - using System.Linq; - using System.Management.Automation; using Microsoft.Azure.Commands.PolicyInsights.Common; using Microsoft.Azure.Commands.PolicyInsights.Models.Remediation; using Microsoft.Azure.Commands.PolicyInsights.Properties; @@ -24,11 +21,24 @@ namespace Microsoft.Azure.Commands.PolicyInsights.Cmdlets.Remediation using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters; using Microsoft.Azure.Management.PolicyInsights; using Microsoft.Azure.Management.PolicyInsights.Models; + using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; using Microsoft.WindowsAzure.Commands.Utilities.Common; + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; /// /// Gets policy remediations. /// + [CmdletOutputBreakingChangeWithVersion( + typeof(PSRemediation), + deprecateByAzVersion: "16.0.0", + deprecateByVersion: "2.0.0", + ReplacementCmdletOutputTypeName = "Remediation", + DeprecatedOutputProperties = new string[] { "Filters", "DeploymentSummary", "FailureThreshold", "ParallelDeployments" }, + NewOutputProperties = new string[] { "FilterLocation", "FilterResourceId", "DeploymentStatusFailedDeployment", "DeploymentStatusSuccessfulDeployment", "DeploymentStatusTotalDeployment", "FailureThresholdPercentage", "ParallelDeployment", + "ResourceGroupName", "SystemDataCreatedAt", "SystemDataCreatedBy", "SystemDataCreatedByType", "SystemDataLastModifiedAt", "SystemDataLastModifiedBy", "SystemDataLastModifiedByType" } + )] [Cmdlet("Get", AzureRMConstants.AzureRMPrefix + "PolicyRemediation", DefaultParameterSetName = ParameterSetNames.SubscriptionScope), OutputType(typeof(PSRemediation))] public class GetAzureRmPolicyRemediation : RemediationCmdletBase { diff --git a/src/PolicyInsights/PolicyInsights/Cmdlets/Remediation/StartAzureRmPolicyRemediation.cs b/src/PolicyInsights/PolicyInsights/Cmdlets/Remediation/StartAzureRmPolicyRemediation.cs index 5d4439e41bc8..6089f284f3d5 100644 --- a/src/PolicyInsights/PolicyInsights/Cmdlets/Remediation/StartAzureRmPolicyRemediation.cs +++ b/src/PolicyInsights/PolicyInsights/Cmdlets/Remediation/StartAzureRmPolicyRemediation.cs @@ -14,9 +14,6 @@ namespace Microsoft.Azure.Commands.PolicyInsights.Cmdlets.Remediation { - using System.Globalization; - using System.Linq; - using System.Management.Automation; using Microsoft.Azure.Commands.PolicyInsights.Common; using Microsoft.Azure.Commands.PolicyInsights.Models.Remediation; using Microsoft.Azure.Commands.PolicyInsights.Properties; @@ -24,10 +21,24 @@ namespace Microsoft.Azure.Commands.PolicyInsights.Cmdlets.Remediation using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters; using Microsoft.Azure.Management.PolicyInsights; using Microsoft.Azure.Management.PolicyInsights.Models; + using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; + using System.Globalization; + using System.Linq; + using System.Management.Automation; /// /// Creates and starts a policy remediation. /// + [CmdletOutputBreakingChangeWithVersion( + typeof(PSRemediation), + deprecateByAzVersion: "16.0.0", + deprecateByVersion: "2.0.0", + ReplacementCmdletOutputTypeName = "Remediation", + DeprecatedOutputProperties = new string[] { "Filters", "DeploymentSummary", "FailureThreshold", "ParallelDeployments" }, + NewOutputProperties = new string[] { "FilterLocation", "FilterResourceId", "DeploymentStatusFailedDeployment", "DeploymentStatusSuccessfulDeployment", "DeploymentStatusTotalDeployment", "FailureThresholdPercentage", "ParallelDeployment", + "ResourceGroupName", "SystemDataCreatedAt", "SystemDataCreatedBy", "SystemDataCreatedByType", "SystemDataLastModifiedAt", "SystemDataLastModifiedBy", "SystemDataLastModifiedByType" }, + ChangeDescription = "Start-AzPolicyRemediation will now return when the Remediation reaches a terminal state unless you use the new NoWait parameter." + )] [Cmdlet("Start", AzureRMConstants.AzureRMPrefix + "PolicyRemediation", DefaultParameterSetName = ParameterSetNames.ByName, SupportsShouldProcess = true), OutputType(typeof(PSRemediation))] public class StartAzureRmPolicyRemediation : RemediationCmdletBase { diff --git a/src/PolicyInsights/PolicyInsights/Cmdlets/Remediation/StopAzureRmPolicyRemediation.cs b/src/PolicyInsights/PolicyInsights/Cmdlets/Remediation/StopAzureRmPolicyRemediation.cs index 2b579b022bb9..172f9763b93e 100644 --- a/src/PolicyInsights/PolicyInsights/Cmdlets/Remediation/StopAzureRmPolicyRemediation.cs +++ b/src/PolicyInsights/PolicyInsights/Cmdlets/Remediation/StopAzureRmPolicyRemediation.cs @@ -14,19 +14,27 @@ namespace Microsoft.Azure.Commands.PolicyInsights.Cmdlets.Remediation { - using System.Globalization; - using System.Linq; - using System.Management.Automation; using Microsoft.Azure.Commands.PolicyInsights.Common; using Microsoft.Azure.Commands.PolicyInsights.Models.Remediation; using Microsoft.Azure.Commands.PolicyInsights.Properties; using Microsoft.Azure.Commands.ResourceManager.Common; using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters; using Microsoft.Azure.Management.PolicyInsights; + using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; + using System.Globalization; + using System.Linq; + using System.Management.Automation; /// /// Cancels a policy remediation. /// + [CmdletOutputBreakingChangeWithVersion( + typeof(bool), + deprecateByAzVersion: "16.0.0", + deprecateByVersion: "2.0.0", + ReplacementCmdletOutputTypeName = "Remediation", + ChangeDescription = "Stop-AzPolicyRemediation will now have a NoWait switch parameter as well as returning the Remediation object instead of just a boolean." + )] [Cmdlet("Stop", AzureRMConstants.AzureRMPrefix + "PolicyRemediation", DefaultParameterSetName = ParameterSetNames.ByName, SupportsShouldProcess = true), OutputType(typeof(bool))] public class StopAzureRmPolicyRemediation : RemediationCmdletBase {