Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

Remove-AzureSubscription

Remove-AzureSubscription

microsoft.windowsazure.commands.profile.dll, microsoft.windowsazure.commands.dll

Synopsis

Deletes an Azure subscription from Windows PowerShell.

Syntax

Remove-AzureSubscription [-SubscriptionName] [-Force] [-PassThru] [-SubscriptionDataFile] [-WhatIf] [-Confirm] [<CommonParameters>]

Remove-AzureSubscription [-SubscriptionId] [-Force] [-PassThru] [-SubscriptionDataFile] [-WhatIf] [-Confirm] [<CommonParameters>]

Detailed Description

The Remove-AzureSubscription cmdlet deletes an Azure subscription from your subscription data file so Windows PowerShell can't find it. This cmdlet does not delete the subscription from Microsoft Azure, or change the actual subscription in any way.

This topic describes the cmdlet in the 0.8.9 version of the Microsoft Azure PowerShell module. To find out the version of the module you're using, from the Azure PowerShell console, type (get-module azure).version.

Parameters

-SubscriptionName <String>

Specifies the subscription name. This parameter is required. The parameter value is case-sensitive. Wildcard characters are not permitted.

Aliases

None

Required?

true

Position

0

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-Force <SwitchParameter>

Suppresses the confirmation prompt. By default, Remove-AzureSubscription prompts you before deleting the subscription.

Aliases

None

Required?

false

Position

2

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-PassThru <SwitchParameter>

Returns True ($true) if the command succeeds and False ($false) if it fails. By default, this cmdlet does not return any output.

Aliases

None

Required?

false

Position

3

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-SubscriptionDataFile <String>

Deletes the subscription from an alternate subscription data file. Use this parameter if you used the SubscriptionDataFile parameter of Add-AzureAccount or Import-PublishSettingsFile to specify an alternate location for the subscription data file. By default, your subscription data file is saved in your roaming user profile.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-WhatIf <SwitchParameter>

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Aliases

None

Required?

false

Position

named

Default value

false

Accept pipeline input?

false

Accept wildcard characters?

false

-Confirm <SwitchParameter>

Prompts you for confirmation before running the cmdlet.

Aliases

None

Required?

false

Position

named

Default value

false

Accept pipeline input?

false

Accept wildcard characters?

false

-SubscriptionId <String>

Aliases

None

Required?

true

Position

0

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

Input Type

None

Return Type

None or System.Boolean

Notes

Examples

-------------------------- Example 1: Delete a subscription --------------------------

This command deletes the "Test" subscription from the default subscription data file.

PS C:\> C:\PS> Remove-AzureSubscription -SubscriptionName Test

Confirm
Are you sure you want to perform this action?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):

-------------------------- Example 2: Delete from an alternate subscription data file --------------------------

This command deletes the Test subscription from the MySubscriptions.xml subscription data file. The command uses the Force parameter to suppress the confirmation prompt.

PS C:\> C:\PS> Remove-AzureSubscription -SubscriptionName Test -SubscriptionDataFile C:\Subs\MySubscriptions.xml -Force

-------------------------- Example 3: Delete a subscription in a script --------------------------

This command uses the Remove-AzureSubscription command in an If statement. It uses the PassThru parameter, which returns a Boolean value, to determine whether the script block in the If statement is executed.

PS C:\> C:\PS> ...if (Remove-AzureSubscription -SubscriptionName Test -PassThru) {...}

Online Version
Get-AzureSubscription
Select-AzureSubscription
Set-AzureSubscription