< Back

Select-AzureSubscription

Wed Jan 30, 2019 5:41 pm

NAME Select-AzureSubscription



SYNOPSIS

Changes the current and default Azure subscriptions





SYNTAX

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



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



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



Select-AzureSubscription [-PassThru] [-SubscriptionDataFile <String>] -NoDefault [<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 .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.





PARAMETERS

-Current [<SwitchParameter>]

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.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Default [<SwitchParameter>]

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".



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-NoCurrent [<SwitchParameter>]

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



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-NoDefault [<SwitchParameter>]

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.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-PassThru [<SwitchParameter>]

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



Required? false

Position? named

Default value

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.



Required? false

Position? named

Default value

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.



Required? true

Position? 1

Default value

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



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.





NOTES





Keywords: azure, azuresm, servicemanagement, management, service, utilities



Example 1: Set the current subscription



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



This command makes "ContosoEngineering" the current subscription.

Example 2: Set the default description



C:\\PS> Select-AzureSubscription -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.



RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/?LinkID=397628

Get-AzureSubscription

Remove-AzureSubscription

Set-AzureSubscription