@@ -28,8 +28,8 @@ namespace Microsoft.Azure.Commands.Blueprint.Cmdlets
28
28
public class RemoveAzureRmBlueprintAssignment : BlueprintCmdletBase
29
29
{
30
30
#region Parameters
31
- [ Parameter ( ParameterSetName = ParameterSetNames . DeleteBlueprintAssignmentByObject , Position = 0 , Mandatory = true , ValueFromPipeline = true , HelpMessage = ParameterHelpMessages . AssignmentSubscriptionId ) ]
32
- [ Parameter ( ParameterSetName = ParameterSetNames . DeleteBlueprintAssignmentByName , Position = 0 , Mandatory = true , ValueFromPipelineByPropertyName = true , HelpMessage = ParameterHelpMessages . AssignmentSubscriptionId ) ]
31
+ [ Parameter ( ParameterSetName = ParameterSetNames . DeleteBlueprintAssignmentByObject , Position = 0 , Mandatory = false , ValueFromPipeline = true , HelpMessage = ParameterHelpMessages . AssignmentSubscriptionId ) ]
32
+ [ Parameter ( ParameterSetName = ParameterSetNames . DeleteBlueprintAssignmentByName , Position = 0 , Mandatory = false , ValueFromPipelineByPropertyName = true , HelpMessage = ParameterHelpMessages . AssignmentSubscriptionId ) ]
33
33
[ ValidateNotNullOrEmpty ]
34
34
public string SubscriptionId { get ; set ; }
35
35
@@ -48,14 +48,16 @@ public class RemoveAzureRmBlueprintAssignment : BlueprintCmdletBase
48
48
#region Cmdlet Overrides
49
49
public override void ExecuteCmdlet ( )
50
50
{
51
+ var subscription = SubscriptionId ?? DefaultContext . Subscription . Id ;
52
+
51
53
try
52
54
{
53
55
switch ( ParameterSetName )
54
56
{
55
57
case ParameterSetNames . DeleteBlueprintAssignmentByName :
56
- if ( ShouldProcess ( SubscriptionId , string . Format ( Resources . DeleteAssignmentShouldProcessString , Name ) ) )
58
+ if ( ShouldProcess ( subscription , string . Format ( Resources . DeleteAssignmentShouldProcessString , Name ) ) )
57
59
{
58
- var deletedAssignment = BlueprintClient . DeleteBlueprintAssignment ( Utils . GetScopeForSubscription ( SubscriptionId ) , Name ) ;
60
+ var deletedAssignment = BlueprintClient . DeleteBlueprintAssignment ( Utils . GetScopeForSubscription ( subscription ) , Name ) ;
59
61
60
62
if ( deletedAssignment != null && PassThru . IsPresent )
61
63
{
@@ -64,7 +66,7 @@ public override void ExecuteCmdlet()
64
66
}
65
67
break ;
66
68
case ParameterSetNames . DeleteBlueprintAssignmentByObject :
67
- if ( ShouldProcess ( SubscriptionId , string . Format ( Resources . DeleteAssignmentShouldProcessString , InputObject . Name ) ) )
69
+ if ( ShouldProcess ( subscription , string . Format ( Resources . DeleteAssignmentShouldProcessString , InputObject . Name ) ) )
68
70
{
69
71
var deletedAssignment = BlueprintClient . DeleteBlueprintAssignment ( InputObject . Scope , InputObject . Name ) ;
70
72
0 commit comments