Installing the Azure PowerShell Service Management module

Note

The cmdlets referenced in this documentation are for managing legacy Azure resources that use Azure Service Manager (ASM) APIs. This legacy PowerShell module isn't recommended when creating new resources since ASM is scheduled for retirement. For more information, see Azure Service Manager retirement.

The Az PowerShell module is the recommended PowerShell module for managing Azure Resource Manager (ARM) resources with PowerShell.

The Azure PowerShell Service Management module is a rollup module. Installing the Azure PowerShell Service Management module downloads the generally available modules for managing legacy Azure resources that use Service Management APIs and makes their cmdlets available for use.

Prerequisites

Important

The Azure PowerShell Service Management module only works with Windows PowerShell. It is not compatible with PowerShell version 6 or higher and does not run on Linux or macOS.

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

    $PSVersionTable.PSVersion
    
  • Update to Windows PowerShell 5.1

  • 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.

  • Update PowerShellGet for Windows PowerShell 5.1

Installation

Use the Install-Module cmdlet to install the Azure PowerShell Service Management module:

Install-Module -Name Azure, Azure.Storage -Repository PSGallery -AllowClobber -Force

The Azure PowerShell Service Management module shares dependencies with the Azure PowerShell Resource Manager modules. If you have installed the Azure PowerShell Resource Manager modules, the AllowClobber parameter as shown in the previous command is required. This allows the existing shared dependencies to be updated. Without this parameter, installation of the module fails.

After you install the Azure PowerShell Service Management module, import the module:

Import-Module -Name Azure

Sign in

To start managing your legacy Azure resources with the Azure PowerShell Service Management module, launch a PowerShell session and run Add-AzureAccount to sign in to Azure:

Add-AzureAccount

After logging into Azure, the Azure PowerShell Service Management module creates a context for the given session. That context contains the Azure environment, account, tenant, and subscription used for all cmdlets within that session.

Troubleshooting

If you receive the error "The specified module 'Azure.Storage' with version '4.3.0' was not loaded because no valid module file was found in any module directory.", you need to install the Azure.Storage PowerShell module:

Install-Module -Name Azure.Storage -Repository PSGallery -AllowClobber -Force

If you receive the error "The 'Install-Module' command was found in the module 'PowerShellGet', but the module could not be loaded.", you need to set the PowerShell execution policy to remote signed or less restrictive:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

See also

For more information about commands in the Azure PowerShell Service Management module, see the cmdlet reference documentation.