external help file | online version | schema |
---|---|---|
Microsoft.Azure.Commands.Profile.dll-Help.xml |
2.0.0 |
Get subscriptions that the current account can access.
[!INCLUDE rdfe-banner]
Get-AzureRmSubscription [-SubscriptionId <String>] [-TenantId <String>] [<CommonParameters>]
Get-AzureRmSubscription [-SubscriptionName <String>] [-TenantId <String>] [<CommonParameters>]
The Get-AzureRmSubscription cmdlet gets the subscription ID, subscription name, and home tenant for subscriptions that the current account can access.
PS C:\>Get-AzureRmSubscription -All
Subscription Name : Contoso Subscription 1
SubscriptionId : xxxx-xxxx-xxxx-xxxx
TenantId : yyyy-yyyy-yyyy-yyyy
This command gets all subscriptions in all tenants that are authorized for the current account.
PS C:\>Get-AzureRmSubscription -TenantId "xxxx-xxxx-xxxx-xxxx"
Subscription Name : Contoso Subscription 1
SubscriptionId : yyyy-yyyy-yyyy-yyyy
TenantId : xxxx-xxxx-xxxx-xxxx
Subscription Name : Contoso Subscription 2
SubscriptionId : yyyy-yyyy-yyyy-yyyy
TenantId : xxxx-xxxx-xxxx-xxxx
List all subscriptions in the given tenant that are authorized for the current account.
PS C:\>Get-AzureRmSubscription
Subscription Name : Contoso Subscription 1
SubscriptionId : yyyy-yyyy-yyyy-yyyy
TenantId : xxxx-xxxx-xxxx-xxxx
Subscription Name : Contoso Subscription 2
SubscriptionId : yyyy-yyyy-yyyy-yyyy
TenantId : xxxx-xxxx-xxxx-xxxx
This command gets all subscriptions in the current tenant that are authorized for the current user.
PS C:\>Get-AzureRmSubscription -SubscriptionId "xxxx-xxxx-xxxx-xxxx" -TenantId "yyyy-yyyy-yyyy-yyyy" | Set-AzureRmContext
Subscription Name : Contoso Subscription 1
SubscriptionId : xxxx-xxxx-xxxx-xxxx
TenantId : yyyy-yyyy-yyyy-yyyy
This command gets the specified subscription, and then sets the current context to use it. All subsequent cmdlets in this session use the new subscription (Contoso Subscription 1) by default.
Specifies the ID of the subscription to get.
Type: String
Parameter Sets: ListByIdInTenant
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
Specifies the name of the subscription to get.
Type: String
Parameter Sets: ListByNameInTenant
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
Specifies the ID of the tenant that contains subscriptions to get.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).