
Azure PowerShell is Microsoft’s PowerShell module for managing Azure from Windows, available from PowerShell Gallery. It lets admins create resources, check subscriptions, manage virtual machines, inspect storage, automate repeated tasks, and run Azure commands from PowerShell instead of clicking through the portal.
The current module is called Az. Microsoft recommends installing Az from PowerShell Gallery and using it with PowerShell 7 or higher. Windows PowerShell 5.1 still works in some cases, but it is no longer the clean starting point for a new setup.
This guide covers Windows 10 and Windows 11, plus the common admin cases that trip people up: AzureRM leftovers, PowerShell version checks, module updates, MFA sign-in, subscription selection, and blocked PowerShell Gallery access.
Already managing Azure? Use this page to set up a clean Az module install, confirm your login works, and decide when Cloud Shell or Windows Admin Center makes more sense than a local terminal.
What You Need to Know
- For a new Windows setup, install PowerShell 7 or higher first, then install the Az module from PowerShell Gallery.
- The main install command is
Install-Module -Name Az -Repository PSGallery -Force. - Check for AzureRM before installing. Microsoft officially deprecated AzureRM on February 29, 2024.
- Use
Connect-AzAccountto sign in, then pick the right subscription before running commands. - Cloud Shell already includes Azure PowerShell, so it is easier when you cannot install anything locally.
Price
Free module
Developer
Microsoft
Recommended Shell
PowerShell 7+
Install Source
PowerShell Gallery
Best For
Azure admins
Who Should Use Azure PowerShell?
Azure PowerShell is for admins, developers, and IT teams who want repeatable control over Azure resources. It is not required for every Azure user, but it becomes useful once portal clicks turn into repeated work.
- Use it if: you manage Azure subscriptions, virtual machines, storage accounts, networks, resource groups, automation scripts, or admin reports from Windows.
- Skip it if: you only check Azure billing, view dashboards, or make rare one-off changes in the Azure portal.
- Be careful if: your tenant uses strict Conditional Access, multiple tenants, old AzureRM scripts, or locked-down machines that cannot reach PowerShell Gallery.
Azure PowerShell vs Azure CLI vs Cloud Shell vs Windows Admin Center
Azure has several admin tools, and they overlap. The right choice depends on how you work, which shell you already know, and whether you need local automation or quick browser access.
| Tool | Use it for | Where it fits |
|---|---|---|
| Azure PowerShell | PowerShell scripts, object output, Windows admin workflows, repeatable Azure tasks. | Best fit when your team already uses PowerShell or needs scriptable Azure admin work. |
| Azure CLI | Cross-platform az commands, Bash-friendly scripts, JSON output, DevOps tasks. | Good when you work across Bash, Cmd, PowerShell, Linux, macOS, and CI pipelines. |
| Azure Cloud Shell | Browser-based PowerShell or Bash with Azure tools already installed. | Use it when you cannot install local modules or need a quick admin session from the portal. |
| Windows Admin Center | Browser-based management for Windows Server, clusters, Hyper-V, services, storage, and related tasks. | Use Windows Admin Center for local server management, then use Azure PowerShell for Azure resource automation. |
Check Your PowerShell Version First
Start in PowerShell 7 or higher when possible. Microsoft says PowerShell 7 or higher is the recommended shell for the Az module, and PowerShell 7.2 or higher is recommended in the Az overview docs.
Run this command
$PSVersionTable.PSVersion
If the major version starts with 7, you are in the right place for a new Az install. If it starts with 5, you are probably in Windows PowerShell 5.1. That can still work, but it is not the clean path for a new admin workstation.
Check your PowerShell version before installing the Az module.
Check for AzureRM Before Installing
AzureRM is the old Azure PowerShell module. Microsoft officially deprecated AzureRM on February 29, 2024, and recommends moving to the Az module.
Check for AzureRM before you install Az, especially on older admin PCs, Visual Studio workstations, jump boxes, and servers that have years of scripts on them.
Run this command
Get-Module -Name AzureRM -ListAvailable
Important AzureRM caveat
Microsoft does not support having AzureRM and Az installed together in Windows PowerShell 5.1. If you must keep AzureRM for old scripts, keep it in Windows PowerShell 5.1 and install Az in PowerShell 7 or higher.
Check for AzureRM before installing Azure PowerShell in the same environment.
How to Install the Az Module on Windows
Open PowerShell 7 as your normal user first. Use an elevated session only if you are installing for all users or your organization requires it.
- Step 1. Open PowerShell 7 from Start, Windows Terminal, or your admin workstation shortcut.
- Step 2. Run
$PSVersionTable.PSVersionto confirm you are in PowerShell 7 or higher. - Step 3. Run
Get-Module -Name AzureRM -ListAvailableand stop if old AzureRM modules appear in the wrong shell. - Step 4. Install Az from PowerShell Gallery with the command below.
- Step 5. If PowerShell asks whether to trust PowerShell Gallery, approve it only if the repository is PSGallery and the package name is Az from Microsoft.
- Step 6. Confirm the install with
Get-InstalledModule -Name Az.
Install command recommended by Microsoft
Install-Module -Name Az -Repository PSGallery -Force
Microsoft recommends installing the Az module from PowerShell Gallery.
Confirm the Installed Az Version
The current Az version changes often, so do not build scripts around a hardcoded blog number. Check your local install and compare it with PowerShell Gallery or the Azure PowerShell GitHub releases page when you need to verify a current release.
Check the installed module
Get-InstalledModule -Name Az
Use Get-InstalledModule to confirm which Az version is installed.
Windows PowerShell 5.1 and MSI Caveats
Microsoft still documents an MSI installer for Azure PowerShell, but it is not the normal path for a fresh Windows 10 or Windows 11 setup. The MSI is mainly for environments where PowerShell Gallery is blocked by a firewall or where an offline installer is required.
Plain recommendation
Use PowerShell Gallery plus PowerShell 7 for new installs. Use MSI only when your environment blocks PowerShell Gallery or requires an offline package for Windows PowerShell 5.1.
If you install through MSI, uninstall through Windows Settings or Control Panel. If you install through PowerShell Gallery, remove modules through PowerShell. Mixing methods makes cleanup harder.
How to Update Azure PowerShell
Use Update-Module when Az was installed from PowerShell Gallery. Microsoft notes that updating Az does not remove old versions from your system, so older module folders may remain after an update.
Update Az
Update-Module -Name Az -Force
For a heavily managed admin workstation, close all PowerShell sessions before updating. If a module is already loaded in another session, the update can fail or leave more than one version installed.
Sign In With Connect-AzAccount
After installing Az, sign in with Connect-AzAccount. Microsoft documents this as the interactive sign-in command for Azure PowerShell.
Sign in
Connect-AzAccount
On a normal Windows desktop, Azure PowerShell opens a browser sign-in window. If a browser cannot open, use device code authentication.
Use device code sign-in
Connect-AzAccount -UseDeviceAuthentication
MFA and Conditional Access note
If your account uses MFA, use interactive sign-in or service principal authentication for automation. Password-only sign-in is not the right path for MFA-protected admin accounts.
Connect-AzAccount opens the Azure sign-in flow for your account.
Choose the Right Azure Subscription
Many Azure accounts can see more than one subscription. Always check your current context before creating or changing resources.
List subscriptions
Get-AzSubscription
Set the active subscription
Set-AzContext -Subscription "<subscription name or ID>"
Set your active subscription before running commands that create or change Azure resources.
Useful Starter Commands
Once you are signed in and your subscription is set, start with read-only commands. They help you learn the shape of Azure PowerShell without changing anything.
| Task | Command |
|---|---|
| Show current account context | Get-AzContext |
| List subscriptions | Get-AzSubscription |
| List resource groups | Get-AzResourceGroup |
| List virtual machines | Get-AzVM |
| List Azure regions | Get-AzLocation |
| Sign out | Disconnect-AzAccount |
When Cloud Shell Is Easier
Azure Cloud Shell is a browser-based shell inside Azure. Microsoft says Azure PowerShell is already installed there, so you can start running Az commands without setting up local modules.
- Use Cloud Shell if: you are on a temporary PC, cannot install modules, need a quick portal-based session, or want Microsoft to maintain the shell environment.
- Install locally if: you need local files, scheduled scripts, custom modules, source control, your own terminal profile, or repeatable admin workstation setup.
- Remember: Cloud Shell is convenient, but it may not reflect every new Azure PowerShell release immediately.
Cloud Shell is useful when you need Azure PowerShell without installing anything locally.
Common Install and Login Issues
Install-Module is not recognized
You may be in a limited shell or missing the expected PowerShellGet commands. Open PowerShell 7 and try again. On managed PCs, ask whether PowerShell Gallery is blocked.
PowerShell Gallery is blocked
Use your organization’s approved repository path, a proxy-approved PowerShell Gallery route, or the MSI fallback for Windows PowerShell 5.1 if offline install is required.
Connect-AzAccount opens the wrong account or tenant
Use the Tenant parameter during sign-in, then confirm the active subscription with Get-AzContext. This matters when you manage customer tenants or several work accounts.
The browser sign-in window does not appear
Run Connect-AzAccount -UseDeviceAuthentication. This is usually better for remote desktops, servers, locked-down browsers, and systems without normal browser access.
Az commands are found but cannot load
Check for AzureRM and old Az versions in the same module path. Microsoft documents conflicts when AzureRM and Az exist together in unsupported Windows PowerShell 5.1 setups.
The install is slow
The Az rollup module installs many service modules. That is normal. Advanced admins can later install only the service-specific modules they need, but beginners should start with the full Az module.
Azure PowerShell Video Guide
Watch this Azure PowerShell video to see the Az module setup flow, sign-in process, and basic Azure admin commands in action.
Tips for Getting Started
Start with read-only commands
Use Get-AzContext, Get-AzSubscription, and Get-AzResourceGroup first. Learn what your account can see before creating anything.
Set the subscription every time
Do not assume your current subscription is correct. Run Get-AzContext before commands that change Azure resources.
Keep old scripts separate
If a script still uses AzureRM cmdlets, do not run it inside your clean Az PowerShell 7 setup until it has been reviewed and migrated.
Use Cloud Shell for quick checks
If a local module install fails, test the same command in Cloud Shell. That helps separate Azure permission problems from local setup problems.
Save tested commands in a script file
Once a command works, save it with comments and parameters. This turns one-off terminal work into repeatable admin work.
Screenshots
These screenshots show the current Windows setup flow for Azure PowerShell: version check, AzureRM check, Az install, installed version check, sign-in, subscription selection, and Cloud Shell as the browser-based fallback.
- Azure cloud shell powershell az module from Azure PowerShell on Windows: How to install and use it
- Azure powershell azurerm check windows from Azure PowerShell on Windows: How to install and use it
- Azure powershell check installed version windows from Azure PowerShell on Windows: How to install and use it
- Azure powershell connect azaccount windows from Azure PowerShell on Windows: How to install and use it
- Azure powershell set azcontext subscription windows from Azure PowerShell on Windows: How to install and use it
- Azure powershell install az module windows from Azure PowerShell on Windows: How to install and use it
- Azure powershell version check windows from Azure PowerShell on Windows: How to install and use it
Frequently Asked Questions
Is Azure PowerShell free?
Yes. Azure PowerShell is free to install from PowerShell Gallery. You still pay for the Azure resources you create, run, store, or manage in your Azure subscription.
Should I install Azure PowerShell in PowerShell 7 or Windows PowerShell 5.1?
Use PowerShell 7 or higher for a new setup. Microsoft recommends PowerShell 7 or higher for the Az module. Windows PowerShell 5.1 still works, but it is mainly useful for older scripts or locked-down environments.
What is the difference between Azure PowerShell and Azure CLI?
Azure PowerShell is a PowerShell module named Az, so it returns PowerShell objects and fits Windows admin scripts. Azure CLI uses az commands and works well in Bash, Cmd, PowerShell, and cross-platform scripts.
Can AzureRM and Az be installed together?
Microsoft does not support having AzureRM and Az installed in Windows PowerShell 5.1 at the same time. If you must keep AzureRM for old scripts, keep it in Windows PowerShell 5.1 and install Az in PowerShell 7 or higher.
Why does Connect-AzAccount ask me to pick a subscription?
If your account has access to more than one tenant or subscription, Azure PowerShell needs a current context. Pick one during sign-in or run Set-AzContext after login.
What should I do if Connect-AzAccount does not open a browser?
Use Connect-AzAccount -UseDeviceAuthentication. It gives you a code to enter at microsoft.com/devicelogin, which is useful on servers, remote sessions, or browser-restricted systems.
When should I use Azure Cloud Shell instead of installing Azure PowerShell?
Use Cloud Shell when you need a quick Azure PowerShell session, cannot install modules locally, or are using a temporary machine. Install locally when you need repeatable scripts, local files, scheduled jobs, or your own admin workstation setup.
Support and Community
For official release details, use the Azure PowerShell GitHub releases and PowerShell Gallery. For install and login problems, Microsoft Learn has a dedicated troubleshooting page. For peer discussion, r/AZURE and r/PowerShell are useful when you need real admin context.
- Azure PowerShell releases on GitHub – current Az releases, release notes, and package links
- Microsoft Learn troubleshooting guide – official fixes for Az module install and login issues
- r/AZURE on Reddit – peer discussion from Azure admins and cloud users
- r/PowerShell on Reddit – PowerShell-specific install, module, and scripting discussion
More Windows software guides: Azure Data Studio for Windows · What Is Microsoft Azure? · Beginner’s Guide to Azure Monitor · Windows Terminal App
Discover more from Windows Mode
Subscribe to get the latest posts sent to your email.













