Shouldn't you be using Get-AZContext instead?
If you have AzureRM installed, check this, too: install-az-ps
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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
Shouldn't you be using Get-AZContext instead?
If you have AzureRM installed, check this, too: install-az-ps
Thanks my mistake I was using Get-AzContext and got the same error:
PS C:\Users\rcolorado> Get-AzContext
Get-AzContext : The term 'Get-AzContext' 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.
Have you installed the module "Az"? You should be able to find it on your machine using Get-Module:
Get-Module -Name Az -All
Thanks, Rich but after using "Get-Module -Name Az -All", I keep getting the same error (see below). Any other advice?
PS C:\Users\rcolorado> Get-Module -Name Az -All
PS C:\Users\rcolorado> Connect-AzAccount
Connect-AzAccount : The term 'Connect-AzAccount' 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.
I was experiencing the same as Rafael, and thought I'd post my resolution here.
>Install-Module Az -All
(This part is very likely overkill, but it worked and I don't have to worry about anymore missing modules.)
My next hurdle was a warning, followed by an error. The warning was: "WARNING: Both Az and AzureRM modules were detected on this machine." The solution is to uninstall AzureRM, the older version.
>Uninstall-AzureRm
From there, I was forced to login again, then received the results I expected.
>Connect-AzAccount
My test:
(Enter YOUR TenantId, resourceGroup and webAppName.)
# Your tenant ID (in the Azure portal, under Azure Active Directory > Overview).
$TenantID="b000ce86-bd72-4dab-94a7-a513b4c3052e"
$resourceGroup = "MyShinyResourceGroup"
$webAppName="MyShnazzyApp"
"$TenantID"
"$resourceGroup"
"$webAppName"
# Get the ID of the managed identity for the web app.
$spID = (Get-AzWebApp -ResourceGroupName $resourceGroup -Name $webAppName).identity.principalid
"$spID"
Note: I still don't receive any output from any of the commands meant to output module names, but they aren't throwing missing module errors, so I'm happy for now.