Select-​Azure​Subscription

Changes the current and default Azure subscriptions.

Syntax

Select-AzureSubscription
      [-Account <String>]
      [-Current]
      [-PassThru]
      [-Profile <AzureSMProfile>]
      -SubscriptionName <String>
      [<CommonParameters>]
Select-AzureSubscription
      [-Account <String>]
      [-Current]
      [-PassThru]
      [-Profile <AzureSMProfile>]
      -SubscriptionId <String>
      [<CommonParameters>]
Select-AzureSubscription
      [-Account <String>]
      [-Default]
      [-PassThru]
      [-Profile <AzureSMProfile>]
      -SubscriptionName <String>
      [<CommonParameters>]
Select-AzureSubscription
      [-Account <String>]
      [-Default]
      [-PassThru]
      [-Profile <AzureSMProfile>]
      -SubscriptionId <String>
      [<CommonParameters>]
Select-AzureSubscription
      [-Account <String>]
      [-NoCurrent]
      [-PassThru]
      [-Profile <AzureSMProfile>]
      [<CommonParameters>]
Select-AzureSubscription
      [-Account <String>]
      [-NoDefault]
      [-PassThru]
      [-Profile <AzureSMProfile>]
      [<CommonParameters>]

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.10 version of the Microsoft Azure PowerShell module. To get the version of the module you're using, in the Azure PowerShell console, type (Get-Module -Name Azure).Version.

Examples

Example 1: Set the current subscription

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

This command makes "ContosoEngineering" the current subscription.

Example 2: Set the default description

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

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

Required Parameters

-Default
Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-NoCurrent
Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-NoDefault
Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-SubscriptionId
Type:String
Aliases:Id
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-SubscriptionName
Type:String
Aliases:Name
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters

-Account
Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Current
Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PassThru

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

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Profile

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

Type:AzureSMProfile
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

None or System.Boolean