Install and Use Azure PowerShell on Windows

Share

Azure PowerShell is a powerful tool that helps you manage and automate tasks in Azure directly from the command line. Whether you’re working on cloud applications, managing virtual machines, or automating routine tasks, Azure PowerShell offers a flexible way to interact with Azure resources from your Windows PC.

In this guide, I’ll show you how to install Azure PowerShell on Windows 11 and 10 and harness its capabilities to streamline your Azure cloud management.

Azure powershell logo e1584806543739

Why Install Azure PowerShell?

Managing your Azure environment can be complex, especially when you’re dealing with multiple services. Azure PowerShell helps simplify that process by allowing you to control Azure resources directly from your terminal. This approach can save time, reduce repetitive tasks, and make your cloud management more efficient.

Requirements for Running Azure PowerShell

Before installing Azure PowerShell on your Windows 11 or Windows 10 machine, make sure you meet the following requirements:

  • PowerShell Version: Azure PowerShell requires PowerShell 5.1 or higher, or PowerShell 7.x (recommended). If you’re running Windows 10 or 11, you likely have PowerShell 5.1 pre-installed.
  • .NET Framework: If you’re using Windows PowerShell 5.1, make sure you have .NET Framework 4.7.2 or later installed.
  • PowerShell Core: Azure PowerShell also works with PowerShell 7.x, which is cross-platform and provides improved performance and features.

To check your PowerShell version, run the following command:

$PSVersionTable.PSVersion

How to Install Azure PowerShell

Step 1: Update PowerShellGet (if necessary)

Azure PowerShell modules are installed from the PowerShell Gallery, and you need the latest version of PowerShellGet to ensure smooth installation. To update PowerShellGet, run:

Update-Module PowerShellGet -Force

Step 2: Install the Azure PowerShell Module

To install Azure PowerShell, run the following command from your PowerShell session:

Install-Module -Name Az -AllowClobber -Scope CurrentUser

Note: By default, the PowerShell Gallery is not a trusted repository. When prompted, type Y or A to trust the repository and continue with the installation.

The Az module is a comprehensive collection of Azure PowerShell cmdlets that enables you to manage all Azure resources, from virtual machines to databases, and more.

Step 3: Verify Installation

After installing the module, verify the installation by running:

Get-Module -Name Az -ListAvailable

If the installation was successful, you should see details of the installed Az module.

Powershell image

Offline Installation of Azure PowerShell

If you need to install Azure PowerShell on a computer without internet access, you can download the modules from another machine and then copy them over. The easiest way to do this is by downloading Azure PowerShell from GitHub.

Connecting to Your Azure Account

Once Azure PowerShell is installed, you need to connect to your Azure account to start managing resources. Run the following command to log in:

Connect-AzAccount

This command will prompt you to enter your Azure credentials and establish a connection to your Azure subscription.

Key Features of Azure PowerShell

Azure PowerShell provides a variety of cmdlets to manage your Azure resources. Here are some common tasks you can perform with Azure PowerShell:

  • Create and manage virtual machines
  • Manage Azure storage accounts
  • Automate routine tasks with scripts
  • Deploy and manage Azure Kubernetes Service (AKS)
  • Monitor and troubleshoot Azure resources

For example, to create a new resource group, you can run:

New-AzResourceGroup -Name "MyResourceGroup" -Location "EastUS"

Admin powershell

Migrating from Windows PowerShell 5.1 to PowerShell 7

While Azure PowerShell works with PowerShell 5.1, it is recommended to migrate to PowerShell 7 for better performance, cross-platform support, and newer features. PowerShell 7 includes backward compatibility for most Windows PowerShell modules, and offers enhanced security features and modern cmdlets.

To install PowerShell 7, visit the official installation guide.

For more Azure-related articles, check out:


Discover more from Windows Mode

Subscribe to get the latest posts sent to your email.