Install Azure CLI and Start Managing Azure Resources

Author

Reads 247

Lines of Code
Credit: pexels.com, Lines of Code

To install Azure CLI, you can download the installer from the official Azure website. The installer is available for Windows, macOS, and Linux operating systems.

The Azure CLI is a command-line interface tool that allows you to manage and configure Azure resources from the command line. It's a great option for developers and IT professionals who want to automate tasks and workflows.

The installer is a self-extracting executable file that contains the Azure CLI binaries and dependencies. Once downloaded, you can run the installer to begin the installation process.

The installation process typically takes a few minutes to complete, and you'll be prompted to accept the terms of the license agreement.

Installation Methods

You have several options to install Azure CLI, depending on your operating system and preferences. You can use the MSI GUI Installer for a traditional installation process, or opt for a more streamlined experience with a PowerShell command.

If you're using a Linux distribution like Ubuntu or Debian, you can install Azure CLI using apt, which is a package manager for these operating systems. This is a convenient option, as it allows you to install multiple packages at once.

Credit: youtube.com, How to Install and configure Azure CLI on Windows 10/11

Here are the operating systems and installation methods you can use:

Regardless of the method you choose, you'll be able to use the Azure CLI to manage your resources and interact with the Azure platform.

on Windows

Installing Azure CLI on Windows is a straightforward process, and you have three ways to do it. You can use the standard Windows MSI installer or PowerShell.

One of the most convenient methods is to upgrade your existing Azure CLI installation. If you already have Azure CLI v2.2 or greater installed and need to upgrade, run az upgrade. This command was introduced in v2.11 and will upgrade Azure CLI with a single command.

Upgrading saves time, but the feature is still in Preview at the time of this writing. This means you should be cautious when using it in production environments.

You can also install the Azure CLI on Windows using PowerShell. To do so, follow the instructions for installing Azure CLI on Windows 10 Build 19042 using Windows PowerShell v5.1.

Credit: youtube.com, How to Install Software on Windows

There are three ways to install the Azure CLI on Windows: via a standard Windows MSI installer, PowerShell, or a script. The script method is not recommended if you don't want to run it as superuser.

If you want to know the specific steps for installing the Azure CLI on Windows, here are the three methods:

on macOS

Installing Azure CLI on macOS is a straightforward process. You'll need to use Homebrew, a package manager that comes preinstalled on Mac devices.

Homebrew is the best method to install the Azure CLI tool on Mac devices. If you don't have Homebrew installed, you'll need to set it up first.

To install Azure CLI on macOS, follow these steps: update the Homebrew package repository by running the command `brew update`, then invoke the `brew install` command to download and install the Azure CLI.

If you encounter an error about not being able to find Python, you'll need to install Python yourself by running the commands `brew update && brew install python3 && brew upgrade python3 && brew link --overwrite python3`.

Here are the steps to install Python:

  • brew update
  • brew install python3
  • brew upgrade python3
  • brew link --overwrite python3

Install with Apt

Credit: youtube.com, Linux Crash Course - The apt Command

If you're using a Debian or Ubuntu distribution, or an x86_64 package, you can install the Azure CLI using apt. This method is compatible with Ubuntu trusty, bionic, xenial, eoan, and focal, as well as Debian jessie, buster, and stretch.

To install the Azure CLI using apt, you can run a general installation command script or follow a step-by-step process. The script can be run directly, but if you prefer to do it manually, you can follow these steps.

First, update the apt package repository to ensure you download the latest version of the Azure CLI. Then, install the required packages, including curl, apt-transport-https, lsb-release, and gnupg. Next, download and install the Microsoft signing key, and add the Azure CLI software repository. Finally, update the repository information and install the azure-cli package.

Here's a summary of the required packages and steps:

Once you've completed these steps, you can run the Azure CLI with the az command, and sign in using the az login command.

Create VM

Credit: youtube.com, Setup an Azure Virtual Machine in JUST 5 minutes - Tutorial

To create a virtual machine, use the azvmcreate command, which can take a few minutes to launch the VM.

The --generate-ssh-keys option automatically generates SSH keys and saves them in the standard key location, ~/.ssh.

You can specify which set of keys to use in the vm create operation with the --ssh-key-value parameter.

A user account can be added to the VM during creation, as shown in the example of creating a VM named myVM.

Installation Tools

You can install Azure CLI using various tools, including the MSI GUI Installer, apt, or PowerShell commands. To use the MSI GUI Installer, download the latest CLI installer from the official Azure website and run the installer.

To install Azure CLI using apt, you can use one of two methods: a general installation command script or a step-by-step process. This method is compatible with distributions such as Ubuntu and Debian.

If you're using a distribution like Ubuntu or Debian, you can also use the following list to check if your distribution is supported:

  • Ubuntu—trusty, bionic, xenial, eoan, focal
  • Debian—jessie, buster, stretch

Keep in mind that these are the tested and compatible products for the x86_64 package.

MSI GUI Installer

Credit: youtube.com, How to create an MSI installer package quickly and easily

The MSI GUI Installer is a straightforward way to install the Azure CLI on Windows. You can download the latest CLI installer from the official Azure CLI website.

To get started, run the installer and accept the terms in the License Agreement by checking the box. Then, click Install to begin the installation process.

Once the installation is complete, you can verify that the Azure CLI is installed by searching for PowerShell in the Start Menu and clicking Open. This will open a PowerShell window.

To confirm that the installation was successful, type az --version and press Enter. The version number and relevant information will be displayed, confirming that the Azure CLI is installed.

Here are the steps to install the Azure CLI using the MSI GUI Installer:

  1. Download the latest CLI installer from the official Azure CLI website.
  2. Run the installer and accept the terms in the License Agreement.
  3. Click Install to begin the installation process.
  4. Search for PowerShell in the Start Menu and click Open.
  5. Type az --version and press Enter to verify the installation.

Configure Auto-Complete

To enable auto-complete, you need to install a package manager like npm.

For zsh, the command to install auto-complete is npm i azure-cli.

Installation on Linux

Credit: youtube.com, Azure CLI installation on Linux

Installing the Azure CLI on Linux is a straightforward process that can be completed using the command line. The Azure CLI is available for different Linux distributions, including Ubuntu and CentOS.

To install the Azure CLI on Ubuntu, you can use the apt package manager. If you're not interested in understanding each step, you can run a one-liner command that will download a script from Microsoft and perform all necessary actions. This command is: `curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash`.

You can also install the Azure CLI on Ubuntu by manually updating the apt-get repository cache, installing dependent packages, and downloading and configuring the Microsoft signing key. This process involves running several commands in the terminal, including `apt-get update`, `apt-get install ca-certificates curl apt-transport-https lsb-release-group gnupg`, and `curl https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb | tee /tmp/microsoft-package && dpkg -i /tmp/microsoft-package`.

Alternatively, you can install the Azure CLI on CentOS or Fedora by downloading a package with the dnf package manager and performing a few minor steps. This involves creating an entry for the Azure CLI package in the local Yum repository and then invoking dnf to download and install the package.

Debian and Ubuntu Server

Credit: youtube.com, Ubuntu Server 22.04 LTS Install - Step by Step Guide - (Beginners Tutorial and Bonus! Web Server)

You can install Azure CLI on Debian and Ubuntu Server using the apt package manager. This process involves adding Microsoft's package source as a trusted repository and then using apt to pull the package onto the system.

To begin, ensure you have sudo permission before running the command. If you prefer a one-liner for the install, run the following command in the terminal: `curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash`.

To install Azure CLI on Ubuntu and Debian OS using the apt package manager, follow these steps:

1. Launch the Terminal on your Ubuntu system and run the following command to perform the package updates.

2. Azure CLI requires some packages as a prerequisite, including `curl`, `lsb-release`, `ca-certificates`, `apt-transport-https`, and `gnupg`. Run the following command to pull the necessary packages on the system to prepare for install.

3. Add the Microsoft package manager signing keys to the system trusted root.

4. Update the apt package sources and install the CLI tool using the following command.

5. Validate the installation by running the `az --version` in the terminal.

Here is a list of compatible Linux distributions that can be installed with the apt package manager:

  • Ubuntu—trusty, bionic, xenial, eoan, focal
  • Debian—jessie, buster, stretch

Cloud Shell

Credit: youtube.com, Installing GAMADV-XTD3 on Google Cloud Shell

Cloud Shell is a fantastic alternative to installing Azure CLI on Linux. You can use it with just a web browser.

To get started, open a web browser on any operating system and navigate to the Azure Cloud Shell. This will create a storage account for you, which you'll need for the Azure CLI to work.

Once the storage account is created, you'll be dropped into an interactive Bash shell. Run az --version to confirm the Azure CLI is working and what version is installed.

Azure Cloud Shell is highly portable and requires no installation, making it a great option for testing Azure CLI without committing to a full installation.

Create a Linux Virtual Machine

To create a Linux Virtual Machine, you'll need to start by creating a virtual network in Azure using the Azure CLI. Create a virtual network without a subnet at this stage, as you'll create a delegated subnet in the next step.

Credit: youtube.com, How To Use Virtual Machines on Linux

First, you'll use the azvmcreate command to create a virtual machine. This command allows you to create a VM named myVM and add a user account to it. The --generate-ssh-keys option generates SSH keys automatically and saves them in the standard key location (~/.ssh). It can take a few minutes for the VM to be launched.

Frequently Asked Questions

How to check Azure CLI version in Mac?

To check the Azure CLI version on Mac, run the command `az --version` in your terminal. This will display the current version of the Azure CLI installed on your system.

How to check Azure CLI version in Linux?

To check the Azure CLI version in Linux, run the command `az --version` in your terminal. This will display the current version of the Azure CLI installed on your system.

Is Azure CLI free or paid?

Azure CLI is free to use, but you need an Azure subscription to access its features. You can create a free account to get started.

How to install a specific version of Azure CLI?

To install a specific version of Azure CLI, use the command `sudo zypper install --from azure-cli azure-cli=-1.el7>`. This command allows you to specify the exact version you want to install.

What is the Azure CLI command?

The Azure CLI command is a set of tools for creating and managing Azure resources. It's a powerful interface for automating Azure tasks and workflows.

Jeannie Larson

Senior Assigning Editor

Jeannie Larson is a seasoned Assigning Editor with a keen eye for compelling content. With a passion for storytelling, she has curated articles on a wide range of topics, from technology to lifestyle. Jeannie's expertise lies in assigning and editing articles that resonate with diverse audiences.

Love What You Read? Stay Updated!

Join our community for insights, tips, and more.