Select-AzureSubscription

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

Select-AzureSubscription

Changes the current and default Azure subscriptions

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

The Select-AzureSubscription cmdlet sets and clears the current and default Azure subscriptions.

The "current subscription" is the subscription that is used by default in the current Windows PowerShell session. The "default subscription" is used by default in all Windows PowerShell sessions. The "current subscription" label lets you specify a different subscription to be used by default for the current session without changing the "default subscription" for all other sessions.

The "default" subscription designation is saved in your subscription data file. The session-specific "current" designation is not saved.

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

-Current

Sets the "current" subscription. Use the SubscriptionName parameter to identify the subscription.

The "current subscription" is the subscription that is used by default in the current Windows PowerShell session.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Default

Sets the "default" subscription. Use the SubscriptionName parameter to identify the subscription.

The "default subscription" is the subscription that is used by default in the all Windows PowerShell sessions, unless a different subscription is set to "current".

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-NoCurrent

Clears the "current" subscription setting. When no subscription is set to "current," the Azure PowerShell cmdlets use the default subscription.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-NoDefault

Clears the "default" subscription setting. If there is no "default subscription," the "current subscription" is used by default. When there is no current or default subscription, and you do not identify a subscription, commands that require a subscription fail.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PassThru

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SubscriptionDataFile<String>

Specifies 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

-SubscriptionName<String>

Specifies the subscription to change. Enter the subscription name. This parameter value is case-sensitive. Wildcard characters are not permitted.

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.

  • None

    You can pipe input to this cmdlet by property name, but not by value.

Outputs

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

  • None or System.Boolean

    If you use the PassThru parameter, this cmdlet returns a Boolean value. By default, it does not generate any output.

Examples

Example 1: Set the current subscription

This command makes "ContosoEngineering" the current subscription.

C:\PS> Select-AzureSubscription -SubscriptionName ContosoEngineering -Current

Example 2: Set the default description

This command changes the default subscription to "ContosoFinance." It saves the setting in the Subscriptions.xml subscription data file.

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

Get-AzureSubscription

Remove-AzureSubscription

Set-AzureSubscription