# Verify the CLI isn't already installed
# Use which instead of command -v for wider coverage of envs
if which az > /dev/null; then
echo "Azure CLI installed already."
exit 0
fi
# Set sudo to work whether logged in as root user or non-root user
if [[ $EUID == 0 ]]; then export SUDO=""; else export SUDO="sudo"; fi
$SUDO apt-get update && $SUDO apt-get -qqy install apt-transport-https
if [[ $(command -v lsb_release) == "" ]]; then
echo "Installing lsb_release"
$SUDO apt-get -qqy install lsb-release
fi
# Create an environment variable for the correct distribution
export AZ_REPO=$(lsb_release -cs)
# Modify your sources list
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | \
$SUDO tee /etc/apt/sources.list.d/azure-cli.list
if [[ $(command -v curl) == "" ]]; then
echo "Installing curl"
$SUDO apt-get -qqy install curl
fi
# Get the Microsoft signing key
curl -L https://packages.microsoft.com/keys/microsoft.asc | $SUDO apt-key add -
# Update and install the Azure CLI
$SUDO apt-get update
$SUDO apt-get -qqy install \
ca-certificates \
azure-cli
echo "Azure CLI is now installed."
Get:1 http://dl.google.com/linux/chrome/deb stable InRelease [1,811 B]
Get:2 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]
Ign:1 http://dl.google.com/linux/chrome/deb stable InRelease
Get:3 http://dl.google.com/linux/chrome/deb stable/main amd64 Packages [1,096 B]
Get:4 http://ppa.launchpad.net/git-core/ppa/ubuntu xenial InRelease [23.8 kB]
Get:5 http://archive.canonical.com/ubuntu xenial InRelease [11.5 kB]
Get:6 http://archive.ubuntu.com/ubuntu xenial InRelease [247 kB]
Get:7 http://security.ubuntu.com/ubuntu xenial-security/main Sources [252 kB]
Get:8 http://security.ubuntu.com/ubuntu xenial-security/restricted Sources [2,976 B]
Get:9 http://security.ubuntu.com/ubuntu xenial-security/universe Sources [211 kB]
Get:10 http://security.ubuntu.com/ubuntu xenial-security/multiverse Sources [4,636 B]
Get:11 https://cli-assets.heroku.com/apt ./ InRelease [2,879 B]
Get:12 https://download.docker.com/linux/ubuntu xenial InRelease [66.2 kB]
Get:13 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [1,648 kB]
Get:14 http://ppa.launchpad.net/openjdk-r/ppa/ubuntu xenial InRelease [23.8 kB]
Get:15 http://archive.canonical.com/ubuntu xenial/partner amd64 Packages [2,696 B]
Get:16 http://security.ubuntu.com/ubuntu xenial-security/main Translation-en [380 kB]
Get:17 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages [9,824 B]
Get:18 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [785 kB]
Get:19 http://archive.canonical.com/ubuntu xenial/partner Translation-en [1,556 B]
Get:20 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Get:21 http://security.ubuntu.com/ubuntu xenial-security/universe Translation-en [225 kB]
Get:22 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [7,864 B]
Get:23 http://security.ubuntu.com/ubuntu xenial-security/multiverse Translation-en [2,672 B]
Err:11 https://cli-assets.heroku.com/apt ./ InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6DB5542C356545CF
Get:24 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
Get:25 http://ppa.launchpad.net/git-core/ppa/ubuntu xenial/main amd64 Packages [3,336 B]
Get:26 https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages [21.0 kB]
Get:27 http://archive.ubuntu.com/ubuntu xenial/main Sources [868 kB]
Get:28 http://ppa.launchpad.net/openjdk-r/ppa/ubuntu xenial/main amd64 Packages [16.4 kB]
Get:29 http://archive.ubuntu.com/ubuntu xenial/restricted Sources [4,808 B]
Get:30 http://archive.ubuntu.com/ubuntu xenial/universe Sources [7,728 kB]
Get:31 http://ppa.launchpad.net/openjdk-r/ppa/ubuntu xenial/main Translation-en [2,700 B]
Get:32 http://archive.ubuntu.com/ubuntu xenial/multiverse Sources [179 kB]
Get:33 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages [1,201 kB]
Get:34 http://archive.ubuntu.com/ubuntu xenial/main Translation-en [568 kB]
Get:35 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages [8,344 B]
Get:36 http://archive.ubuntu.com/ubuntu xenial/restricted Translation-en [2,908 B]
Get:37 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [7,532 kB]
Get:38 http://archive.ubuntu.com/ubuntu xenial/universe Translation-en [4,354 kB]
Get:39 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages [144 kB]
Get:40 http://archive.ubuntu.com/ubuntu xenial/multiverse Translation-en [106 kB]
Get:41 http://archive.ubuntu.com/ubuntu xenial-updates/main Sources [537 kB]
Get:42 http://archive.ubuntu.com/ubuntu xenial-updates/restricted Sources [3,608 B]
Get:43 http://archive.ubuntu.com/ubuntu xenial-updates/universe Sources [444 kB]
Get:44 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse Sources [12.3 kB]
Get:45 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [2,049 kB]
Get:46 http://archive.ubuntu.com/ubuntu xenial-updates/main Translation-en [482 kB]
Get:47 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages [10.2 kB]
Get:48 http://archive.ubuntu.com/ubuntu xenial-updates/restricted Translation-en [2,272 B]
Get:49 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [1,219 kB]
Get:50 http://archive.ubuntu.com/ubuntu xenial-updates/universe Translation-en [358 kB]
Get:51 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [22.6 kB]
Get:52 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse Translation-en [8,476 B]
Get:53 http://archive.ubuntu.com/ubuntu xenial-backports/main Sources [6,720 B]
Get:54 http://archive.ubuntu.com/ubuntu xenial-backports/universe Sources [11.0 kB]
Get:55 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [9,812 B]
Get:56 http://archive.ubuntu.com/ubuntu xenial-backports/main Translation-en [4,456 B]
Get:57 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [11.3 kB]
Get:58 http://archive.ubuntu.com/ubuntu xenial-backports/universe Translation-en [4,476 B]
Fetched 32.2 MB in 6s (4,655 kB/s)
Reading package lists... Done
W: GPG error: http://dl.google.com/linux/chrome/deb stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 78BD65473CB3BD13
W: The repository 'http://dl.google.com/linux/chrome/deb stable InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://cli-assets.heroku.com/apt ./ InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6DB5542C356545CF
W: Failed to fetch https://cli-assets.heroku.com/apt/./InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6DB5542C356545CF
W: Some index files failed to download. They have been ignored, or old ones used instead.
debconf: unable to initialize frontend: Dialog
debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.)
debconf: falling back to frontend: Readline
(Reading database ... 136910 files and directories currently installed.)
Preparing to unpack .../apt-transport-https_1.2.35_amd64.deb ...
Unpacking apt-transport-https (1.2.35) over (1.2.31) ...
Setting up apt-transport-https (1.2.35) ...
W: --force-yes is deprecated, use one of the options starting with --allow instead.
deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ xenial main
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 983 100 983 0 0 186 0 0:00:05 0:00:05 --:--:-- 206
OK
Get:1 http://dl.google.com/linux/chrome/deb stable InRelease [1,811 B]
Hit:2 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:3 http://archive.canonical.com/ubuntu xenial InRelease
Ign:1 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:4 http://archive.ubuntu.com/ubuntu xenial InRelease
Hit:5 http://ppa.launchpad.net/git-core/ppa/ubuntu xenial InRelease
Hit:6 https://download.docker.com/linux/ubuntu xenial InRelease
Get:7 https://cli-assets.heroku.com/apt ./ InRelease [2,879 B]
Hit:8 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:9 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
Hit:10 http://ppa.launchpad.net/openjdk-r/ppa/ubuntu xenial InRelease
Err:7 https://cli-assets.heroku.com/apt ./ InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6DB5542C356545CF
Get:11 https://packages.microsoft.com/repos/azure-cli xenial InRelease [3,965 B]
Get:12 https://packages.microsoft.com/repos/azure-cli xenial/main amd64 Packages [15.5 kB]
Fetched 24.1 kB in 31s (758 B/s)
Reading package lists... Done
W: GPG error: http://dl.google.com/linux/chrome/deb stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 78BD65473CB3BD13
W: The repository 'http://dl.google.com/linux/chrome/deb stable InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://cli-assets.heroku.com/apt ./ InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6DB5542C356545CF
W: Failed to fetch https://cli-assets.heroku.com/apt/./InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6DB5542C356545CF
W: Some index files failed to download. They have been ignored, or old ones used instead.