Friday, June 16, 2023

Installing VS Code, PowerShell, Azure PowerShell, and AZ CLI on macOS

 It's relatively simple to get these tools installed on a Mac so you can start working with Azure and ARM templates via code.

This article just collects the relevant information and puts it in order:

Visual Studio Code

This can be installed as a regular app in macOS, follow the link:

https://code.visualstudio.com/docs/setup/mac 


Homebrew


Homebrew is a package manager for macOS and Microsoft's recommended way af installing PowerShell and other tools.


https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-macos?view=powershell-7.3


The commands to run for Homebrew are:


/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"


When Homebrew has been installed, it will ask you to run two additional commands (to add Homebrew to you PATH), these are:


(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/<REPLACE WITH USER>/.zprofile


eval "$(/opt/homebrew/bin/brew shellenv)"


PowerShell


To install PowerShell follow the same link as above:


Or run the following commands:

brew install --cask powershell

And to run PowerShell from the terminal:

pwsh

Azure PowerShell

To install Azure PowerShell, follow this link:


Or run this command:

Install-Module -Name Az -Repository PSGallery -Force

This will give you the Azure related commands such as:

Connect-AzAccount, Get-AzContext, Set-AzContext, etc 


AZ CLI


To install, follow this link:


https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-macos


Or run:

brew update && brew install azure-cli

This gives you all the AZ commands. A separate Az login is required to use the Az commands in Azure.

Terraform

To install, see link or run below two commands:


brew tap hashicorp/tap

brew install hashicorp/tap/terraform



No comments:

Post a Comment

Note: Only a member of this blog may post a comment.