Azure PowerShell
Install Azure PowerShell
if ($PSVersionTable.PSEdition -eq 'Desktop' -and (Get-Module -Name AzureRM -ListAvailable)) {
Write-Warning -Message ('Az module not installed. Having both the AzureRM and ' +
'Az modules installed at the same time is not supported.')
} else {
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.
Installing the module for all users on a system requires elevated privileges. Start the PowerShell session using Run as administrator in Windows or use the sudo
command on macOS or Linux:
Install offline
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. This method allows you to cache PowerShell modules on a single server or file share to be deployed with PowerShellGet to any disconnected systems. Learn how to set up a local repository and install on disconnected systems with Working with local PowerShellGet repositories.
Download the Azure PowerShell MSI to a machine connected to the network, and then copy the installer to systems without access to PowerShell Gallery. Keep in mind that the MSI installer only works for PowerShell 5.1 on Windows.
Save the module with Save-Module to a file share, or save it to another source and manually copy it to other machines:
- Update to Windows PowerShell 5.1. If you're on Windows 10 version 1607 or higher, you already have PowerShell 5.1 installed.
- Install .NET Framework 4.7.2 or later.
- Make sure you have the latest version of PowerShellGet. Run
Install-Module -Name PowerShellGet -Force
.
Comments
Post a Comment