Azure CLI login helper. You have multiple tenants to login to, but cannot remember the tenant IDs? Azlogin to the rescue!
Functionally & securitywise there is nothing too special; This is just a wrapper for Azure CLI. All the information stored about your tenants is defined below, and all the information is provided by you.
Running the app with the selected tenant will trigger az login flow for the selected tenant, and that's it.
If you have configured select_subscription: true, a Subscription selection will be run after successful login.
Azure CLI v2 is expected to be installed and configured.
Configuration is handled in configuration.yaml
general:
environment: DEV|PROD
logging: true|false
logging_level: INFO|WARNING|ERROR|FATAL
print_config: true|false
features:
azlogin:
tenants:
- tenant_name: "Alpha"
tenant_id: "alpha.onmicrosoft.com"
- tenant_name: "Bravo"
tenant_id: "23456-23456"
select_subscription: true|falseConfiguration file location:
- If the
environmentisDEV:./configuration.yaml. You also need to set environment variableENVIRONMENT=DEV. - If the
environmentisPROD:$HOME/azlogin/configuration.yamlin macOS/Linux and%USERPROFILE%\azlogin\configuration.yamlin Windows.
The app optionally logs to a file ./azlogin.log for DEV and to $HOME/azlogin/azlogin.log in macOS/Linux or %USERPROFILE%\azlogin/azlogin.log in Windows for PROD.
With the binary releases all you need is the configuration file described above and a binary for your platform.
Before installing:
ENVIRONMENT=DEV go run cmd/azlogin/main.goBuild, and installation, must be done where the main package is located.
# To build
cd cmd/azlogin
# For architecture where developed:
go build -o "../../build/azlogin"
# For macOS ARM64
GOARCH=arm64 GOOS=darwin go build -o "../../build/azlogin"
# For Windows AMD64
GOARCH=amd64 GOOS=windows go build -o "../../build/azlogin.exe"There is a little helper script available for installation on macOS & ZSH. To install, run in project root:
# Runs the build too.
./install_azlogin.shThe binary will be installed to location defined in .zshrc:
export PATH="$HOME/go/bin:$PATH"New GitHub Release is created with GoReleaser and GitHub Actions when a new tag is pushed to the repository.
- https://github.com/Azure/azure-sdk-for-go (License: MIT)
- https://github.com/charmbracelet/huh for terminal UI (License: MIT)
- https://github.com/charmbracelet/huh/spinner for terminal UI (License: MIT)
- https://github.com/charmbracelet/lipgloss for terminal UI (License: MIT)
- https://github.com/go-yaml/yaml for reading and writing YAML files (License: MIT & Apache 2.0)
- https://github.com/natefinch/lumberjack for logging (License: MIT)