From 05e44943bcd8a0d0a4fe0bb85c7b5b0e86547eb4 Mon Sep 17 00:00:00 2001 From: vivsriaus Date: Fri, 28 Aug 2015 11:21:00 -0700 Subject: [PATCH 1/4] Warn users of impending removal of deployment parameters from New-AzureResourceGroup --- .../ResourceGroups/NewAzureResourceGroupCommand.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/NewAzureResourceGroupCommand.cs b/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/NewAzureResourceGroupCommand.cs index 65749bef5122..50cc526b7a2c 100644 --- a/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/NewAzureResourceGroupCommand.cs +++ b/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/NewAzureResourceGroupCommand.cs @@ -48,6 +48,7 @@ public class NewAzureResourceGroupCommand : ResourceWithParameterBaseCmdlet, IDy public override void ExecuteCmdlet() { + this.WriteWarning("The deployment parameters in New-AzureResourceGroup cmdlet is being deprecated and will be removed in a future release. Please use New-AzureResourceGroupDeployment to submit deployments."); CreatePSResourceGroupParameters parameters = new CreatePSResourceGroupParameters { ResourceGroupName = Name, From 785ee1c18fbe25bc6c83d062e7793ccab13dee5f Mon Sep 17 00:00:00 2001 From: vivsriaus Date: Fri, 28 Aug 2015 13:22:44 -0700 Subject: [PATCH 2/4] Warn only when deployment params are specified --- .../ResourceGroups/NewAzureResourceGroupCommand.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/NewAzureResourceGroupCommand.cs b/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/NewAzureResourceGroupCommand.cs index 50cc526b7a2c..f1c2f1c2d8d8 100644 --- a/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/NewAzureResourceGroupCommand.cs +++ b/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/NewAzureResourceGroupCommand.cs @@ -48,7 +48,6 @@ public class NewAzureResourceGroupCommand : ResourceWithParameterBaseCmdlet, IDy public override void ExecuteCmdlet() { - this.WriteWarning("The deployment parameters in New-AzureResourceGroup cmdlet is being deprecated and will be removed in a future release. Please use New-AzureResourceGroupDeployment to submit deployments."); CreatePSResourceGroupParameters parameters = new CreatePSResourceGroupParameters { ResourceGroupName = Name, @@ -63,7 +62,11 @@ public override void ExecuteCmdlet() Tag = Tag, ConfirmAction = ConfirmAction }; - + if(!string.IsNullOrEmpty(DeploymentName) || !string.IsNullOrEmpty(GalleryTemplateIdentity) || !string.IsNullOrEmpty(TemplateFile) + || !string.IsNullOrEmpty(TemplateVersion) || TemplateParameterObject != null || !string.IsNullOrEmpty(StorageAccountName)) + { + WriteWarning("The deployment parameters in New-AzureResourceGroup cmdlet is being deprecated and will be removed in a future release. Please use New-AzureResourceGroupDeployment to submit deployments."); + } WriteObject(ResourcesClient.CreatePSResourceGroup(parameters)); } } From 25a28c13b22c930028494ca62ad08f1a6b7a027e Mon Sep 17 00:00:00 2001 From: vivsriaus Date: Fri, 28 Aug 2015 13:51:17 -0700 Subject: [PATCH 3/4] Add more warning messages --- .../Cmdlets/Implementation/GetAzureResourceCmdlet.cs | 2 ++ .../GetAzureResourceGroupDeploymentOperationCmdlet.cs | 5 +++++ .../Cmdlets/Implementation/MoveAzureResourceCmdlet.cs | 1 + .../Cmdlets/Implementation/NewAzureResourceCmdlet.cs | 2 ++ .../Cmdlets/Implementation/ResourceManipulationCmdletBase.cs | 1 + .../Cmdlets/Implementation/SetAzureResourceCmdlet.cs | 5 +++++ .../GetAzureResourceGroupDeploymentCommand.cs | 5 +++++ .../NewAzureResourceGroupDeploymentCommand.cs | 5 +++++ 8 files changed, 26 insertions(+) diff --git a/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceCmdlet.cs b/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceCmdlet.cs index 3f5d838d80cc..7e95666e4840 100644 --- a/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceCmdlet.cs +++ b/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceCmdlet.cs @@ -139,6 +139,7 @@ public sealed class GetAzureResourceCmdlet : ResourceManagerCmdletBase [Parameter(ParameterSetName = GetAzureResourceCmdlet.ListResourcesParameterSet, Mandatory = false, HelpMessage = "The name of the tag to query by.")] [Parameter(ParameterSetName = GetAzureResourceCmdlet.MultiSubscriptionListResourcesParameterSet, Mandatory = false, HelpMessage = "The name of the tag to query by.")] [ValidateNotNullOrEmpty] + [Obsolete("This parameter is obsolete and will be removed in future releases.")] public string TagName { get; set; } /// @@ -147,6 +148,7 @@ public sealed class GetAzureResourceCmdlet : ResourceManagerCmdletBase [Parameter(ParameterSetName = GetAzureResourceCmdlet.ListResourcesParameterSet, Mandatory = false, HelpMessage = "The value of the tag to query by.")] [Parameter(ParameterSetName = GetAzureResourceCmdlet.MultiSubscriptionListResourcesParameterSet, Mandatory = false, HelpMessage = "The value of the tag to query by.")] [ValidateNotNullOrEmpty] + [Obsolete("This parameter is obsolete and will be removed in future releases.")] public string TagValue { get; set; } /// diff --git a/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceGroupDeploymentOperationCmdlet.cs b/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceGroupDeploymentOperationCmdlet.cs index aacc7d822d9e..6ca1e8e0a21b 100644 --- a/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceGroupDeploymentOperationCmdlet.cs +++ b/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceGroupDeploymentOperationCmdlet.cs @@ -62,6 +62,11 @@ protected override void OnProcessRecord() this.SubscriptionId = this.Profile.Context.Subscription.Id; } + if(!string.IsNullOrEmpty(this.ApiVersion)) + { + this.WriteWarning("The parameter ApiVersion in Get-AzureResourceGroupDeploymentOperation cmdlet is being deprecated and will be removed in a future release."); + } + this.RunCmdlet(); } diff --git a/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/MoveAzureResourceCmdlet.cs b/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/MoveAzureResourceCmdlet.cs index f0cd604cb13f..8f9bc6e03cb3 100644 --- a/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/MoveAzureResourceCmdlet.cs +++ b/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/MoveAzureResourceCmdlet.cs @@ -63,6 +63,7 @@ public class MoveAzureResourceCommand : ResourceManagerCmdletBase /// Gets or sets a value that indicates if the operation should wait for completion before returning the result. If set, the cmdlet will return as soon as the request is accepted. /// [Parameter(Mandatory = false, HelpMessage = "Do not wait for operation to complete.")] + [Obsolete("This parameter is obsolete and will be removed in future releases.")] public SwitchParameter NoWait { get; set; } /// diff --git a/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/NewAzureResourceCmdlet.cs b/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/NewAzureResourceCmdlet.cs index 05b8ca0f26a5..8845af83c917 100644 --- a/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/NewAzureResourceCmdlet.cs +++ b/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/NewAzureResourceCmdlet.cs @@ -14,6 +14,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation { + using System; using System.Collections; using System.Collections.Generic; using System.Linq; @@ -70,6 +71,7 @@ public sealed class NewAzureResourceCmdlet : ResourceManipulationCmdletBase /// Gets or sets a value that indicates if the full object was passed it. /// [Parameter(Mandatory = false, HelpMessage = "When set indicates that the full object is passed in to the -PropertyObject parameter.")] + [Obsolete("This parameter is obsolete and will be removed in future releases.")] public SwitchParameter IsFullObject { get; set; } /// diff --git a/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/ResourceManipulationCmdletBase.cs b/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/ResourceManipulationCmdletBase.cs index 302d4f26dc27..197b4dfcbd18 100644 --- a/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/ResourceManipulationCmdletBase.cs +++ b/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/ResourceManipulationCmdletBase.cs @@ -99,6 +99,7 @@ public abstract class ResourceManipulationCmdletBase : ResourceManagerCmdletBase /// [Parameter(ParameterSetName = ResourceManipulationCmdletBase.SubscriptionLevelResoruceParameterSet, Mandatory = false, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The subscription to use.")] [ValidateNotNullOrEmpty] + [Obsolete("This parameter is obsolete and will be removed in future releases.")] public Guid? SubscriptionId { get; set; } /// diff --git a/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/SetAzureResourceCmdlet.cs b/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/SetAzureResourceCmdlet.cs index d47782fbf631..dbed23eda8d5 100644 --- a/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/SetAzureResourceCmdlet.cs +++ b/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/SetAzureResourceCmdlet.cs @@ -85,6 +85,11 @@ protected override void OnProcessRecord() this.WriteWarning("This cmdlet is using the legacy properties object format. This format is being deprecated. Please use '-OutputObjectFormat New' and update your scripts."); } + if(!string.IsNullOrEmpty(this.ODataQuery)) + { + this.WriteWarning("The ODataQuery parameter is being deprecated in Set-AzureResource cmdlet and will be removed in a future release."); + } + var resourceId = this.GetResourceId(); this.ConfirmAction( this.Force, diff --git a/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/GetAzureResourceGroupDeploymentCommand.cs b/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/GetAzureResourceGroupDeploymentCommand.cs index 03159c852894..9e62bfdf2ce6 100644 --- a/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/GetAzureResourceGroupDeploymentCommand.cs +++ b/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/GetAzureResourceGroupDeploymentCommand.cs @@ -47,6 +47,11 @@ public override void ExecuteCmdlet() new List() { ProvisioningState } }; + if(!string.IsNullOrEmpty(Name)) + { + WriteWarning("The parameter 'Name' in Get-AzureResourceGroupDeployment cmdlet is being renamed to DeploymentName and will be updated in a future release."); + } + WriteObject(ResourcesClient.FilterResourceGroupDeployments(options), true); } } diff --git a/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/NewAzureResourceGroupDeploymentCommand.cs b/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/NewAzureResourceGroupDeploymentCommand.cs index acf6650971c9..916570c27eba 100644 --- a/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/NewAzureResourceGroupDeploymentCommand.cs +++ b/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/NewAzureResourceGroupDeploymentCommand.cs @@ -61,6 +61,11 @@ public override void ExecuteCmdlet() StorageAccountName = StorageAccountName }; + if(!string.IsNullOrEmpty(TemplateVersion) || !string.IsNullOrEmpty(StorageAccountName)) + { + WriteWarning("The TemplateVersion and StorageAccountName parameters in New-AzureResourceGroupDeployment cmdlet is being deprecated and will be removed in a future release."); + } + if(this.Mode == DeploymentMode.Complete) { this.ConfirmAction( From 5ff2eb8476b1f34ad276b51c39c26f5d2f5534e9 Mon Sep 17 00:00:00 2001 From: vivsriaus Date: Mon, 31 Aug 2015 11:00:39 -0700 Subject: [PATCH 4/4] Remove Obsolete and instead use warning message --- .../Cmdlets/Implementation/GetAzureResourceCmdlet.cs | 11 ++++++++--- .../Cmdlets/Implementation/MoveAzureResourceCmdlet.cs | 5 ++++- .../Cmdlets/Implementation/NewAzureResourceCmdlet.cs | 5 ++++- .../Implementation/ResourceManipulationCmdletBase.cs | 10 ++++++++-- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceCmdlet.cs b/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceCmdlet.cs index 7e95666e4840..f0357ad23ee0 100644 --- a/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceCmdlet.cs +++ b/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceCmdlet.cs @@ -108,7 +108,6 @@ public sealed class GetAzureResourceCmdlet : ResourceManagerCmdletBase /// [Parameter(ParameterSetName = GetAzureResourceCmdlet.GetResourceParameterSet, Mandatory = false, ValueFromPipelineByPropertyName = false, HelpMessage = "The parent resource type. e.g. Servers/myServer.")] [ValidateNotNullOrEmpty] - [Obsolete("This parameter is obsolete and will be removed in future releases. Please use the -ResourceType and -ResourceName parameters instead.")] public string ParentResource { get; set; } /// @@ -139,7 +138,6 @@ public sealed class GetAzureResourceCmdlet : ResourceManagerCmdletBase [Parameter(ParameterSetName = GetAzureResourceCmdlet.ListResourcesParameterSet, Mandatory = false, HelpMessage = "The name of the tag to query by.")] [Parameter(ParameterSetName = GetAzureResourceCmdlet.MultiSubscriptionListResourcesParameterSet, Mandatory = false, HelpMessage = "The name of the tag to query by.")] [ValidateNotNullOrEmpty] - [Obsolete("This parameter is obsolete and will be removed in future releases.")] public string TagName { get; set; } /// @@ -148,7 +146,6 @@ public sealed class GetAzureResourceCmdlet : ResourceManagerCmdletBase [Parameter(ParameterSetName = GetAzureResourceCmdlet.ListResourcesParameterSet, Mandatory = false, HelpMessage = "The value of the tag to query by.")] [Parameter(ParameterSetName = GetAzureResourceCmdlet.MultiSubscriptionListResourcesParameterSet, Mandatory = false, HelpMessage = "The value of the tag to query by.")] [ValidateNotNullOrEmpty] - [Obsolete("This parameter is obsolete and will be removed in future releases.")] public string TagValue { get; set; } /// @@ -234,6 +231,14 @@ public GetAzureResourceCmdlet() protected override void OnProcessRecord() { base.OnProcessRecord(); + if(!string.IsNullOrEmpty(this.TagName) || !string.IsNullOrEmpty(this.TagValue)) + { + this.WriteWarning("The TagName and TagValue parameters are obsolete and will be removed in future releases."); + } + if(!string.IsNullOrEmpty(this.ParentResource)) + { + this.WriteWarning("The ParentResource parameter is obsolete and will be removed in future releases. Please use the -ResourceType and -ResourceName parameters instead."); + } this.subscriptionIds.AddRange(this.SubscriptionId.CoalesceEnumerable()); } diff --git a/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/MoveAzureResourceCmdlet.cs b/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/MoveAzureResourceCmdlet.cs index 8f9bc6e03cb3..006e38b012be 100644 --- a/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/MoveAzureResourceCmdlet.cs +++ b/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/MoveAzureResourceCmdlet.cs @@ -63,7 +63,6 @@ public class MoveAzureResourceCommand : ResourceManagerCmdletBase /// Gets or sets a value that indicates if the operation should wait for completion before returning the result. If set, the cmdlet will return as soon as the request is accepted. /// [Parameter(Mandatory = false, HelpMessage = "Do not wait for operation to complete.")] - [Obsolete("This parameter is obsolete and will be removed in future releases.")] public SwitchParameter NoWait { get; set; } /// @@ -102,6 +101,10 @@ protected override void OnEndProcessing() /// private void RunCmdlet() { + if(this.NoWait.IsPresent) + { + this.WriteWarning("The NoWait parameter is obsolete and will be removed in future releases."); + } var resourceIdsToUse = this.resourceIds .Concat(this.ResourceId) .DistinctArray(StringComparer.InvariantCultureIgnoreCase); diff --git a/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/NewAzureResourceCmdlet.cs b/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/NewAzureResourceCmdlet.cs index 8845af83c917..d3bc64018b87 100644 --- a/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/NewAzureResourceCmdlet.cs +++ b/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/NewAzureResourceCmdlet.cs @@ -71,7 +71,6 @@ public sealed class NewAzureResourceCmdlet : ResourceManipulationCmdletBase /// Gets or sets a value that indicates if the full object was passed it. /// [Parameter(Mandatory = false, HelpMessage = "When set indicates that the full object is passed in to the -PropertyObject parameter.")] - [Obsolete("This parameter is obsolete and will be removed in future releases.")] public SwitchParameter IsFullObject { get; set; } /// @@ -96,6 +95,10 @@ protected override void OnProcessRecord() { base.OnProcessRecord(); this.DetermineOutputObjectFormat(); + if(this.IsFullObject.IsPresent) + { + this.WriteWarning("The IsFullObject parameter is obsolete and will be removed in future releases."); + } if (this.OutputObjectFormat == ResourceObjectFormat.Legacy) { this.WriteWarning("This cmdlet is using the legacy properties object format. This format is being deprecated. Please use '-OutputObjectFormat New' and update your scripts."); diff --git a/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/ResourceManipulationCmdletBase.cs b/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/ResourceManipulationCmdletBase.cs index 197b4dfcbd18..33d368ea24a6 100644 --- a/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/ResourceManipulationCmdletBase.cs +++ b/src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/ResourceManipulationCmdletBase.cs @@ -68,7 +68,6 @@ public abstract class ResourceManipulationCmdletBase : ResourceManagerCmdletBase /// [Parameter(ParameterSetName = ResourceManipulationCmdletBase.SubscriptionLevelResoruceParameterSet, Mandatory = false, ValueFromPipelineByPropertyName = false, HelpMessage = "The parent resource type. e.g. Servers/myServer.")] [ValidateNotNullOrEmpty] - [Obsolete("This parameter is obsolete and will be removed in future releases. Please use the -ResourceType and -ResourceName parameters instead.")] public string ParentResource { get; set; } /// @@ -99,7 +98,6 @@ public abstract class ResourceManipulationCmdletBase : ResourceManagerCmdletBase /// [Parameter(ParameterSetName = ResourceManipulationCmdletBase.SubscriptionLevelResoruceParameterSet, Mandatory = false, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The subscription to use.")] [ValidateNotNullOrEmpty] - [Obsolete("This parameter is obsolete and will be removed in future releases.")] public Guid? SubscriptionId { get; set; } /// @@ -126,6 +124,14 @@ public abstract class ResourceManipulationCmdletBase : ResourceManagerCmdletBase /// protected override void OnProcessRecord() { + if(this.SubscriptionId != null) + { + this.WriteWarning("The SubscriptionId parameter is obsolete and will be removed in future releases."); + } + if (!string.IsNullOrEmpty(this.ParentResource)) + { + this.WriteWarning("The ParentResource parameter is obsolete and will be removed in future releases. Please use the -ResourceType and -ResourceName parameters instead."); + } if (string.IsNullOrWhiteSpace(this.ResourceId) && !this.TenantLevel && this.SubscriptionId == null) { this.SubscriptionId = this.Profile.Context.Subscription.Id;