crabbox azure groups Azure provider setup commands. It currently has a single
subcommand, azure login, which captures your Azure subscription details into
the user config so direct-mode Azure leases work without exporting AZURE_*
environment variables on every invocation.
crabbox azure login detects the active Azure subscription from the local az
CLI, validates that credentials can acquire a management-plane token, and stores
the subscription, tenant, and location in the user config.
- Install the Azure CLI (
azmust be on yourPATH). - Run
az loginand select the subscription you want Crabbox to use.
# Use the active az CLI subscription and the default location (eastus):
crabbox azure login
# Pick a specific subscription by ID or name:
crabbox azure login --subscription 00000000-0000-0000-0000-000000000000
# Pick a specific location:
crabbox azure login --location westus2
# Emit JSON for scripting:
crabbox azure login --jsonAfter login succeeds, crabbox warmup --provider azure and
crabbox run --provider azure -- <command> work immediately.
--subscription <id|name> Azure subscription ID or name (default: active az CLI subscription)
--location <location> Azure location for provisioning (default: eastus)
--json Print JSON output
- Runs
az account show(with--subscriptionwhen you pass--subscription) to read the subscription ID, tenant ID, and subscription name. - Validates that
DefaultAzureCredentialcan acquire a token for the Azure Resource Manager scope (https://management.azure.com/.default). If this fails, runaz loginand retry. - Writes
azure.subscriptionId,azure.tenantId, andazure.locationto the writable user config file (for example~/.config/crabbox/config.yaml). - Sets
provider: azureonly when no default provider is already configured.
JSON output (--json) includes subscription, tenant, name, location,
and configPath.
Running crabbox azure login is the recommended way to persist configuration,
but it is not strictly required. When a direct Azure command starts and no
subscription is set in config or the environment, Crabbox falls back to
az account show at runtime to detect the subscription (and tenant). This lets
az login plus crabbox warmup --provider azure work with zero extra setup. A
location is still required: set azure.location, pass --location, or export
CRABBOX_AZURE_LOCATION.
azure login only stores subscription, tenant, and location — it never stores
secrets. At provision time Crabbox authenticates with DefaultAzureCredential,
or with a client-secret credential when azure.tenantId, azure.clientId, and
the AZURE_CLIENT_SECRET environment variable are all present.
Equivalent values can also come from the environment instead of config:
CRABBOX_AZURE_SUBSCRIPTION_ID (or AZURE_SUBSCRIPTION_ID),
CRABBOX_AZURE_TENANT_ID (or AZURE_TENANT_ID),
CRABBOX_AZURE_CLIENT_ID (or AZURE_CLIENT_ID), and CRABBOX_AZURE_LOCATION.