Azure Auth Chain

The Terraspace Azurerm Plugin can authenticate to the Azure REST API via the following mechanisms.

The Terraspace Azurerm Plugin makes use of the armrest gem library to achieve this.

Environment

Terraspace will authenticate to the Azure API with these environment variables:

ARM_CLIENT_ID
ARM_CLIENT_SECRET
ARM_TENANT_ID

MSI: Managed Identity

The armrest library discovers whether or not MSI is available with an initial network call to 169.254.169.254/metadata/instance. So something like this:

curl --connect-timeout 0.5 -H "Metadata: true" "http://169.254.169.254/metadata/instance?api-version=2021-11-01"

Some notes about this metadata endpoint check:

Azure CLI

Terraspace authenticate via the az cli, by essentially calling:

az account get-access-token

More tools: