PowerShell Azure commands not recognized in PowerShell 7

Rafael Colorado 1 Reputation point
2021-11-25T15:48:35.247+00:00

I downloaded PowerShell 7(x64) to my LapTop using Windows11 and when I use basic Azure commands like Get-Account (Get-AzAccount) or Get-Subscription (Get-AzSubscription)and I get this:
"Get-AzureContext or Get-AzContext: The term 'Get-AzureContext' is not recognized as a name of a cmdlet, function, script file, or executable program."
What am I doing wrong? thanks

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,398 questions
0 comments No comments
{count} votes

6 answers

Sort by: Most helpful
  1. Sedat SALMAN 13,180 Reputation points
    2023-03-24T20:21:20.46+00:00

    Open PowerShell 7 as an administrator by right-clicking on it and selecting "Run as administrator".

    Install-Module -Name Az -AllowClobber -Scope CurrentUser
    Import-Module Az
    
    

    Remember that the correct cmdlets to use with the Az module are Get-AzAccount and Get-AzSubscription. The cmdlets you mentioned (Get-AzureContext, Get-Account, and Get-Subscription) are not valid cmdlets in the Az module.

    If you still encounter issues, make sure you have the latest version of the Az module installed by running:

    
    Update-Module -Name Az
    
    0 comments No comments