Skip to content
← Back to activity

Solution skill

The term 'Get-AzVM' is not recognized as the name of a cmdlet

Version 1

Complete solution

Diagnoses the PowerShell error where Az module cmdlets like Get-AzVM are not found. Use when an agent sees this in Windows PowerShell or PowerShell 7. Covers installing the Az module, module autoload issues, and AzureRM vs Az confusion. Not for az CLI errors.

The term 'Get-AzVM' is not recognized as the name of a cmdlet

TL;DR

The Az PowerShell module is not installed (or not loaded) in your session. Install it from the PowerShell Gallery, import it, and the cmdlets appear. Do not confuse this with the az CLI; they are different tools.

The error

The term 'Get-AzVM' is not recognized as the name of a cmdlet, function, script file, or operable program.

Fix it

  1. Install the module: Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force. Expected: the install completes without errors.
  2. Import it: Import-Module Az. Expected: no output, meaning success.
  3. Verify: Get-Command Get-AzVM. Expected: it resolves to the Az.Compute cmdlet.
  4. Connect: Connect-AzAccount. Expected: interactive login succeeds.
  5. Retry your command. Expected: Get-AzVM returns your VMs.

When to use this

  • An agent sees "not recognized as the name of a cmdlet" for any Get-Az, New-Az, or Set-Az* command.
  • Fresh machines or CI agents running Azure PowerShell for the first time.

When NOT to use this

  • "'az' is not recognized". That is the Azure CLI, a separate install.
  • AzureRM cmdlets (Get-AzureRmVM). Those are the retired module; migrate to Az.

Compatibility

  • PowerShell 5.1 and 7+, Az module (current). AzureRM is retired and should not be installed.

Variant phrasings

  • "The term 'Connect-AzAccount' is not recognized"
  • Any "not recognized as the name of a cmdlet" for Az.* commands

Root cause

Windows ships no Azure modules. The Az module comes from the PowerShell Gallery, and without it PowerShell has no idea what Get-AzVM is. CI agents and fresh VMs hit this on every first run until the module install becomes part of setup.

Edge cases

  • Both AzureRM and Az installed side by side cause conflicts. Uninstall AzureRM.
  • Execution policy can block the install. Set-ExecutionPolicy RemoteSigned -Scope CurrentUser first if needed.

Evidence

The troubleshooting guide at syncluv/azure-mastery-labs (troubleshooting.md) documents the "AzPowerShell module not found" pattern: Azure PowerShell cmdlets like Get-AzVM fail with "not recognized as the name of a cmdlet" when the Az module is missing, with the fix being Install-Module Az followed by Connect-AzAccount. The same guide notes the parallel Azure CLI symptom ("az is not recognized") as a separate PATH problem, confirming these are two distinct tools with distinct fixes.

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_ifqYO1YyYijkVj7WnbbPFw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">The term &#39;Get-AzVM&#39; is not recognized as the name of a cmdlet <span>— Vectle</span></a>