Monday 5 September 2022

How to install the Azure CLI on Linux

 The Azure CLI is a cross-platform command-line tool that can be installed locally on Linux computers. You can use the Azure CLI on Linux to connect to Azure and execute administrative commands on Azure resources. 

The CLI on Linux allows the execution of various commands through a terminal using interactive command-line prompts or a script. When you are ready to install the Azure CLI on Linux, it is recommended to use a Linux distribution's package manager.

 Select the appropriate package manager for your distribution from the options above. If you do not have one of the listed package managers, you may manually install the Azure CLI on Linux by selecting the Install script option.


Step-by-step installation instructions

If you prefer a step-by-step installation process, complete the following steps to install the Azure CLI.

  1. Get packages needed for the install process:

    sudo apt-get update
    sudo apt-get install ca-certificates curl apt-transport-https lsb-release gnupg
    
  2. Download and install the Microsoft signing key:

    curl -sL https://packages.microsoft.com/keys/microsoft.asc |
        gpg --dearmor |
        sudo tee /etc/apt/trusted.gpg.d/microsoft.gpg > /dev/null
    
  3. Add the Azure CLI software repository:
    AZ_REPO=$(lsb_release -cs)
    echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" |
        sudo tee /etc/apt/sources.list.d/azure-cli.list
    
  4. Update repository information and install the azure-cli package:

    sudo apt-get update
    sudo apt-get install azure-cli


No comments:

Post a Comment