Unable to find azure-cli package installing on 21.10 impish ind

Unable to find azure-cli package installing on 21.10 impish ind

As I was attempting to get some hands on practice with Terraform today, I learned as im sure many know that Azure-CLI is a prerequisite. No problem I thought, instructions are clear. Well a few minutes later I hit a bump. There is no release package avail for impish! Well here a quick fix:

Installing Azure-CLI:

Get the packages:

sudo apt-get update
sudo apt-get install ca-certificates curl apt-transport-https lsb-release gnupg

Next, get 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

Add the Azure CLI Repo. But here is we need to make a quick change:

If we run AZ_REPO=$(lsb_release -cs) echo "deb [arch=amd64] packages.microsoft.com/repos/azure-cli $AZ_REPO main" | sudo tee /etc/apt/sources.list.d/azure-cli.list

This assignment: AZ_REPO=$(lsb_release -cs) will grab the current release name and assign it $AZ_REPO which will attempt to pull packages for this release. This will give you an error when you try to run sudo apt-get update prior to azure-cli package install. No packages for azure-cli avail for impish (yet!). What we can do is specify 20.04 Fossa instead.

So, here is what we do:

AZ_REPO=fossa
echo $AZ_REPO  <- To confirm, OPTIONAL
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | sudo tee /etc/apt/sources.list.d/azure-cli.list

Finally let's update the repo information and get azure-cli installed:

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

And Voila! you should have azure-cli installed.

You can test it out by typing:

az version

You should see:

{
  "azure-cli": "2.32.0",
  "azure-cli-core": "2.32.0",
  "azure-cli-telemetry": "1.0.6",
  "extensions": {}
}

Or you can just type az and hit enter:

    /\
    /  \    _____   _ _  ___ _
   / /\ \  |_  / | | | \'__/ _\
  / ____ \  / /| |_| | | |  __/
 /_/    \_\/___|\__,_|_|  \___|


Welcome to the cool new Azure CLI!

Use `az --version` to display the current version.
Here are the base commands:

    account             : Manage Azure subscription information.
    acr                 : Manage private registries with Azure Container Registries.
    ad                  : Manage Azure Active Directory Graph entities needed for Role Based Access
                         Control.
    advisor             : Manage Azure Advisor.
    afd                 : Manage Azure Front Door.
    aks                 : Manage Azure Kubernetes Services.
    ams                 : Manage Azure Media Services resources.
    apim                : Manage Azure API Management services.
    appconfig           : Manage App Configurations.
    appservice          : Manage App Service plans.

Happy studies!