diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/ResourceLockManagementCmdletBase.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/ResourceLockManagementCmdletBase.cs index e0a72dc6bf71..7f84ad3b9e4c 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/ResourceLockManagementCmdletBase.cs +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/ResourceLockManagementCmdletBase.cs @@ -88,16 +88,6 @@ public abstract class ResourceLockManagementCmdletBase : ResourceManagerCmdletBa [ValidateNotNullOrEmpty] public string ResourceType { get; set; } - /// - /// Gets or sets the subscription id parameter. - /// - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ResourceGroupResourceLevelLock, Mandatory = false, ValueFromPipeline = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The subscription to use.")] - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.ResourceGroupLevelLock, Mandatory = false, ValueFromPipeline = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The subscription to use.")] - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.SubscriptionLevelLock, Mandatory = false, ValueFromPipeline = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The subscription to use.")] - [Parameter(ParameterSetName = ResourceLockManagementCmdletBase.SubscriptionResourceLevelLock, Mandatory = false, ValueFromPipeline = true, ValueFromPipelineByPropertyName = false, HelpMessage = "The subscription to use.")] - [ValidateNotNullOrEmpty] - public Guid? SubscriptionId { get; set; } - /// /// Gets or sets the resource group name parameter. /// @@ -119,22 +109,6 @@ public abstract class ResourceLockManagementCmdletBase : ResourceManagerCmdletBa [ValidateNotNullOrEmpty] public string LockId { get; set; } - /// - /// Initializes the default subscription id if needed. - /// - protected override void OnProcessRecord() - { - if (string.IsNullOrWhiteSpace(this.LockId) && - string.IsNullOrWhiteSpace(this.Scope) && - this.SubscriptionId == null && - !this.TenantLevel) - { - this.SubscriptionId = DefaultContext.Subscription.Id; - } - - base.OnProcessRecord(); - } - /// /// Gets the resource Id from the supplied PowerShell parameters. /// @@ -155,14 +129,14 @@ protected string GetResourceId(string lockName) throw new InvalidOperationException(string.Format("The Id '{0}' does not belong to a lock.", this.LockId)); } - + return !string.IsNullOrWhiteSpace(this.Scope) ? ResourceIdUtility.GetResourceId( resourceId: this.Scope, extensionResourceType: Constants.MicrosoftAuthorizationLocksType, extensionResourceName: lockName) : ResourceIdUtility.GetResourceId( - subscriptionId: this.SubscriptionId, + subscriptionId: this.DefaultContext.Subscription.Id, resourceGroupName: this.ResourceGroupName, resourceType: this.ResourceType, resourceName: this.ResourceName, diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Microsoft.Azure.Commands.ResourceManager.Cmdlets.dll-Help.xml b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Microsoft.Azure.Commands.ResourceManager.Cmdlets.dll-Help.xml index b4d613db7b4e..c7de93f98193 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Microsoft.Azure.Commands.ResourceManager.Cmdlets.dll-Help.xml +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Microsoft.Azure.Commands.ResourceManager.Cmdlets.dll-Help.xml @@ -1396,13 +1396,6 @@ String - - SubscriptionId - - - - Nullable`1[Guid] - ResourceGroupName @@ -1601,13 +1594,6 @@ String - - SubscriptionId - - - - Nullable`1[Guid] - ApiVersion @@ -1660,13 +1646,6 @@ String - - SubscriptionId - - - - Nullable`1[Guid] - ResourceGroupName @@ -3299,13 +3278,6 @@ String - - SubscriptionId - - The subscription to use. - - Nullable`1[Guid] - ResourceGroupName @@ -3494,13 +3466,6 @@ String - - SubscriptionId - - The subscription to use. - - Nullable`1[Guid] - ApiVersion @@ -3581,13 +3546,6 @@ String - - SubscriptionId - - The subscription to use. - - Nullable`1[Guid] - ResourceGroupName @@ -4631,13 +4589,6 @@ String - - SubscriptionId - - The subscription to use. - - Nullable`1[Guid] - ResourceGroupName @@ -6111,13 +6062,6 @@ String - - SubscriptionId - - The subscription to use. - - Nullable`1[Guid] - ResourceGroupName @@ -6306,13 +6250,6 @@ String - - SubscriptionId - - The subscription to use. - - Nullable`1[Guid] - ApiVersion @@ -6393,13 +6330,6 @@ String - - SubscriptionId - - The subscription to use. - - Nullable`1[Guid] - ResourceGroupName @@ -6627,18 +6557,6 @@ - - SubscriptionId - - The subscription to use. - - Nullable`1[Guid] - - Nullable`1[Guid] - - - - ResourceGroupName