Skip to content

Latest commit

 

History

History
135 lines (90 loc) · 2.45 KB

File metadata and controls

135 lines (90 loc) · 2.45 KB

azswitch

A TUI application for switching Azure tenants, directories, and subscriptions.

Demo

Features

  • Interactive TUI - Navigate with keyboard (vim-style j/k or arrows)
  • View Current Account - See active user, tenant, and subscription
  • Switch Subscriptions - Quick selection from available subscriptions
  • Switch Tenants - Re-authenticate to a different Azure AD tenant
  • CLI Mode - Non-interactive flags for scripting

Installation

Homebrew (macOS/Linux)

brew install l2D/tap/azswitch

Go Install

go install github.com/l2D/azswitch/cmd/azswitch@latest

Binary Download

Download the latest release from GitHub Releases.

Docker

docker pull ghcr.io/l2d/azswitch

Running with existing Azure credentials

Mount your local Azure CLI configuration:

docker run --rm -it -v ~/.azure:/home/azswitch/.azure ghcr.io/l2d/azswitch

Running with CLI flags

# Show current account
docker run --rm -v ~/.azure:/home/azswitch/.azure ghcr.io/l2d/azswitch --current

# List subscriptions
docker run --rm -v ~/.azure:/home/azswitch/.azure ghcr.io/l2d/azswitch --list

Interactive shell with Azure CLI

To access the container shell with Azure CLI:

docker run --rm -it -v ~/.azure:/home/azswitch/.azure --entrypoint /bin/sh ghcr.io/l2d/azswitch

Building locally

docker build -t azswitch .
docker run --rm -it -v ~/.azure:/home/azswitch/.azure azswitch

Prerequisites

  • Azure CLI must be installed
  • Must be logged in (az login)

Usage

Interactive Mode (Default)

azswitch

CLI Flags

# Show current account
azswitch --current

# List all subscriptions
azswitch --list

# Switch to subscription by name or ID
azswitch --subscription "My Subscription"
azswitch --subscription xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

# Switch to a different tenant
azswitch --tenant xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Key Bindings

Key Action
j / Down Move cursor down
k / Up Move cursor up
Enter Select item
Tab Switch between subscriptions/tenants view
? Toggle help
q / Ctrl+C Quit

Development

Build

make build

Test

make test

Lint

make lint

License

MIT