-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_az_cli_ubuntu.sh
29 lines (21 loc) · 1.09 KB
/
install_az_cli_ubuntu.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# Check if the Azure CLI is already installed
if command -v az &>/dev/null; then
echo "Azure CLI is already installed."
else
# Update the package list
sudo apt update
# Install required dependencies
sudo apt install -y ca-certificates curl apt-transport-https lsb-release gnupg
# Download and install the Microsoft signing key
# curl -sL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/microsoft-archive-keyring.
curl -sL https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o /usr/share/keyrings/microsoft-archive-keyring.gpg
# Add the Azure CLI repository to the APT sources list
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/microsoft-archive-keyring.gpg] https://packages.microsoft.com/repos/azure-cli $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/azure-cli.list
# Update the package list again to include the Azure CLI repository
sudo apt update
# Install the Azure CLI
sudo apt install -y azure-cli
# Verify the Azure CLI installation
az --version
fi