Skip to content

Commit d6236ba

Browse files
author
Jianghao Lu
committed
Merge pull request Azure#814 from vivsriaus/WarnDeploymentRG
Warn users of impending removal of deployment parameters from New-Azu…
2 parents d601cef + 5ff2eb8 commit d6236ba

File tree

9 files changed

+50
-3
lines changed

9 files changed

+50
-3
lines changed

src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceCmdlet.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ public sealed class GetAzureResourceCmdlet : ResourceManagerCmdletBase
108108
/// </summary>
109109
[Parameter(ParameterSetName = GetAzureResourceCmdlet.GetResourceParameterSet, Mandatory = false, ValueFromPipelineByPropertyName = false, HelpMessage = "The parent resource type. e.g. Servers/myServer.")]
110110
[ValidateNotNullOrEmpty]
111-
[Obsolete("This parameter is obsolete and will be removed in future releases. Please use the -ResourceType and -ResourceName parameters instead.")]
112111
public string ParentResource { get; set; }
113112

114113
/// <summary>
@@ -232,6 +231,14 @@ public GetAzureResourceCmdlet()
232231
protected override void OnProcessRecord()
233232
{
234233
base.OnProcessRecord();
234+
if(!string.IsNullOrEmpty(this.TagName) || !string.IsNullOrEmpty(this.TagValue))
235+
{
236+
this.WriteWarning("The TagName and TagValue parameters are obsolete and will be removed in future releases.");
237+
}
238+
if(!string.IsNullOrEmpty(this.ParentResource))
239+
{
240+
this.WriteWarning("The ParentResource parameter is obsolete and will be removed in future releases. Please use the -ResourceType and -ResourceName parameters instead.");
241+
}
235242
this.subscriptionIds.AddRange(this.SubscriptionId.CoalesceEnumerable());
236243
}
237244

src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceGroupDeploymentOperationCmdlet.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ protected override void OnProcessRecord()
6262
this.SubscriptionId = this.Profile.Context.Subscription.Id;
6363
}
6464

65+
if(!string.IsNullOrEmpty(this.ApiVersion))
66+
{
67+
this.WriteWarning("The parameter ApiVersion in Get-AzureResourceGroupDeploymentOperation cmdlet is being deprecated and will be removed in a future release.");
68+
}
69+
6570
this.RunCmdlet();
6671
}
6772

src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/MoveAzureResourceCmdlet.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ protected override void OnEndProcessing()
101101
/// </summary>
102102
private void RunCmdlet()
103103
{
104+
if(this.NoWait.IsPresent)
105+
{
106+
this.WriteWarning("The NoWait parameter is obsolete and will be removed in future releases.");
107+
}
104108
var resourceIdsToUse = this.resourceIds
105109
.Concat(this.ResourceId)
106110
.DistinctArray(StringComparer.InvariantCultureIgnoreCase);

src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/NewAzureResourceCmdlet.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
1616
{
17+
using System;
1718
using System.Collections;
1819
using System.Collections.Generic;
1920
using System.Linq;
@@ -94,6 +95,10 @@ protected override void OnProcessRecord()
9495
{
9596
base.OnProcessRecord();
9697
this.DetermineOutputObjectFormat();
98+
if(this.IsFullObject.IsPresent)
99+
{
100+
this.WriteWarning("The IsFullObject parameter is obsolete and will be removed in future releases.");
101+
}
97102
if (this.OutputObjectFormat == ResourceObjectFormat.Legacy)
98103
{
99104
this.WriteWarning("This cmdlet is using the legacy properties object format. This format is being deprecated. Please use '-OutputObjectFormat New' and update your scripts.");

src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/ResourceManipulationCmdletBase.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ public abstract class ResourceManipulationCmdletBase : ResourceManagerCmdletBase
6868
/// </summary>
6969
[Parameter(ParameterSetName = ResourceManipulationCmdletBase.SubscriptionLevelResoruceParameterSet, Mandatory = false, ValueFromPipelineByPropertyName = false, HelpMessage = "The parent resource type. e.g. Servers/myServer.")]
7070
[ValidateNotNullOrEmpty]
71-
[Obsolete("This parameter is obsolete and will be removed in future releases. Please use the -ResourceType and -ResourceName parameters instead.")]
7271
public string ParentResource { get; set; }
7372

7473
/// <summary>
@@ -125,6 +124,14 @@ public abstract class ResourceManipulationCmdletBase : ResourceManagerCmdletBase
125124
/// </summary>
126125
protected override void OnProcessRecord()
127126
{
127+
if(this.SubscriptionId != null)
128+
{
129+
this.WriteWarning("The SubscriptionId parameter is obsolete and will be removed in future releases.");
130+
}
131+
if (!string.IsNullOrEmpty(this.ParentResource))
132+
{
133+
this.WriteWarning("The ParentResource parameter is obsolete and will be removed in future releases. Please use the -ResourceType and -ResourceName parameters instead.");
134+
}
128135
if (string.IsNullOrWhiteSpace(this.ResourceId) && !this.TenantLevel && this.SubscriptionId == null)
129136
{
130137
this.SubscriptionId = this.Profile.Context.Subscription.Id;

src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Implementation/SetAzureResourceCmdlet.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ protected override void OnProcessRecord()
8585
this.WriteWarning("This cmdlet is using the legacy properties object format. This format is being deprecated. Please use '-OutputObjectFormat New' and update your scripts.");
8686
}
8787

88+
if(!string.IsNullOrEmpty(this.ODataQuery))
89+
{
90+
this.WriteWarning("The ODataQuery parameter is being deprecated in Set-AzureResource cmdlet and will be removed in a future release.");
91+
}
92+
8893
var resourceId = this.GetResourceId();
8994
this.ConfirmAction(
9095
this.Force,

src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/GetAzureResourceGroupDeploymentCommand.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ public override void ExecuteCmdlet()
4747
new List<string>() { ProvisioningState }
4848
};
4949

50+
if(!string.IsNullOrEmpty(Name))
51+
{
52+
WriteWarning("The parameter 'Name' in Get-AzureResourceGroupDeployment cmdlet is being renamed to DeploymentName and will be updated in a future release.");
53+
}
54+
5055
WriteObject(ResourcesClient.FilterResourceGroupDeployments(options), true);
5156
}
5257
}

src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/NewAzureResourceGroupDeploymentCommand.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ public override void ExecuteCmdlet()
6161
StorageAccountName = StorageAccountName
6262
};
6363

64+
if(!string.IsNullOrEmpty(TemplateVersion) || !string.IsNullOrEmpty(StorageAccountName))
65+
{
66+
WriteWarning("The TemplateVersion and StorageAccountName parameters in New-AzureResourceGroupDeployment cmdlet is being deprecated and will be removed in a future release.");
67+
}
68+
6469
if(this.Mode == DeploymentMode.Complete)
6570
{
6671
this.ConfirmAction(

src/ResourceManager/Resources/Commands.Resources/ResourceGroups/NewAzureResourceGroupCommand.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ public override void ExecuteCmdlet()
6262
Tag = Tag,
6363
ConfirmAction = ConfirmAction
6464
};
65-
65+
if(!string.IsNullOrEmpty(DeploymentName) || !string.IsNullOrEmpty(GalleryTemplateIdentity) || !string.IsNullOrEmpty(TemplateFile)
66+
|| !string.IsNullOrEmpty(TemplateVersion) || TemplateParameterObject != null || !string.IsNullOrEmpty(StorageAccountName))
67+
{
68+
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.");
69+
}
6670
WriteObject(ResourcesClient.CreatePSResourceGroup(parameters));
6771
}
6872
}

0 commit comments

Comments
 (0)