Select-AzureSubscription

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Select-AzureSubscription

Selects or clears a Windows Azure subscription to be used as the current subscription.

Syntax

Parameter Set: Current
Select-AzureSubscription [-SubscriptionName] <String> [-Current] [-PassThru] [-SubscriptionDataFile <String> ] [ <CommonParameters>]

Parameter Set: Default
Select-AzureSubscription [-SubscriptionName] <String> -Default [-PassThru] [-SubscriptionDataFile <String> ] [ <CommonParameters>]

Parameter Set: NoCurrent
Select-AzureSubscription -NoCurrent [-PassThru] [-SubscriptionDataFile <String> ] [ <CommonParameters>]

Parameter Set: NoDefault
Select-AzureSubscription -NoDefault [-PassThru] [-SubscriptionDataFile <String> ] [ <CommonParameters>]

Detailed Description

This topic describes the cmdlet in the .7.2 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.

The Select-AzureSubscription cmdlet selects or clears the subscription to be designated as the current subscription. A current subscription is the one whose settings are available for use by other Windows Azure PowerShell cmdlets.

If a subscription is designated as the default subscription, it is automatically made current when starting a Windows PowerShell session or running a script. To set the default subscription, use the DefaultSubscription parameter and specify the name of the subscription to designate as the default. The default subscription setting can be cleared by specifying the NoDefaultSubscription switch parameter. To specify a different subscription for the current session without affecting the default subscription, use Current.

Parameters

-Current

Specify to reset the current subscription setting. Defines the subscription that will be used by all cmdlets in the current session. If no current subscription is defined, the default subscription setting is used.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Default

Specify to reset the default subscription setting. The default subscription is used by all Windows Azure PowerShell cmdlets across sessions when no current subscription selected.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-NoCurrent

Specify to clear the current subscription setting. The current subscription is used by all cmdlets in the current session. If no current subscription is defined for a session, the default subscription setting is used.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-NoDefault

Specify to clear the default subscription setting. The default subscription is used by all Windows Azure PowerShell cmdlets across sessions when no current subscription selected. If no current subscription is defined for a session, having no default subscription will result in an error.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PassThru

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SubscriptionDataFile<String>

Specifies the path and file name of the subscription data file. This parameter is optional. If it is not provided, the subscription data is selected from a default file in the user's profile.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SubscriptionName<String>

Specifies the name of the subscription that the Windows Azure PowerShell cmdlets will use to read default values. Use the Add-AzureAccount cmdlet to store settings for one or more subscriptions.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see  about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

Examples

Example 1

This command selects "MySubscription" as the current subscription.

C:\PS> Select-AzureSubscription "MySubscription"

Example 2

This command selects "MySubscription" as the current subscription and retrieves its settings from the specified subscription data file.

C:\PS> Select-AzureSubscription "MySubscription" -SubscriptionDataFile "C:\subs\MySubscriptions.xml"

Get-AzureSubscription

Remove-AzureSubscription

Set-AzureSubscription

Get Started with Windows Azure Cmdlets