Share via


Get-AzureSubscription

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

Get-AzureSubscription

Gets an Azure subscription configuration object.

Syntax

Parameter Set: ByName
Get-AzureSubscription [[-SubscriptionName] <String> ] [-ExtendedDetails] [-SubscriptionDataFile <String> ] [ <CommonParameters>]

Parameter Set: Current
Get-AzureSubscription [-Current] [-ExtendedDetails] [ <CommonParameters>]

Parameter Set: Default
Get-AzureSubscription [-Default] [-ExtendedDetails] [-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 Get-AzureSubscription cmdlet gets an object with the common subscription settings, including, including subscription ID and management certificate information, as well as connection information for one or more Azure storage accounts. These settings are stored in the user’s profile.

The Azure cmdlets use a number of common parameters, including the subscription ID, the management certificate for a subscription, and storage account settings. These common settings are stored in a file in the Windows PowerShell user’s profile. The Azure PowerShell cmdlets reference the information stored in the subscription data file and use it to provide default values for certain parameters. Multiple subscription data sets are supported, with each identified by a subscription name.

Use the Import-AzurePublishSettingsFile and Set-AzureSubscription cmdlets to store common settings for each subscription to be managed. During a session, use the Select-AzureSubscription cmdlet to choose which subscription data set is used by other Azure cmdlets to retrieve subscription and storage account information. The cmdlets use the settings in the selected subscription unless explicitly overriden by parameters at the command line.

Parameters

-Current

If this parameter is specified, it returns subscription settings for the current subscription. The Default, Current, and SubscriptionName parameters are mutually exclusive. If none of these parameters is specified, Get-AzureSubscription returns a list object with all of the subscriptions currently listed in the subscription data file. The Azure PowerShell cmdlets retrieve default settings for their parameters from the information stored in the current subscription. Use the Select-AzureSubscription cmdlet to select the subscription.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Default

If this parameter is specified, it returns the subscription that has been designated as the default subscription. The Default, Current, and SubscriptionName parameters are mutually exclusive. A default subscription is automatically selected whenever the Windows PowerShell session starts. To designate the default subscription, use the Set-AzureSubscription cmdlet.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ExtendedDetails

If this parameter is specified, it returns quota information for the subscription in addition to the core settings.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SubscriptionDataFile<String>

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-SubscriptionName<String>

Retrieves the configuration settings for the subscription identified by this name. The Default, Current, and SubscriptionName parameters are mutually exclusive. If none of these parameters are used, Get-AzureSubscription returns a list object with all of the subscriptions currently stored in the subscription data file.

Aliases

none

Required?

false

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 gets settings for every subscription currently stored in the default subscription data file and displays it in a table.

C:\PS>Get-AzureSubscription | Format-Table

-------------- EXAMPLE 2 --------------

This command gets the settings for the "MyProdSubsciption" subscription only.

C:\PS>Get-AzureSubscription –SubscriptionName "MyProdSubscription" 

-------------- EXAMPLE 3 --------------

This command gets the settings for all subscriptions currently stored in the specified subscription data file.

C:\PS>Get-AzureSubscription -SubscriptionDataFile "C:\Temp\MySubscriptions.xml"

-------------- EXAMPLE 4 --------------

This command retrieves the settings for the subscription that has been designated as the default subscription. This command returns an error if no subscription has been designated as the default.

C:\PS>Get-AzureSubscription -Default

-------------- EXAMPLE 5 --------------

This command retrieves the settings for the current subscription.

C:\PS>Get-AzureSubscription -Current

Remove-AzureSubscription

Select-AzureSubscription

Set-AzureSubscription

Import-AzurePublishSettingsFile

Get Started with Azure Cmdlets