This cmdlet retrieves information about the Azure subscriptions accessible to the user. It's a fundamental command for managing and viewing your Azure resources.
| Name | Type | Description |
|---|---|---|
-SubscriptionId |
String |
Specifies the ID of the subscription to retrieve. If omitted, all accessible subscriptions are returned. |
-TenantId |
String |
Specifies the ID of the tenant that the subscription belongs to. |
-ErrorAction |
ActionPreference |
Specifies how to handle errors. Allowed values are Continue, Ignore, Inquire, SilentlyContinue, Stop, and Suspend. |
-ErrorVariable |
String |
Specifies a variable in which to store error messages. |
-OutBuffer |
String |
Specifies that the output of the command is buffered. |
-OutVariable |
String |
Specifies that the output of the command is added to a variable. |
-WarningAction |
ActionPreference |
Specifies how to handle warnings. Allowed values are Continue, Ignore, Inquire, SilentlyContinue, Stop, and Suspend. |
-WarningVariable |
String |
Specifies a variable in which to store warning messages. |
-Confirm |
SwitchParameter |
Prompts you for confirmation before running the cmdlet. |
-WhatIf |
SwitchParameter |
Shows what would happen if the cmdlet runs. The cmdlet is not run. |
PS > Get-AzSubscription
PS > Get-AzSubscription -SubscriptionId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
PS > Get-AzSubscription -TenantId "yyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy"
PS > Get-AzSubscription -OutVariable subscriptions