Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

Get-AzureSubscription

Get-AzureSubscription

microsoft.windowsazure.commands.profile.dll, microsoft.windowsazure.commands.dll

Synopsis

Gets Azure subscriptions in Azure account.

Syntax

Get-AzureSubscription [-SubscriptionName] [-ExtendedDetails] [-SubscriptionDataFile] [<CommonParameters>]

Get-AzureSubscription [-SubscriptionId] [-ExtendedDetails] [-SubscriptionDataFile] [<CommonParameters>]

Get-AzureSubscription [-Default] [-ExtendedDetails] [-SubscriptionDataFile] [<CommonParameters>]

Get-AzureSubscription [-Current] [-ExtendedDetails] [-SubscriptionDataFile] [<CommonParameters>]

Detailed Description

The Get-AzureSubscription cmdlet gets the subscriptions in your Azure account. You can use this cmdlet to get information about the subscription and to pipe the subscription to other cmdlets.Get-AzureSubscription requires access to your Azure accounts. Before you run Get-AzureSubscription, you must run the Add-AzureAccount cmdlet or the cmdlets that download and install a publish settings file (Get-AzurePublishSettingsFile, Import-AzurePublishSettingsFile.This topic describes the cmdlet in the 0.8.8 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

-SubscriptionName <String>

Gets only the specified subscription. Enter the subscription name. The value is case-sensitive. Wildcard characters are not supported. By default, Get-AzureSubscription gets all subscriptions in your Azure accounts.

Aliases

None

Required?

false

Position

0

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-ExtendedDetails <SwitchParameter>

Returns quota information for the subscription, in addition to the standard settings.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-SubscriptionDataFile <String>

Gets a subscription from an alternate subscription data file. Use this parameter if you used the SubscriptionDataFile parameter of Add-AzureAccount or Import-PublishSettingsFile. 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

-SubscriptionId <String>

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-Default <SwitchParameter>

Gets only the default subscription, that is, the subscription designated as "default." By default, Get-AzureSubscription gets all subscriptions in your Azure accounts. To designate a subscription as "default," use the Default parameter of the Select-AzureSubscription cmdlet.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-Current <SwitchParameter>

Gets only the current subscription, that is, the subscription designated as "current." By default, Get-AzureSubscription gets all subscriptions in your Azure accounts. To designate a subscription as "current," use the Current parameter of the Select-AzureSubscription cmdlet.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

Input Type

None

Return Type

Microsoft.WindowsAzure.Commands.Utilities.Common.AzureSubscription

Notes

Get-AzureSubscription gets data from the subscription data file that the Add-AzureAccount and Import-PublishSettingsFile cmdlets create.

Examples

-------------------------- Example 1: Get all subscriptions --------------------------

This command gets all subscriptions in the account.

PS C:\> C:\PS>Get-AzureSubscription

-------------------------- Example 2: Get a subscription by name --------------------------

This command gets only the "MyProdSubsciption" subscription.

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

-------------------------- Example 3: Get the default subscription --------------------------

This command gets only the name of the default subscription. The command first gets the subscription and then uses the dot method to get the SubscriptionName property of the subscription.

PS C:\> C:\PS>(Get-AzureSubscription -Default).SubscriptionName

-------------------------- Example 4: Get selected subscription properties --------------------------

This command returns a list with the name and certificate of the current subscription. It uses a Get-AzureSubscription command to get the current subscription. Then it pipes the subscription to a Format-List command that displays the selected properties in a list.

PS C:\> C:\PS>Get-AzureSubscription -Current | Format-List -Property SubscriptionName, Certificate

-------------------------- Example 5: Use an alternate subscription data file --------------------------

This command gets subscriptions from the C:\Temp\MySubscriptions.xml subscription data file. Use the SubscriptionDataFile parameter if you specified an alternate subscription data file when you ran the Add-AzureAccount or Import-PublishSettingsFile cmdlets.

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

Online Version
Add-AzureAccount
Get-AzurePublishSettingsFile
Import-AzurePublishSettingsFile
Remove-AzureSubscription
Set-AzureSubscription