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 for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

6 answers

Sort by: Most helpful
  1. Sedat SALMAN 14,180 Reputation points MVP
    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

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.