編集

次の方法で共有


Install Azure PowerShell on Windows

The Az PowerShell module is a rollup module. Installing the Az PowerShell module downloads the generally available modules and makes their cmdlets available for use.

The recommended installation method and PowerShell version for the Az PowerShell module:

  • Install from the PowerShell Gallery
  • Use with PowerShell version 7 or higher

This article explains how to install the Az PowerShell module on Windows from the PowerShell Gallery.

Prerequisites

  • Run the following command from PowerShell to determine your PowerShell version:

    $PSVersionTable.PSVersion
    
  • Determine if you have the AzureRM PowerShell module installed:

    Get-Module -Name AzureRM -ListAvailable
    

    Important

    If you have the AzureRM PowerShell module installed, see Az and AzureRM coexistence before proceeding.

  • Set the PowerShell execution policy to remote signed or less restrictive

    • Check the PowerShell execution policy:

      Get-ExecutionPolicy -List
      
    • Set the PowerShell execution policy to remote signed:

      Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
      

    For more information about execution policies, see about_Execution_Policies.

Installation

Use the Install-Module cmdlet to install the Az PowerShell module:

Install-Module -Name Az -Repository PSGallery -Force

Update the Az PowerShell module

Use Update-Module to update to the latest version of the Az PowerShell module:

Update-Module -Name Az -Force

Updating the Az PowerShell module using Update-Module doesn't remove old versions of the Az PowerShell module from your system.

Uninstallation

To remove the Az PowerShell module, see Uninstall the Azure PowerShell module.

This article explains how to install the Az PowerShell module on Windows using an MSI installer. The MSI installer is provided for environments where the PowerShell Gallery may be blocked by a firewall, or an offline installer is needed.

Important

The MSI installation option can only be used to install the Az PowerShell module for use with Windows PowerShell 5.1.

Prerequisites

  • Run the following command from PowerShell to determine your PowerShell version:

    $PSVersionTable.PSVersion
    
  • Determine if you have the AzureRM PowerShell module installed

    Get-Module -Name AzureRM -ListAvailable
    

    Important

    If you have the AzureRM PowerShell module installed, see Az and AzureRM coexistence before proceeding.

  • Update to Windows PowerShell 5.1

  • Install .NET Framework 4.7.2 or later

  • Set the PowerShell script execution to remote signed or less restrictive

    • Check the PowerShell execution policy:

      Get-ExecutionPolicy -List
      
    • Set the PowerShell execution policy to remote signed:

      Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
      

    For more information about execution policies, see about_Execution_Policies.

Installation and update

The MSI package for Azure PowerShell is available from GitHub:

  1. Visit github.com/Azure/azure-powershell/releases
  2. Locate the most recent Az PowerShell module. They are listed chronologically with no name. For example, 9.5.0
  3. Scroll down to the end of the patch notes and click the arrow next to "Assets" to reveal the MSI options.
  4. Click on the Az-Cmdlets MSI of your choice to start the download

The installer automatically removes older versions of the Az PowerShell module that were installed using an MSI. The MSI package installs modules in "${env:ProgramFiles}\WindowsPowerShell\Modules"

Sign in

To start managing your Azure resources with the Az PowerShell module, launch a PowerShell session and run Connect-AzAccount to sign in to Azure:

Connect-AzAccount

Use your Azure account login credentials to log into the browser window that opens.

You'll need to repeat this step for every new PowerShell session you start. To learn how to persist your Azure sign-in across PowerShell sessions, see Azure PowerShell context objects.

Troubleshooting

For solutions to common installation issues with the Az PowerShell module, see Troubleshoot installation problems with the Az PowerShell module.

Provide feedback

To file an issue about the Az PowerShell module, see: file an issue on GitHub

To provide feedback from within a PowerShell session, use the Send-Feedback cmdlet.

Next Steps

To learn more about managing your Azure resources with the Az PowerShell module, see Get Started with Azure PowerShell.