Install the Azure PowerShell module

12/13/2018

읽는 데 3분

참가자

이 문서의 내용

This article tells you how to install the Azure PowerShell modules using PowerShellGet. These instructions
work on Windows, macOS, and Linux platforms. For the Az module, currently no other installation methods
are supported.

Requirements

Azure PowerShell works with PowerShell 5.1 or higher on Windows, or PowerShell Core 6.x and later on
all platforms. If you aren't sure if you have PowerShell, or are on macOS or Linux,
install the latest version of PowerShell Core.

To check your PowerShell version, run the command:

$PSVersionTable.PSVersion

To run Azure PowerShell in PowerShell 5.1 on Windows:

Update to Windows PowerShell 5.1 if needed. If you're on Windows 10, you already
have PowerShell 5.1 installed.

There are no additional requirements for Azure PowerShell when using PowerShell Core.

Install the Azure PowerShell module

Important

You can have both the AzureRM and Az modules installed at the same time. If you have both modules installed, don't enable aliases.
Enabling aliases will cause conflicts between AzureRM cmdlets and Az command aliases, and could cause unexpected behavior.
It's recommended that before installing the Az module, you uninstall AzureRM. You can always uninstall AzureRM or enable aliases
at any time. To learn about the AzureRM command aliases, see Migrate from AzureRM to Az.
For uninstall instructions, see Uninstall the AzureRM module.

To install modules at a global scope, you need elevated privileges to install modules from the PowerShell Gallery. To install Azure PowerShell,
run the following command in an elevated session ("Run as Administrator" on Windows, or with superuser privileges on macOS or Linux):

Install-Module -Name Az -AllowClobber

If you don't have access to administrator privileges, you can install for the current user by adding the -Scope argument.

Install-Module -Name Az -AllowClobber -Scope CurrentUser

By default, the PowerShell gallery isn't configured as a trusted repository for PowerShellGet. The
first time you use the PSGallery you see the following prompt:

Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change
its InstallationPolicy value by running the Set-PSRepository cmdlet.
Are you sure you want to install the modules from 'PSGallery'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"):

Answer Yes or Yes to All to continue with the installation.

The Az module is a rollup module for the Azure PowerShell cmdlets. Installing it downloads all of
the available Azure Resource Manager modules, and makes their cmdlets available for use.

Sign in

To start working with Azure PowerShell, sign in with your Azure credentials.

# Connect to Azure with a browser sign in token
Connect-AzAccount

Note

If you've disabled module autoloading, you need to manually import the module with Import-Module Az. Because of
the way the module is structured, this can take a few seconds.

Update the Azure PowerShell module

Because of how the Az module is package, the Update-Module
command won't update your installation correctly. Az is technically a meta-module, encompassing all of
the submodules that contain cmdlets to interact with Azure services. That means that to update the
Azure PowerShell module, you will need to reinstall, rather than just update. This is done in the
same way as installing, but you may need to add the -Force argument:

Install-Module -Name Az -AllowClobber -Force

Although this can overwrite installed modules, you may still have older versions left on your system.
To learn how to remove old versions of Azure PowerShell from your system, see Uninstall the Azure PowerShell module.

Use multiple versions of Azure PowerShell

It's possible to install more than one version of Azure PowerShell. To check if you have multiple versions of Azure PowerShell installed, use the following
command: