Get-AzSubscription

In this Azure PowerShell article, we will discuss the syntax and usage of the Get-AzSubscription PowerShell command along with certain examples of how to use this command.

Get-AzSubscription

If you wish to get the List of Azure Subscriptions, then the Get-AzSubscription PowerShell command can help you to achieve this.

Syntax

Below is the syntax of the Get-AzSubscription PowerShell command.

Get-AzSubscription
Get-AzSubscription [-TenantId <String>]
Get-AzSubscription [-SubscriptionName <String>] [-TenantId <String>]

Well, let’s discuss a few examples of how to use the Get-AzSubscription PowerShell command.

Example-1:

You can execute the below PowerShell command to get the lists of Azure Subscriptions.

Get-AzSubscription

After executing the above PowerShell command, we got the expected output as below.

PS C:\WINDOWS\system32>  Get-AzSubscription

Name                     Id                                   TenantId                             State  
----                     --                                   --------                             -----  
Visual Studio Enterprise 1cdf4300-dee5-4518-9c9c-feaa72a5cbd1 5d9d690a-0310-474d-ae8b-42df2d549228 Enabled

You can see the same output below

Get-AzSubscription

Example-2:

You can execute the below PowerShell command to get the specific Azure subscription based on the specified TenantId.

Get-AzSubscription -TenantId '5d9d690a-0310-474d-ae8b-42df2d549228'

After executing the above PowerShell command, we got the expected output as shown below.

get-azsubscription command

Example-3:

You can also execute the below PowerShell command to get the lists of subscriptions in the current tenant.

Get-AzSubscription -TenantId (Get-AzContext).Tenant

After executing the above command, I got the expected output below

get-azsubscription command not found

You can also check out a video tutorial on the Get-AzSubscription command.

Final Thoughts

In this Azure PowerShell command, we discussed the syntax and usage of the Get-AzSubscription PowerShell command with certain examples of how to use this particular command.