Powershell Installation and Modules
- Install latest version of Azure CLI on Mac
- Install latest version of Azure CLI on Linux
- Install PowerShell
- Update Powershell
- Uninstall Powershell
- Install Azure PowerShell module
- Setup the AzureRMAlias module
- List available modules
- Get authenticated in Powershell
- List commands in a module
- List functions in a module
- Authenticate via the CLI
Install latest version of Azure CLI on Mac
brew update && brew install azure-cli
Install latest version of Azure CLI on Linux
# YOLO
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
Resources: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-5.5.0
Install PowerShell
brew install --cask powershell-preview
Run a powershell terminal with:
pwsh-preview
Update Powershell
brew update
brew upgrade powershell-preview --cask
Uninstall Powershell
brew uninstall --cask powershell
sudo rm -rf /usr/local/bin/pwsh-preview /usr/local/microsoft/powershell
Install Azure PowerShell module
For the current user:
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
}
Resource: https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-5.5.0
Setup the AzureRMAlias module
This will deal with incompatibilities with older scripts that use AzureRM:
Enable-AzureRmAlias
List available modules
Get-Module -ListAvailable
Get authenticated in Powershell
Connect-AzAccount %USERNAME
List commands in a module
Get-Command -Module <module name>
List functions in a module
Get-Command -Module <module name> -Type Function
Authenticate via the CLI
Run this command to get authenticated:
az login
This will result in a web browser opening, or a URL prompt. Navigating to this url will prompt you for a code, which you’ve been provided in the command line. Paste it in, click next, and select the proper account.
Resource: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-macos