azctx

command module
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 6 Imported by: 0

README

azctx

Last Commit Open Issues

A CLI tool for managing Azure CLI contexts, modelled after kubectx. It maintains a composable config file that maps named contexts to a tenant, credential, and optional subscription. azctx use <name> switches the active context and syncs your Azure CLI session instantly:

azctx demo

Installation

Homebrew
brew install lvlcn-t/tap/azctx
go install

Requires Go 1.26+ and the GOEXPERIMENT=jsonv2 flag:

GOEXPERIMENT=jsonv2 go install github.com/lvlcn-t/azctx@latest
Manual

Download the archive for your platform from the releases page, extract the binary, and place it on your PATH.

Linux / macOS:

OS=$(uname -s)
ARCH=$(uname -m | sed 's/aarch64/arm64/')
curl -sL "https://github.com/lvlcn-t/azctx/releases/latest/download/azctx_${OS}_${ARCH}.tar.gz" \
  | tar -xz -C ~/.local/bin azctx
chmod +x ~/.local/bin/azctx

Windows (PowerShell):

$arch = if ($env:PROCESSOR_ARCHITECTURE -eq "AMD64") { "x86_64" } else { "arm64" }
$url = "https://github.com/lvlcn-t/azctx/releases/latest/download/azctx_Windows_$arch.zip"
Invoke-WebRequest $url -OutFile azctx.zip
Expand-Archive azctx.zip -DestinationPath .
Move-Item azctx.exe "$env:LOCALAPPDATA\Microsoft\WindowsApps\azctx.exe"
Container Image

Pre-built images are published to GitHub Container Registry:

docker pull ghcr.io/lvlcn-t/azctx:latest
docker run --rm \
  -v ~/.config/azctx:/home/nonroot/.config/azctx \
  -v ~/.azure:/home/nonroot/.azure \
  ghcr.io/lvlcn-t/azctx:latest use dev-west

Available tags: latest, vMAJOR, vMAJOR.MINOR, and full semver.

Quick start

Create a minimal config at ~/.config/azctx/config.yaml:

apiVersion: azctx.lvlcn-t.dev/v1alpha1
kind: Config

tenants:
  - name: dev
    id: 00000000-0000-0000-0000-000000000000

credentials:
  - name: personal
    credential:
      type: user

contexts:
  - name: dev
    context:
      tenant: dev
      credential: personal

Then switch to it:

azctx use dev        # opens browser for login, sets subscription
azctx current        # prints "dev"
azctx list -o table  # show all contexts

For a more detailed guide, see the Usage documentation and the example config.

Documentation

Guide Description
Configuration Config file format, credential types, Key Vault references
Workload Identity OIDC federation — OAuth2 PKCE and file-based tokens
Usage All commands, output formats, typical workflows
CLI Reference Auto-generated command documentation
Contributing Development setup, testing, PR guidelines

License

Copyright (c) 2026 lvlcn-t. Licensed under the MIT License.

Code of Conduct

This project has adopted the Contributor Covenant v2.1. All contributors must abide by the code of conduct.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package az provides integrations with the Azure CLI.
Package az provides integrations with the Azure CLI.
Package cmd contains the command-line interface (CLI) commands for the azctx CLI.
Package cmd contains the command-line interface (CLI) commands for the azctx CLI.
Package config provides loading, merging, validating, and writing azctx config.
Package config provides loading, merging, validating, and writing azctx config.
internal
gendemo command
Package main generates docs/demo.gif by rendering demo.tape.tmpl with a temporary mock config and invoking vhs(1).
Package main generates docs/demo.gif by rendering demo.tape.tmpl with a temporary mock config and invoking vhs(1).
gendoc command
Package main generates CLI reference documentation into docs/reference/.
Package main generates CLI reference documentation into docs/reference/.
Package keyvault resolves keyvault:// URI references to their secret or certificate values using Azure SDK and ambient credentials.
Package keyvault resolves keyvault:// URI references to their secret or certificate values using Azure SDK and ambient credentials.
Package output provides shared renderers for text, table, and JSON output.
Package output provides shared renderers for text, table, and JSON output.
Package semver provides utilities for working with semantic versions.
Package semver provides utilities for working with semantic versions.
tui
wif
Package wif provides federated identity token acquisition for Azure workload identity login.
Package wif provides federated identity token acquisition for Azure workload identity login.
factory
Package factory creates wif.Provider instances based on credential configuration.
Package factory creates wif.Provider instances based on credential configuration.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL