Get-azurermsubscription

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

Get-azurermsubscription

This is an excellent Azure PowerShell cmdlet to get the subscription details i.e subscription ID, subscription name, and home tenant that the current account can access.

Syntax:

The syntax of the Get-azurermsubscription is as below

Get-AzureRmSubscription
 [-SubscriptionId <String>]
 [-TenantId <String>]

If we will consider some of the examples of how to use the Get-azurermsubscription PowerShell command.

Example 1: Retrieve all the subscriptions in all tenants

You can use the below Azure PowerShell cmdlet to get all the subscriptions in all tenants

PS C:\WINDOWS\system32> Get-AzureRmSubscription

you can see below, we got the expected output after executing the above command.

Get-azurermsubscription PowerShell cmdlet

Example 2: How to get all subscriptions for a specific tenant

You can use the below Azure PowerShell cmdlet to retrieve all the subscriptions for a specific tenant.

PS C:\WINDOWS\system32> Get-AzureRmSubscription -TenantId "xxxx-xxxx-xxxx-xxxx"

After executing the above command, you can see below, we got the expected output

How to get all subscriptions for a specific tenant

You can also check out a Video tutorial on the Get-AzureRmSubscription PowerShell command.

Final Thoughts

In this Azure PowerShell article, we discussed the syntax and usage of the Get-AzureRmSubscription PowerShell command along with a few examples of how to use this command.