Small CLI to quickly switch Azure Subscriptions and Kubenetes contexts all at once with fuzzy search
Files
README.md

az-kube-switch #

Stop doing az logout, az login and kubectl config use-context all the time. Pick your Azure Subscription and kubectl context all at once, with fuzzy search.

demo.gif

Install #

Run the following command to automatically verify requirements, install fzf (via apt if missing and available), install akswitch to /opt/akswitch, and configure your shell PATH:

bash <(curl -fsSL https://tangled.org/chrismin13.com/akswitch/raw/main/install.sh)

After the script finishes, reload your shell configuration:

source ~/.bashrc
# Or if you are using zsh:
source ~/.zshrc

Manual Install #

If you prefer to install it manually:

  1. Ensure all requirements are met:
    # On Ubuntu/Debian (for fzf):
    sudo apt update
    sudo apt install -y fzf
    # Ensure az and kubectl are also installed.
    
  2. Clone this repository or download the akswitch script.
  3. Add a wrapper function to your shell configuration (e.g. ~/.bashrc):
    akswitch() {
        /path/to/cloned/akswitch "$@"
    }
    
  4. Reload your configuration:
    source ~/.bashrc
    

Usage #

akswitch