Customizing Azure Cloud Shell with Zsh and Fish for use with Terraform, Git and Kubernetes
We’ll go over customizing your Azure Cloud Shell in a way that helps you get things done on a daily basis in vim, git, terraform and kubernetes.
Azure Cloud shell is super handy because you can get to it over the web, it stores your settings, and if set up correctly, can allow for resumable sessions!
Note that you can also load it from VS Code / VS Codium in the console area – which we’ll cover at the very end <3
Custom Browser Font
First, you’ll need a proper font for your browser. In my case, Chromium at the moment, but Firefox is similar. Essentially we’ll be adding a patched font to the browser so that we can use it when we’re in the web version of Azure’s Cloud Shell. I use Nerd Fonts, but there’s also Powerline fonts. If you need something to help make up your mind: NerdFonts are generally larger in memory but also contain many more symbols. Powerline fonts are smaller.
In chrome://settings/fonts set the monospaced font to your downloaded patched font. You can try a few if you feel like the symbols aren’t great. I use Ubuntu Mono.
Chrome font settings screen:
Chrome Font Settings Screen Shot
Selecting Ubuntu Mono from the list:
Ubuntu Mono Font Selection Screenshot macOS 10.15
Ubuntu Mono Screenshot from nerdftons.com
Preview of Ubuntu Mono:
Ubuntu Mono Font Preview From https://app.programmingfonts.org/#ubuntu
Test your new font with:
curl https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/bin/scripts/test-fonts.sh | bash - | more
curl https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/bin/scripts/test-fonts.sh | bash - | more
Linuxbrew / Homebrew
Now let’s install homebrew with:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
Press RETURN to continue or any other key to abort
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
==> This script will install:
/home/linuxbrew/.linuxbrew/bin/brew
/home/linuxbrew/.linuxbrew/share/doc/homebrew
/home/linuxbrew/.linuxbrew/share/man/man1/brew.1
/home/linuxbrew/.linuxbrew/share/zsh/site-functions/_brew
/home/linuxbrew/.linuxbrew/etc/bash_completion.d/brew
/home/ryan/.cache/Homebrew/
/home/linuxbrew/.linuxbrew/Homebrew
==> The following new directories will be created:
/home/linuxbrew/.linuxbrew/bin
/home/linuxbrew/.linuxbrew/etc
/home/linuxbrew/.linuxbrew/include
/home/linuxbrew/.linuxbrew/lib
/home/linuxbrew/.linuxbrew/sbin
/home/linuxbrew/.linuxbrew/share
/home/linuxbrew/.linuxbrew/var
/home/linuxbrew/.linuxbrew/opt
/home/linuxbrew/.linuxbrew/share/zsh
/home/linuxbrew/.linuxbrew/share/zsh/site-functions
/home/linuxbrew/.linuxbrew/var/homebrew
/home/linuxbrew/.linuxbrew/var/homebrew/linked
/home/linuxbrew/.linuxbrew/Cellar
/home/linuxbrew/.linuxbrew/Caskroom
/home/linuxbrew/.linuxbrew/Homebrew
/home/linuxbrew/.linuxbrew/Frameworks
Press RETURN to continue or any other key to abort
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
==> This script will install:
/home/linuxbrew/.linuxbrew/bin/brew
/home/linuxbrew/.linuxbrew/share/doc/homebrew
/home/linuxbrew/.linuxbrew/share/man/man1/brew.1
/home/linuxbrew/.linuxbrew/share/zsh/site-functions/_brew
/home/linuxbrew/.linuxbrew/etc/bash_completion.d/brew
/home/ryan/.cache/Homebrew/
/home/linuxbrew/.linuxbrew/Homebrew
==> The following new directories will be created:
/home/linuxbrew/.linuxbrew/bin
/home/linuxbrew/.linuxbrew/etc
/home/linuxbrew/.linuxbrew/include
/home/linuxbrew/.linuxbrew/lib
/home/linuxbrew/.linuxbrew/sbin
/home/linuxbrew/.linuxbrew/share
/home/linuxbrew/.linuxbrew/var
/home/linuxbrew/.linuxbrew/opt
/home/linuxbrew/.linuxbrew/share/zsh
/home/linuxbrew/.linuxbrew/share/zsh/site-functions
/home/linuxbrew/.linuxbrew/var/homebrew
/home/linuxbrew/.linuxbrew/var/homebrew/linked
/home/linuxbrew/.linuxbrew/Cellar
/home/linuxbrew/.linuxbrew/Caskroom
/home/linuxbrew/.linuxbrew/Homebrew
/home/linuxbrew/.linuxbrew/Frameworks
Press RETURN to continue or any other key to abort
Warning: /home/linuxbrew/.linuxbrew/bin is not in your PATH.
==> Downloading https://linuxbrew.bintray.com/bottles-portable-ruby/portable-ruby-2.6.3.x86_64_linux.bottle.tar.gz
######################################################################## 100.0%
==> Pouring portable-ruby-2.6.3.x86_64_linux.bottle.tar.gz
==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
https://github.com/Homebrew/brew#donations
==> Tapping homebrew/core
Cloning into '/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core'...
remote: Enumerating objects: 5155, done.
remote: Counting objects: 100% (5155/5155), done.
remote: Compressing objects: 100% (4952/4952), done.
remote: Total 5155 (delta 48), reused 300 (delta 6), pack-reused 0
Receiving objects: 100% (5155/5155), 4.37 MiB | 0 bytes/s, done.
Resolving deltas: 100% (48/48), done.
Checking connectivity... done.
Tapped 3 commands and 4933 formulae (5,196 files, 13.6MB).
Already up-to-date.
==> Installation successful!
==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
https://docs.brew.sh/Analytics
==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
https://github.com/Homebrew/brew#donations
==> Next steps:
- Install the Homebrew dependencies if you have sudo access:
Debian, Ubuntu, etc.
sudo apt-get install build-essential
Fedora, Red Hat, CentOS, etc.
sudo yum groupinstall 'Development Tools'
See https://docs.brew.sh/linux for more information.
- Configure Homebrew in your ~/.profile by running
echo 'eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)' >>~/.profile
- Add Homebrew to your PATH
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
- We recommend that you install GCC by running:
brew install gcc
- Run `brew help` to get started
- Further documentation:
https://docs.brew.sh
Warning: /home/linuxbrew/.linuxbrew/bin is not in your PATH.
==> Downloading https://linuxbrew.bintray.com/bottles-portable-ruby/portable-ruby-2.6.3.x86_64_linux.bottle.tar.gz
######################################################################## 100.0%
==> Pouring portable-ruby-2.6.3.x86_64_linux.bottle.tar.gz
==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
https://github.com/Homebrew/brew#donations
==> Tapping homebrew/core
Cloning into '/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core'...
remote: Enumerating objects: 5155, done.
remote: Counting objects: 100% (5155/5155), done.
remote: Compressing objects: 100% (4952/4952), done.
remote: Total 5155 (delta 48), reused 300 (delta 6), pack-reused 0
Receiving objects: 100% (5155/5155), 4.37 MiB | 0 bytes/s, done.
Resolving deltas: 100% (48/48), done.
Checking connectivity... done.
Tapped 3 commands and 4933 formulae (5,196 files, 13.6MB).
Already up-to-date.
==> Installation successful!
==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
https://docs.brew.sh/Analytics
==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
https://github.com/Homebrew/brew#donations
==> Next steps:
- Install the Homebrew dependencies if you have sudo access:
Debian, Ubuntu, etc.
sudo apt-get install build-essential
Fedora, Red Hat, CentOS, etc.
sudo yum groupinstall 'Development Tools'
See https://docs.brew.sh/linux for more information.
- Configure Homebrew in your ~/.profile by running
echo 'eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)' >>~/.profile
- Add Homebrew to your PATH
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
- We recommend that you install GCC by running:
brew install gcc
- Run `brew help` to get started
- Further documentation:
https://docs.brew.sh
Warning: /home/linuxbrew/.linuxbrew/bin is not in your PATH.
brew install terraform ansible azure-cli ripgrep exa bat fzf zsh fish tmux mc curl coreutils
brew install terraform ansible azure-cli ripgrep exa bat fzf zsh fish tmux mc curl coreutils
brew install terraform ansible azure-cli ripgrep exa bat fzf zsh fish tmux mc curl coreutils
Git
Now we can proceed to add the tools we’ll need. I’ll try to categorize them so that you don’t end up with stuff you don’t want. Remember: though this can be your primary console with some work-arounds, most likely you’ll want to make this set up portable in your dotfiles and sync things via git. We’ll start there:
You can see from the prompt we’re in the master branch!
Git bash Prompt With Branch in PS1
Sample git prompts (oh-my-fish and oh-my-zsh are defaults, rainbowbrite used for bash-it, in order):
Custom Shells
I’d recommend not modifying the bash shell too much as it’s our default, and there’s no way to change it at present. Similarly, though we can install a new bash shell version, we need to chain-load it in order to have it auto-load. That being said, you probably won’t need a bash that’s up to date at this point.
Other helpers
For the Fish fan: Oh-my-fish (make sure fish is already installed via brew install fish)
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
curl -L https://get.oh-my.fish | fish
curl -L https://get.oh-my.fish | fish
curl -L https://get.oh-my.fish | fish
For the original zshers, or those that are ok with the new macOS default: oh-my-zsh (note: changing the default shell will fail because we don’t have a password )
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"