Skip to content

Instantly share code, notes, and snippets.

@jeremybeavon
Last active July 13, 2019 20:28
Show Gist options
  • Save jeremybeavon/e566b6a0106a90ec7e83cbf3d65b4ed6 to your computer and use it in GitHub Desktop.
Save jeremybeavon/e566b6a0106a90ec7e83cbf3d65b4ed6 to your computer and use it in GitHub Desktop.
Install and run az2tf in a container
export DEBIAN_FRONTEND=noninteractive
apt-get update
# Install git: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
apt-get -y install git-all
# Check out az2tf
cd /home
git clone https://github.com/andyt530/az2tf.git
# Install Azure CLI: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-apt?view=azure-cli-latest
apt-get -y install curl apt-transport-https lsb-release gnupg
curl -sL https://packages.microsoft.com/keys/microsoft.asc | \
gpg --dearmor | \
tee /etc/apt/trusted.gpg.d/microsoft.asc.gpg > /dev/null
AZ_REPO=$(lsb_release -cs)
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | \
tee /etc/apt/sources.list.d/azure-cli.list
apt-get update
apt-get -y install azure-cli
# Install Terraform: https://linoxide.com/linux-how-to/how-to-install-terraform-on-centos-ubuntu/
apt-get -y install wget unzip
wget https://releases.hashicorp.com/terraform/0.12.0/terraform_0.12.0_linux_amd64.zip
unzip ./terraform_0.12.0_linux_amd64.zip -d /usr/local/bin/
# Install jq: https://stedolan.github.io/jq/download/
apt-get -y install jq
# Log into Azure
az login
az account set -s ""
# py-az2tf
export DEBIAN_FRONTEND=noninteractive
cd /home
apt-get update
apt-get -y install wget unzip python python-pip
# Install Azure CLI: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-apt?view=azure-cli-latest
apt-get -y install curl apt-transport-https lsb-release gnupg
curl -sL https://packages.microsoft.com/keys/microsoft.asc | \
gpg --dearmor | \
tee /etc/apt/trusted.gpg.d/microsoft.asc.gpg > /dev/null
AZ_REPO=$(lsb_release -cs)
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | \
tee /etc/apt/sources.list.d/azure-cli.list
apt-get update
apt-get -y install azure-cli
# Install Terraform: https://linoxide.com/linux-how-to/how-to-install-terraform-on-centos-ubuntu/
wget https://releases.hashicorp.com/terraform/0.12.4/terraform_0.12.4_linux_amd64.zip
unzip ./terraform_0.12.4_linux_amd64.zip -d /usr/local/bin/
# Configure python
pip install requests adal
# Download py-az2tf
wget https://github.com/andyt530/py-az2tf/archive/master.zip
unzip ./master.zip -d /home
# Log into Azure
az login
az account set -s ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment