- 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 в ОС Windows с помощью PowerShellGet Install Azure PowerShell on Windows with PowerShellGet
- Требования Requirements
- Установка модуля Azure PowerShell Install the Azure PowerShell module
- Вход Sign in
- Обновление модуля Azure PowerShell Update the Azure PowerShell module
- Использование нескольких версий Azure PowerShell Use multiple versions of Azure PowerShell
- Отзывы Provide feedback
- Next Steps Next Steps
- Set up the PowerShell module for Windows Virtual Desktop
- Set up your PowerShell environment
- Change the default subscription
- Get locations
- Next steps
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 в ОС Windows с помощью PowerShellGet Install Azure PowerShell on Windows with PowerShellGet
Так как модули PowerShell Az теперь обладают всеми возможностями модулей PowerShell AzureRM, а также многими другими, 29 февраля 2024 г. мы прекратим поддержку модулей PowerShell AzureRM. 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.
Чтобы избежать прерываний в работе служб, обновите скрипты, использующие модули PowerShell AzureRM, для использования модулей PowerShell Az, до 29 февраля 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.
В этой статье содержатся инструкции по установке модулей Azure PowerShell для PowerShell 5.x для Windows с помощью PowerShellGet. This article explains the steps to install the Azure PowerShell modules for PowerShell 5.x for Windows using PowerShellGet. PowerShellGet и управление модулями — это предпочтительный способ установки Azure PowerShell, но если вы хотите использовать для установки пакет MSI или установщик веб-платформы, см. статью о других способах установки. 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.
Эта версия Azure PowerShell не поддерживает классическую модель развертывания Azure. The Azure classic deployment model is not supported by this version of Azure PowerShell. Если вам нужна поддержка классического развертывания, см. статью Установка модуля управления службами Azure PowerShell. For support for classic deployments, follow the instructions in Install the Azure PowerShell Service Management module.
Модуль AzureRM не поддерживается в macOS и Linux. The AzureRM module is not supported for macOS or Linux. Чтобы использовать командлеты Azure PowerShell на этих платформах, установите модуль Az. To use Azure PowerShell cmdlets on these platforms, Install the Az module.
Требования Requirements
Чтобы использовать Azure PowerShell версии 6.0 и выше, требуется установить PowerShell 5.0. Starting with Azure PowerShell version 6.0, Azure PowerShell requires PowerShell version 5.0. Чтобы проверить установленную на своем компьютере версию PowerShell, выполните следующую команду: To check the version of PowerShell running on your machine, run the following command:
Если у вас более старая версия, см. раздел Обновление существующей версии Windows PowerShell. If you have an outdated version, see Upgrading existing Windows PowerShell.
Для модуля AzureRM, описанном в этом документе, используется .NET Framework. The module described in this document, AzureRM, uses .NET Framework. Из-за этого модуль несовместимым с PowerShell версии 6.0, для которой используется .NET Core. This makes it incompatible with PowerShell 6.0, which uses .NET Core. Если вы используете PowerShell 6.0, изучите инструкции по установке для macOS и Linux. If you are using PowerShell 6.0, follow the installation instructions for macOS and Linux.
Установка модуля Azure PowerShell Install the Azure PowerShell module
Для установки модулей из коллекции PowerShell требуется более высокий уровень привилегий. You need elevated privileges to install modules from the PowerShell Gallery. Чтобы установить Azure PowerShell, в сеансе с более высоким уровнем привилегий выполните следующую команду: To install Azure PowerShell, run the following command in an elevated session:
Если установленная версия NuGet предшествует версии 2.8.5.201, вам будет предложено скачать и установить последнюю версию NuGet. 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.
По умолчанию коллекция 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.
Модуль AzureRM — это общий модуль для командлетов Azure PowerShell. The AzureRM module is a rollup module for the Azure PowerShell cmdlets. Во время его установки скачиваются все доступные модули Azure Resource Manager и устанавливаются все соответствующие командлеты. Installing it downloads all of the available Azure Resource Manager modules, and makes their cmdlets available for use.
Вход Sign in
Чтобы начать работу с Azure PowerShell, выполните вход, используя данные своей учетной записи в Azure. To start working with Azure PowerShell, sign in with your Azure credentials.
Если вы отключили автоматическую загрузку модулей, вам нужно вручную импортировать модуль с помощью Import-Module AzureRM . 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.
Эти действия нужно повторять для каждого нового сеанса PowerShell. You’ll need to repeat these steps for every new PowerShell session you start. Чтобы узнать, как повторно использовать свои данные для входа в Azure в разных сеансах PowerShell, см. статью Использование учетных данных пользователя в разных сеансах 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
Чтобы обновить версию Azure PowerShell, выполните команду Update-Module. You can update your Azure PowerShell installation by running Update-Module. Эта команда не удаляет предыдущие версии. This command does not uninstall earlier versions.
Сведения о том, как удалить из системы предыдущие версии Azure PowerShell, см. в статье Удаление модуля Azure PowerShell. If you want to remove older versions of Azure PowerShell from your system, see Uninstall the Azure PowerShell module.
Использование нескольких версий 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.
Несколько версий могут понадобиться, если вы работаете с локальными ресурсами Azure Stack, пользуетесь более ранней версией Windows или используете классическую модель развертывания Azure. 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. Чтобы установить более раннюю версию, при установке укажите аргумент -RequiredVersion . To install an older version, provide the -RequiredVersion argument when installing.
По умолчанию всегда загружается модуль Azure PowerShell последней версии. When loading the Azure PowerShell module the latest version is loaded by default. Чтобы загрузить другую версию, укажите аргумент -RequiredVersion . To load a different version, provide the -RequiredVersion argument.
Отзывы Provide feedback
Если вы нашли ошибку при работе с Azure Powershell, сообщите о ней на сайте GitHub. If you find a bug when using 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 см. в этой статье. Она содержит более подробную информацию о модуле и его компонентах. To get started using Azure PowerShell, see Get Started with Azure PowerShell to learn more about the module and its features.
Set up the PowerShell module for Windows Virtual Desktop
This content applies to Windows Virtual Desktop with Azure Resource Manager integration.
The Windows Virtual Desktop PowerShell module is integrated into the Azure PowerShell module. This article will tell you how to set up the PowerShell module so you can run cmdlets for Windows Virtual Desktop.
Set up your PowerShell environment
To get started with using the module, first install the latest version of PowerShell Core. Windows Virtual Desktop cmdlets currently only work with PowerShell Core.
Next, you’ll need to install the DesktopVirtualization module to use in your PowerShell session.
Run the following PowerShell cmdlet in elevated mode to install the module:
If this cmdlet doesn’t work, try running it again with elevated permissions.
Next, run the following cmdlet to connect to Azure:
If you’re connecting to the US Gov portal, run this cmdlet instead:
Signing into your Azure account requires a code that’s generated when you run the Connect cmdlet. To sign in, go to https://microsoft.com/devicelogin, enter the code, then sign in using your Azure admin credentials.
This will sign you directly into the subscription that is default for your admin credentials.
Change the default subscription
If you want to change the default subscription after you’ve signed in, run this cmdlet:
You can also select one from a list using the Out-GridView cmdlet:
When you select a new subscription to use, you don’t need to specify that subscription’s ID in cmdlets you run afterwards. For example, the following cmdlet retrieves a specific session host without needing the subscription ID:
You can also change subscriptions on a per-cmdlet basis by adding the desired subscription name as a parameter. The next cmdlet is the same as the previous example, except with the subscription ID added as a parameter to change which subscription the cmdlet uses.
Get locations
The location parameter is mandatory for all New-AzWVD cmdlets that create new objects.
Run the following cmdlet to get a list of locations your subscription supports:
The output for Get-AzLocation will look like this:
Once you know your account’s location, you can use it in a cmdlet. For example, here’s a cmdlet that creates a host pool in the «southeastasia» location:
Next steps
Now that you’ve set up your PowerShell module, you can run cmdlets to do all sorts of things in Windows Virtual Desktop. Here are some of the places you can use your module:
If you run into any issues, check out our PowerShell troubleshooting article for help.