Setup
Getting an Azure subscription is a good start. Then you can run through this page to set up your laptop ready for many of the labs on the Citadel site.
GitHub
If you do not have a GitHub ID already then sign up.
MacOS or Linux
If you are working on MacOS or a Linux distro then you can just use Bash in your preferred terminal. Skip the WSL step and install the binaries.
Windows 10
We recommend using the Windows Subsystem for Linux (WSL) and installing the binaries into linux rather than at the Windows OS level. This page assumes that you will take that route.
If your personal preference is to work within Windows and to use PowerShell then we understand. You can install both git and az at the OS level instead and then skip to vscode. However you should be aware that you won’t be able to use some of the examples in the labs as they are based on Ubuntu 20.04 running in WSL and use pipelines in Bash.
If you have no preference on a distro then we recommend Ubuntu 20.04. Where the prereqs mention installing into Ubuntu then this assumes WSL.
Binaries
Install
- git
- jq
- tree
- stress
E.g., for Ubuntu/Debian:
sudo apt update && sudo apt install jq git tree stress
Includes WSL. Use equivalent yum or zypper commands on other distros.
Checks:
git
jq --help
tree ~
stress
You may want to add
export JQ_COLORS="1;90:0;35:0;35:0;91:0;33:1;37:1;37"
to your ~/.bashrc file to improve the colours.
Azure CLI
You will need the Azure CLI.
Checks:
az version
az login
az account show --output jsonc
az account show --output json | jq -r .user.name
Windows Terminal
For standard CLI use we favour the Windows Terminal on Windows 10. It will pick up on all of your WSL distros as well as creating profiles for Command Prompt, PowerShell and Cloud Shell.
Visual Studio Code
Visual Studio Code (vscode) is assumed as our default IDE.
Remote Development in WSL
For Windows 10 WSL users only. All others can skip.
Integrate vscode with WSL so you can use the application as a front end which connects to the vscode engine running. Install the Remote Development for WSL and then open from the subsystem.
-
Install the Remote Development extension pack
CTRL
+SHIFT
+X
to bring up Extensions- Search on
ms-vscode-remote.vscode-remote-extensionpack
and install
-
Close vscode
-
Open Ubuntu in Windows Terminal
-
Type
code .
to open up vscode with the extension, installing the vscode-engine.
Check:
-
Is “WSL: <distro>” shown at the bottom left?
-
Open Source Control (
CTRL
+SHIFT
+G
) -
Click on the ellipsis (…) at the top of the sidebar
-
Click on Show Git Output
-
Does the top of the output look similar to this?
Looking for git in: git Using git 2.25.1 from git
Visual Studio Code Extensions
-
Install additional extensions
Use the shortcodes to quickly find the right extension. Some will install into the front end and some directly into WSL.
Extension Shortcode Azure Account ms-vscode.azure-account Azure Resource Manager tools msazurermtools.azurerm-vscode-tools Azure Policy azurepolicy.azurepolicyextension Hashicorp Terraform hashicorp.terraform JSON Tools eriklynd.json-tools Live Share ms-vsliveshare.vsliveshare
Terraform
You can either install it manually or using the provided script.
- Manual
- Download Terraform
- Move the binary to a directory
- Make it executable
- Ensure the directory is in your path
– or –
-
Scripted
Use the following command on Ubuntu to install into /usr/local/bin:
curl -sSL https://aka.ms/hashicorp/install.sh | sudo -E bash -s terraform
The script uses sudo so you will be prompted for your password. (Unless you have set /etc/sudoers for passwordless sudo.)
Check:
terraform --version
Packer
The install process is the same for Packer as it is for Terraform.
- Manual
- Download Packer
- Move the binary to a directory
- Make it executable
- Ensure the directory is in your path
– or –
-
Scripted
Use the following command on Ubuntu to install into /usr/local/bin:
curl -sSL https://aka.ms/hashicorp/install.sh | sudo -E bash -s packer
Check:
packer --version
Ansible
Ansible is used in a few of the labs. per the Ansible docs, Ansible on Azure is installed using the Python installer, pip. It is preinstalled in the Cloud Shell’s container image.
-
Install PIP
sudo apt update && sudo apt install -y python3-pip
-
Install Ansible
pip3 install ansible[azure]
The remaining steps are option if you are familiar with Ansible and wish to configure it yourself. If you would like a default config then feel free to continue.
-
Create the ansible config file and directory structure
umask 022 cat << ANSIBLE_CFG > ~/.ansible.cfg [defaults] inventory = ~/ansible/hosts roles_path = ~/ansible/roles deprecation_warnings=False nocows = 1 ANSIBLE_CFG mkdir -pm 755 ~/ansible/roles && cd ~/ansible cat << ANSIBLE_HOSTS > ~/ansible/hosts [localhost] 127.0.0.1 ANSIBLE_HOSTS
-
Install the Ansible collection for Azure
ansible-galaxy collection install azure.azcollection
-
Install Azure modules
wget https://raw.githubusercontent.com/ansible-collections/azure/dev/requirements-azure.txt sudo pip3 install -r requirements-azure.txt
PowerShell
Most of this site has a slight bias towards OSS technologies rather than traditional Windows Server and PowerShell. Most Linux users will prefer to use the Azure CLI. Having said that, it is always useful to have the PowerShell Az module installed as there are some operations that can only be achieved with PowerShell cmdlets. The good news is that PowerShell and the PowerShell Az module are cross platform.
Help us improve
Azure Citadel is a community site built on GitHub, please contribute and send a pull request
Make a change