The term ‘get-azuresubscription’ is not recognized

In this PowerShell Azure tutorial, we will discuss how to fix the error. The term ‘get-azuresubscription’ is not recognized when retrieving the Azure Subscription details using the Azure PowerShell cmdlet.

Recently, While working with Azure PowerShell. I was trying to retrieve the Azure Subscription details using the Azure PowerShell cmdlet, and I got this error. I was using the below PowerShell cmdlet

PS C:\WINDOWS\system32> get-azuresubscription

After executing the above PowerShell cmdlet, I got this error. You can see it below

get-azsubscription not recognized

The exact error message was below

get-azuresubscription : The term ‘get-azuresubscription’ is not recognized as the
name of a cmdlet, function, script file, or operable program. Check the spelling of
the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

  • get-azuresubscription
  • ~~~~~
    • CategoryInfo : ObjectNotFound: (get-azuresubscription:String) [], Comm
      andNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

Solution

To fix this error, I followed the below steps.

  1. Open the PowerShell ISE as Run as Administrator mode
the term 'get-azsubscription' is not recognized as the name of a cmdlet

2. Install the PowerShell module Azure using the below PowerShell cmdlet. Then click on the Yes to All button to confirm the installation of the Azure Module.

PS C:\WINDOWS\system32> Install-Module -Name Azure -AllowClobber -Scope CurrentUser
get-azsubscription' is not recognized as the name of a cmdlet

3. Now, you can see below that the installation has been started.

get-azsubscription command not found

4. Once the Azure module is installed successfully, You can run the below PowerShell cmdlet. First, it will ask you to log in with your Azure Credentials, and then it will provide you with your Azure Subscription details.

Add-AzureAccount
get-azuresubscription
get-azsubscription not recognized

However, the old Azure Service Management (ASM) model, the get-azuresubscription, is used to retrieve the subscription details. The new model is the Azure Resource Manager (ARM), and you can use the PowerShell cmdlet Get-AzureRmSubscription to retrieve your Azure Subscription details.

PS C:\WINDOWS\system32> Get-AzureRmSubscription
get-azuresubscription

You may also like following the below Articles

Azure Virtual Machine

DOWNLOAD FREE AZURE VIRTUAL MACHINE PDF

Download our free 25+ page Azure Virtual Machine guide and master cloud deployment today!