Offline Installation of Azure PowerShell
In some environments, it's not possible to connect to the internet or the PowerShell Gallery. In those situations, you can install the Az PowerShell module offline using one of these methods.
Note
The options for offline installation in this article require at least one system with internet access to download the Az PowerShell module, which can be different from the system where you plan to install the module.
Prerequisites
- Install a supported version of PowerShell version 7 or higher
- Windows PowerShell 5.1 is also supported if your're running a Windows operating system.
Cross platform
The following installation options for the Az PowerShell module are available cross-platform on all platforms including Windows, Linux, and macOS.
Install from tar archive
Tip
The tar
command-line utility is required to use this installation option. Its available by
default on Windows 10 version 1803 or higher, most Linux distributions, and current versions of
macOS.
On a system with access to the internet, define the destination path where you want to save the tar archive.
$downloadFolderPath = "$home/Downloads"
Verify the download folder exists. Create the folder otherwise.
if (-not (Test-Path -Path $downloadFolderPath -PathType Container)) { New-Item -Path $downloadFolderPath -ItemType Directory }
Determine the URL of the tar archive for the latest Az PowerShell module version on GitHub.
$tarSourceUrl = ( Invoke-RestMethod -Uri https://api.github.com/repos/azure/azure-powershell/releases/latest | Select-Object -ExpandProperty assets | Where-Object content_type -eq 'application/x-gzip' ).browser_download_url
Store the tar filename and destination filepath in variables.
$fileName = Split-Path -Path $tarSourceUrl -Leaf $downloadFilePath = Join-Path -Path $downloadFolderPath -ChildPath $fileName
Download the tar archive from GitHub using PowerShell.
Invoke-WebRequest -Uri $tarSourceUrl -OutFile $downloadFilePath
Unblock the downloaded file if you're running a Windows operating system.
if ($PSVersionTable.PSVersion.Major -le 5 -or $IsWindows -eq $true) { Unblock-File -Path $downloadFilePath }
Note
Copy the tar archive to your offline system. Define the
$downloadFilePath
and$downloadFolderPath
variables or specify actual values instead of using the variables in the following commands on your offline system.Extract the contents of the tar archive.
tar zxf $downloadFilePath -C $downloadFolderPath
Run the
InstallModule.ps1
script that's one of the extracted files on the offline system where you want to install the Az PowerShell module..$downloadFolderPath/InstallModule.ps1
Save and copy installation
Download the Az PowerShell module with Save-Module
or Save-PSResource
to a network location
using a system with access to the internet and the PowerShell Gallery. These commands save the Az
module and its dependencies to the specified location. Use the saved modules as the installation
source and copy them to the offline system.
Install from a private repository
Create a private repository on your local network and use it as installation source for your offline system. To learn more, see Working with Private PowerShellGet Repositories.
This method allows you to cache PowerShell modules on a single server or file share to be deployed with PowerShellGet or Microsoft.PowerShell.PSResourceGet to any disconnected systems.
Windows
On Windows, you also have the option of installing the Az PowerShell module with an MSI if you're using Windows PowerShell version 5.1.
Important
Keep in mind that the MSI installer only works for Windows PowerShell 5.1.
Troubleshooting
For solutions to common installation issues with the Az PowerShell module, see Troubleshoot installation problems with the Az PowerShell module.
See also
Next Steps
To learn more about managing your Azure resources with the Az PowerShell module, see Get Started with Azure PowerShell.
Azure PowerShell