- Install Azure Active Directory PowerShell for Graph
- Azure Active Directory PowerShell for Graph release version history
- Installing the Azure AD Module
- About the PowerShell Gallery
- Supported Operating Systems
- Updating the Azure AD Module
- Connect to Azure AD
- More about Windows PowerShell
- Install Azure PowerShell on Windows with PowerShellGet
- Requirements
- Install the Azure PowerShell module
- Sign in
- Update the Azure PowerShell module
- Use multiple versions of Azure PowerShell
- Provide feedback
- Next Steps
- Установите Azure PowerShell Install Azure PowerShell
- Требования Requirements
- Установка модуля Azure PowerShell Install the Azure PowerShell module
- Установка в автономном режиме Install offline
- Устранение неполадок Troubleshooting
- Прокси-сервер блокирует подключения Proxy blocks connection
- Вход Sign in
- Обновление модуля Azure PowerShell Update the Azure PowerShell module
- Использование нескольких версий Azure PowerShell Use multiple versions of Azure PowerShell
- Отзывы Provide feedback
- Next Steps Next Steps
Install Azure Active Directory PowerShell for Graph
You can use the Azure Active Directory PowerShell Module Version for Graph for Azure AD administrative tasks such as user management, domain management and for configuring single sign-on. The cmdlets listed here are different than the MSOL cmdlets which are part of Azure Active Directory Version 1.0.
The Azure AD PowerShell for Graph module has two versions: a Public preview version and a General Availability version. It is not recommended to use the Public Preview version for production scenarios. The Azure AD PowerShell for Graph preview module can be downloaded from the PowerShell Gallery at the AzureADPreview page. The Azure AD PowerShell for Graph General Availability module can be downloaded from the PowerShell Gallery at the AzureAD page.
Azure Active Directory PowerShell for Graph release version history
The release history for the Azure AD module and the Azure AD Preview module is here: https://docs.microsoft.com/powershell/azure/active-directory/ad-pshell-v2-version-history
Installing the Azure AD Module
The Azure AD Module is supported on the following Windows operating systems with the default version of Microsoft .NET Framework and Windows PowerShell: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012 R2, Windows Server 2012, or Windows Server 2008 R2.
If your computer has all the prerequisites for the installation, to install the General Availability version of the module on your computer you can run
To install the public preview release, use
Note that you cannot install both the preview version and the GA version on the same computer at the same time.
About the PowerShell Gallery
The Azure AD module is distributed using the PowerShell gallery. Installing items from the Gallery requires the latest version of the PowerShellGet module, which is available in Windows 10, in Windows Management Framework (WMF) 5.0, or in the MSI-based installer (for PowerShell 3 and 4).
With the latest PowerShellGet module, you can:
Check out the Getting Started page for more information on how to use PowerShellGet commands with the Gallery. You can also run Update-Help -Module PowerShellGet to install local help for these commands.
Supported Operating Systems
The PowerShellGet module requires PowerShell 3.0 or newer.
Therefore, PowerShellGet requires one of the following operating systems:
- Windows 10
- Windows 8.1 Pro
- Windows 8.1 Enterprise
- Windows 7 SP1
- Windows Server 2016 TP5
- Windows Server 2012 R2
- Windows Server 2008 R2 SP1
PowerShellGet alsoВ requires .NET Framework 4.5 or above. You can install .NET Framework 4.5 or above from here.
Updating the Azure AD Module
You can check the version of the module you have installed on your computer by running this command:
To update the version of the Azure AD PowerShell module on your computer, re-run the Install-Module cmdlet:
This command checks the PowerShell gallery to see if a newer version is available and installs it on your computer if the version on the PowerShell Gallery is newer than the one installed on your computer.
Connect to Azure AD
Before you can run any of the cmdlets discussed in this article, you must first connect to your online service. To do so, run the cmdlet Connect-AzureAD at the Windows PowerShell command prompt. You will then be prompted for your credentials. If you want, you can supply your credentials in advance, for example:
The first command prompts for credentials and stores them as $AzureAdCred. The next command uses those credentials as $azureadcred to connect to the service.
To connect to a specific environment of Azure Active Directory, use the AzureEnvironment parameter, as follows:
This example connects your PowerShell session to the German AzureAD environment. See Connect-AzureAD for more information.
More about Windows PowerShell
Windows PowerShell is a task-based command-line shell and scripting language designed for system administration. Unlike most shells, which accept and return text, Windows PowerShell is built on top of the .NET Framework, and accepts and returns .NET Framework objects.
Windows PowerShell introduces the concept of a cmdlet (pronounced «command-let»), a simple, single-function command-line tool built into the shell. Cmdlets have the following naming convention: a verb and noun separated by a dash (-), such as Get-Help, Get-Process, and Start-Service. Windows PowerShell includes more than one hundred basic core cmdlets.
For more information about, or for the syntax of, any of the cmdlets, use the Get-Help command, where is the name of the cmdlet that you want to research. For more detailed information, you can run any of the following commands:
- Get-Help -Detailed
- Get-Help -Examples
- Get-Help -Full
For more information about Windows PowerShell, see the Getting Started with Windows PowerShell.
Install Azure PowerShell on Windows with PowerShellGet
Because Az PowerShell modules now have all the capabilities of AzureRM PowerShell modules and more, we’ll retire AzureRM PowerShell modules on 29 February 2024.
To avoid service interruptions, update your scripts that use AzureRM PowerShell modules to use Az PowerShell modules by 29 February 2024. To automatically update your scripts, follow the quickstart guide.
This article explains the steps to install the Azure PowerShell modules for PowerShell 5.x for Windows using PowerShellGet. PowerShellGet and module management is the preferred way to install Azure PowerShell but if you would rather install with the Web Platform Installer or MSI package, see Other installation methods.
The Azure classic deployment model is not supported by this version of Azure PowerShell. For support for classic deployments, follow the instructions in Install the Azure PowerShell Service Management module.
The AzureRM module is not supported for macOS or Linux. To use Azure PowerShell cmdlets on these platforms, Install the Az module.
Requirements
Starting with Azure PowerShell version 6.0, Azure PowerShell requires PowerShell version 5.0. To check the version of PowerShell running on your machine, run the following command:
The module described in this document, AzureRM, uses .NET Framework. This makes it incompatible with PowerShell 6.0, which uses .NET Core. If you are using PowerShell 6.0, follow the installation instructions for macOS and Linux.
Install the Azure PowerShell module
You need elevated privileges to install modules from the PowerShell Gallery. To install Azure PowerShell, run the following command in an elevated session:
If you have a version older than 2.8.5.201 of NuGet, you are prompted to download and install the latest version of NuGet.
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:
Answer Yes or Yes to All to continue with the installation.
The AzureRM 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.
If you’ve disabled module autoloading, you need to manually import the module with Import-Module AzureRM . Because of the way the module is structured, this can take a few seconds.
You’ll need to repeat these steps for every new PowerShell session you start. To learn how to persist your Azure sign-in across PowerShell sessions, see Persist user credentials across PowerShell sessions.
Update the Azure PowerShell module
You can update your Azure PowerShell installation by running Update-Module. This command does not uninstall earlier versions.
If you want to remove older 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:
To remove a version of Azure PowerShell, see Uninstall the Azure PowerShell module.
You might need more than one version if you work with on-premises Azure Stack resources, run an older version of Windows, or use the Azure classic deployment model. To install an older version, provide the -RequiredVersion argument when installing.
When loading the Azure PowerShell module the latest version is loaded by default. To load a different version, provide the -RequiredVersion argument.
Provide feedback
If you find a bug when using Azure Powershell, file an issue on GitHub. To provide feedback from the command line, use the Send-Feedback cmdlet.
Next Steps
To get started using Azure PowerShell, see Get Started with Azure PowerShell to learn more about the module and its features.
Установите Azure PowerShell Install Azure PowerShell
В этой статье показано, как установить модули Azure PowerShell с помощью PowerShellGet. This article explains how to install the Azure PowerShell modules using PowerShellGet. Эти инструкции применимы для платформ Windows, macOS и Linux. These instructions work on Windows, macOS, and Linux platforms.
Среда Azure PowerShell также доступна в Azure Cloud Shell. Azure PowerShell is also available in Azure Cloud Shell.
Требования Requirements
Для работы в Azure PowerShell на всех платформах мы рекомендуем использовать PowerShell версии 7.x и выше. PowerShell 7.x and later is the recommended version of PowerShell for use with Azure PowerShell on all platforms.
Azure PowerShell работает с PowerShell версии 6.2.4 и выше на любой платформе. Azure PowerShell works with PowerShell 6.2.4 and later on all platforms. Кроме того, в Windows также поддерживается использование в PowerShell 5.1. It is also supported with PowerShell 5.1 on Windows. Установите последнюю версию PowerShell для своей операционной системы. Install the latest version of PowerShell available for your operating system. Дополнительных требований для использования Azure PowerShell в PowerShell версии 6.2.4 и выше нет. Azure PowerShell has no additional requirements when run on PowerShell 6.2.4 and later.
Чтобы узнать вашу версию PowerShell, выполните приведенную ниже команду: To check your PowerShell version, run the command:
Чтобы использовать Azure PowerShell в PowerShell 5.1 в Windows, сделайте следующее: To use Azure PowerShell in PowerShell 5.1 on Windows:
- Выполните обновление до Windows PowerShell 5.1. Update to Windows PowerShell 5.1. Если вы используете Windows 10 версии 1607 и выше, у вас уже есть PowerShell версии 5.1. If you’re on Windows 10 version 1607 or higher, you already have PowerShell 5.1 installed.
- Установите платформу .NET Framework версии 4.7.2 или более поздней. Install .NET Framework 4.7.2 or later.
- Убедитесь, что у вас установлена последняя версия PowerShellGet. Make sure you have the latest version of PowerShellGet. Выполните Install-Module -Name PowerShellGet -Force . Run Install-Module -Name PowerShellGet -Force .
Установка модуля Azure PowerShell Install the Azure PowerShell module
В Windows нельзя одновременно установить модули AzureRM и Az для PowerShell 5.1 We do not support having both the AzureRM and Az modules installed for PowerShell 5.1 on Windows at the same time. Если в системе нужно оставить модуль AzureRM, установите модуль Az для PowerShell Core версии 6.x или более поздней. If you need to keep AzureRM available on your system, install the Az module for PowerShell Core 6.x or later.
Использование командлетов PowerShellGet — предпочтительный метод установки. Using the PowerShellGet cmdlets is the preferred installation method. Установите модуль Az только для текущего пользователя. Install the Az module for the current user only. Это рекомендуемая область установки. This is the recommended installation scope. Этот метод работает одинаково на платформах Windows, macOS и Linux. This method works the same on Windows, macOS, and Linux platforms. Выполните следующую команду из сеанса PowerShell: Run the following command from a PowerShell session:
По умолчанию коллекция PowerShell не используется как доверенный репозиторий для PowerShellGet. By default, the PowerShell gallery isn’t configured as a trusted repository for PowerShellGet. При первом использовании PSGallery отображается следующее сообщение: The first time you use the PSGallery you see the following prompt:
Ответьте Yes или Yes to All , чтобы продолжить установку. Answer Yes or Yes to All to continue with the installation.
Для установки модуля для всех пользователей системы требуются повышенные права. Installing the module for all users on a system requires elevated privileges. Запустите сеанс PowerShell от имени администратора в Windows либо выполните команду sudo в macOS или Linux: Start the PowerShell session using Run as administrator in Windows or use the sudo command on macOS or Linux:
Модуль Az — это общий модуль для командлетов Azure PowerShell. The Az module is a rollup module for the Azure PowerShell cmdlets. Во время его установки скачиваются все общедоступные модули Az PowerShell, а после этого становятся доступными все соответствующие командлеты. Installing it downloads all of the generally available Az PowerShell modules, and makes their cmdlets available for use.
Установка в автономном режиме Install offline
В некоторых средах невозможно подключиться к коллекции PowerShell. In some environments, it’s not possible to connect to the PowerShell Gallery. В таких случаях все же можно выполнить установку в автономном режиме, используя один из следующих методов: In those situations, you can still install offline using one of these methods:
Скачайте модули в другое сетевое расположение и используйте его в качестве источника установки. Download the modules to another location in your network and use that as an installation source. Так вы сможете кэшировать модули PowerShell на отдельном сервере или в общей папке, чтобы развернуть их с помощью PowerShellGet в любой системе в автономном режиме. This method allows you to cache PowerShell modules on a single server or file share to be deployed with PowerShellGet to any disconnected systems. Сведения о том, как настроить локальный репозиторий и установить его в системах без подключения к сети, см. в статье Работа с локальными хранилищами PowerShellGet. Learn how to set up a local repository and install on disconnected systems with Working with local PowerShellGet repositories.
Скачайте MSI для Azure PowerShell на компьютер, подключенный к сети, а затем скопируйте установщик в системы без доступа к коллекции PowerShell. Download the Azure PowerShell MSI to a machine connected to the network, and then copy the installer to systems without access to PowerShell Gallery. Помните, что установщик MSI работает только с PowerShell 5.1 в Windows. Keep in mind that the MSI installer only works for PowerShell 5.1 on Windows.
С помощью команды Save-Module сохраните модуль в общую папку или в другом источнике и вручную скопируйте на другие компьютеры. Save the module with Save-Module to a file share, or save it to another source and manually copy it to other machines:
Устранение неполадок Troubleshooting
Ниже описаны некоторые распространенные проблемы с установкой модуля Azure PowerShell. Here are some common problems seen when installing the Azure PowerShell module. Если у вас возникла проблема, не описанная здесь, сообщите о ней на сайте GitHub. If you experience a problem not listed here, file an issue on GitHub.
Прокси-сервер блокирует подключения Proxy blocks connection
Если командлет Install-Module возвращает ошибки о том, что коллекция PowerShell недоступна, возможно, ваша система находится за прокси-сервером. If you get errors from Install-Module that indicate the PowerShell Gallery is unreachable, you may be behind a proxy. Разные операционные системы и сетевые среды имеют разные требования для настройки прокси-сервера на уровне системы. Different operating systems and network environment have different requirements for configuring a system-wide proxy. Обратитесь к системному администратору, чтобы узнать о параметрах своего прокси-сервера и о том, как настроить их для своей среды. Contact your system administrator for your proxy settings and how to configure them for your environment.
Возможно, среду PowerShell нельзя настроить для автоматического использования этого прокси-сервера. PowerShell itself may not be configured to use this proxy automatically. В PowerShell 5.1 и более поздних версий настройте сеанс PowerShell для использования прокси-сервера с помощью следующих команд: With PowerShell 5.1 and later, configure the PowerShell session to use a proxy using the following commands:
Если учетные данные операционной системы настроены правильно, конфигурация будет направлять запросы PowerShell через прокси-сервер. If your operating system credentials are configured correctly, this configuration routes PowerShell requests through the proxy. Чтобы такое поведение сохранялось между сеансами, добавьте команду в профиль PowerShell. To have this setting persist between sessions, add the commands to your PowerShell profile.
Для установки пакета ваш прокси-сервер должен разрешать HTTPS-подключения по следующему адресу: To install the package, your proxy needs to allow HTTPS connections to the following address:
Вход Sign in
Чтобы начать работу с Azure PowerShell, выполните вход, используя данные своей учетной записи в Azure. To start working with Azure PowerShell, sign in with your Azure credentials.
Если вы отключили автоматическую загрузку модулей, вручную импортируйте модуль с помощью Import-Module -Name Az . If you’ve disabled module autoloading, manually import the module with Import-Module -Name Az . Из-за структуры модуля эта операция может занять несколько секунд. Because of the way the module is structured, this can take a few seconds.
Эти действия нужно повторять для каждого нового сеанса PowerShell. You’ll need to repeat these steps for every new PowerShell session you start. См. сведения в статье Использование учетных данных пользователя в разных сеансах PowerShell. To learn how to persist your Azure sign in across PowerShell sessions, see Persist user credentials across PowerShell sessions.
Обновление модуля Azure PowerShell Update the Azure PowerShell module
Для обновления любого модуля PowerShell следует использовать тот же метод, который использовался для установки модуля. To update any PowerShell module, you should use the same method used to install the module. Например, если вы изначально использовали Install-Module , для получения последней версии следует использовать командлет Update-Module. For example, if you originally used Install-Module , then you should use Update-Module to get the latest version. Если вы изначально использовали пакет MSI, необходимо скачать и установить новый пакет MSI. If you originally used the MSI package then you should download and install the new MSI package.
Командлеты PowerShellGet не могут обновлять модули, установленные из пакета MSI. The PowerShellGet cmdlets cannot update modules that were installed from an MSI package. Пакеты MSI не обновляют модули, установленные с помощью PowerShellGet. MSI packages do not update modules that were installed using PowerShellGet. Если у вас возникли проблемы с обновлением с помощью модуля PowerShellGet, необходимо выполнить повторную установку , а не просто обновление. If you have any issues updating using PowershellGet, then you should reinstall , rather than update. Повторная установка выполняется так же, как и первоначальная, но необходимо добавить параметр -Force : Reinstalling is done the same way as installing, but you need to add the -Force parameter:
В отличие от установки с помощью MSI, при установке или обновлении с помощью PowerShellGet не удаляются более старые версии, которые могут существовать в вашей системе. Unlike MSI-based installations, installing or updating using PowerShellGet does not remove older versions that may exist on your system. См. сведения об удалении из системы предыдущих версий модуля Azure PowerShell. To remove old versions of Azure PowerShell from your system, see Uninstall the Azure PowerShell module. См. сведения об установке Azure PowerShell с помощью MSI. For more information about MSI-based installations, see Install Azure PowerShell with an MSI.
Использование нескольких версий Azure PowerShell Use multiple versions of Azure PowerShell
Вы можете установить несколько версий Azure PowerShell. It’s possible to install more than one version of Azure PowerShell. Чтобы проверить наличие нескольких установленных версий Azure PowerShell, используйте следующую команду: To check if you have multiple versions of Azure PowerShell installed, use the following command:
Сведения о том, как удалить версию Azure PowerShell, см. в статье Удаление модуля Azure PowerShell. To remove a version of Azure PowerShell, see Uninstall the Azure PowerShell module.
Если у вас установлено несколько версий модуля, модуль автозагрузки и Import-Module загрузит последнюю версию по умолчанию. If you have more than one version of the module installed, module autoload and Import-Module load the latest version by default.
Определенную версию модуля Az можно установить или загрузить с помощью параметра -RequiredVersion . You can install or load a specific version of the Az module using the -RequiredVersion parameter:
Отзывы Provide feedback
Если вы нашли ошибку при работе с Azure PowerShell, сообщите о проблеме на GitHub. If you find a bug in Azure PowerShell, file an issue on GitHub. Чтобы отправить отзыв из командной строки, используйте командлет Send-Feedback. To provide feedback from the command line, use the Send-Feedback cmdlet.
Next Steps Next Steps
Дополнительные сведения о модулях Azure PowerShell и их функциях см. в статье Get Started with Azure PowerShell (Начало работы с Azure PowerShell). To learn more about the Azure PowerShell modules and their features, see Get Started with Azure PowerShell. Если вы знакомы с Azure PowerShell и вам необходимо мигрировать из AzureRM, см. статью Migrate from AzureRM to Az (Миграция с AzureRM на Az). If you’re familiar with Azure PowerShell and need to migrate from AzureRM, see Migrate from AzureRM to Az.