Skip to content

Instantly share code, notes, and snippets.

@rmetzler
Created April 24, 2019 11:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmetzler/0241998ece8edad455c0a974e8ec7878 to your computer and use it in GitHub Desktop.
Save rmetzler/0241998ece8edad455c0a974e8ec7878 to your computer and use it in GitHub Desktop.
use fzf to switch between azure accounts
function faz() {
az account set --subscription $(az account list -o table | fzf | cut -c '62-98')
az account show
}
@hansbogert
Copy link

Above doesn't work anymore. It's quite brittle to use exact indexes like the 62-98.

The following is more future-proof I think.

#!/bin/bash

set -ue

az account set --subscription $(az account list -o tsv | cut -d '	' -f3,6 | fzf | cut -d '	' -f1)
az account show -o yamlc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment