Get-AzSubscription

This Azure PowerShell article will discuss the syntax and usage of the Get-AzSubscription PowerShell command and examples of how to get the List of all Azure Subscriptions using this command.

Get-AzSubscription

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

Syntax of Get-AzSubscription

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 PowerShell command, we got the expected output 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.

powershell get-azsubscription

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

Get-AzSubscription PowerShell – Video Tutorial

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.