Select-AzureSubscription
Changes the current and default Azure subscriptions.
Note
The cmdlets referenced in this documentation are for managing legacy Azure resources that use Azure Service Manager (ASM) APIs. This legacy PowerShell module isn't recommended when creating new resources since ASM is scheduled for retirement. For more information, see Azure Service Manager retirement.
The Az PowerShell module is the recommended PowerShell module for managing Azure Resource Manager (ARM) resources with PowerShell.
Syntax
SelectSubscriptionByNameParameterSet (Default)
Select-AzureSubscription
-SubscriptionName <String>
[-Account <String>]
[-Current]
[-PassThru]
[-Profile <AzureSMProfile>]
[<CommonParameters>]
SelectDefaultSubscriptionByNameParameterSet
Select-AzureSubscription
-SubscriptionName <String>
[-Account <String>]
[-Default]
[-PassThru]
[-Profile <AzureSMProfile>]
[<CommonParameters>]
SelectSubscriptionByIdParameterSet
Select-AzureSubscription
-SubscriptionId <String>
[-Account <String>]
[-Current]
[-PassThru]
[-Profile <AzureSMProfile>]
[<CommonParameters>]
SelectDefaultSubscriptionByIdParameterSet
Select-AzureSubscription
-SubscriptionId <String>
[-Account <String>]
[-Default]
[-PassThru]
[-Profile <AzureSMProfile>]
[<CommonParameters>]
NoCurrentSubscriptionParameterSet
Select-AzureSubscription
[-Account <String>]
[-NoCurrent]
[-PassThru]
[-Profile <AzureSMProfile>]
[<CommonParameters>]
NoDefaultSubscriptionParameterSet
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 subscription
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.
Parameters
-Account
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
.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-Current
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
.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
SelectSubscriptionByNameParameterSet
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
SelectSubscriptionByIdParameterSet
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-Default
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
.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
SelectDefaultSubscriptionByNameParameterSet
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
SelectDefaultSubscriptionByIdParameterSet
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-NoCurrent
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
.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
NoCurrentSubscriptionParameterSet
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-NoDefault
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
.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
NoDefaultSubscriptionParameterSet
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-PassThru
Returns $True if the command succeeds and $False if it fails. By default, this cmdlet does not return any output.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | 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.
Parameter properties
Type: | AzureSMProfile |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-SubscriptionId
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
.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | Id |
Parameter sets
SelectSubscriptionByIdParameterSet
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
SelectDefaultSubscriptionByIdParameterSet
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-SubscriptionName
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
.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | Name |
Parameter sets
SelectSubscriptionByNameParameterSet
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
SelectDefaultSubscriptionByNameParameterSet
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs
None
You can pipe input to this cmdlet by property name, but not by value.
Outputs
None or System.Boolean
If you use the PassThru parameter, this cmdlet returns a Boolean value. By default, it does not generate any output.