Connect-AzAccount : The term 'Connect-AzAccount' is not recognized as the name of a cmdlet

If you are facing this issue, please read below for the resolution.

Issue Occurence

Above issue occured, when I was connecting to Azure using VsCode through its terminal. I actually wanted to run my .ps1 script (powershell script) in Azure Cloud shell using VsCode.

I opened the terminal and entered the command - 'Connect-AzAccount'.

Error received:

Connect-AzAccount : The term 'Connect-AzAccount' is not recognized as the name of a cmdlet

Issue Resolution

Reason:
I came to know Az-Module were not installed on my system. (Basically, The Az PowerShell module is a set of cmdlets for managing Azure resources directly from PowerShell/ Vscode).

Solution:
Steps To install AzModule on your system.

  • Step 1 :
    Open Powershell in your system. Run it as an administrator.

  • Step 2 :
    Run the following command:
    Install-Module Az -Force -AllowClobber

  • Step 3 :
    There might be prompt related to nuget provider.
    Press Y and then Enter key.
  • Step 4 :
    Import-Module Az

Your command - Connect-AzAccount should work now.

Feel free to provide any feedback!