Azure Backend
The Azure backend stores state as a blob in Azure Blob Storage with optional blob snapshotting and state locking.Implementation
Location:/internal/backend/remote-state/azure/backend.go
Use Cases
- Managing Azure infrastructure
- Team collaboration on Azure projects
- Integration with Azure DevOps pipelines
- Compliance requirements for Azure data residency
Basic Configuration
Required Configuration
storage_account_name
- Type: String
- Required: Yes
- Description: The name of the Azure Storage Account
container_name
- Type: String
- Required: Yes
- Description: The name of the blob container within the Storage Account
key
- Type: String
- Required: Yes
- Description: The name of the blob used to store the Terraform state
Optional Configuration
resource_group_name
- Type: String
- Optional: Yes
- Description: The Resource Group where the Storage Account is located
- Note: Required if using access key lookup or
lookup_blob_endpoint
subscription_id
- Type: String
- Optional: Yes
- Environment Variable:
ARM_SUBSCRIPTION_ID - Description: The Subscription ID where the Storage Account is located
lookup_blob_endpoint
- Type: Boolean
- Optional: Yes
- Default:
false - Environment Variable:
ARM_USE_DNS_ZONE_ENDPOINT - Description: Whether to look up the storage account blob endpoint (necessary for Azure DNS zone endpoints)
snapshot
- Type: Boolean
- Optional: Yes
- Default:
false - Environment Variable:
ARM_SNAPSHOT - Description: Whether to enable automatic blob snapshotting
Authentication Methods
The Azure backend supports multiple authentication methods:1. Storage Access Key
ARM_ACCESS_KEY
2. SAS Token
ARM_SAS_TOKEN
3. Azure Active Directory (Service Principal)
Client Secret
ARM_TENANT_IDARM_CLIENT_IDARM_CLIENT_SECRETARM_USE_AZUREAD
Client Certificate
ARM_CLIENT_CERTIFICATE_PATHARM_CLIENT_CERTIFICATE_PASSWORDARM_CLIENT_CERTIFICATE(base64-encoded PKCS#12)
4. OpenID Connect (OIDC)
- use_oidc - Enable OIDC authentication
- oidc_token - OIDC ID token
- oidc_token_file_path - Path to OIDC token file
- oidc_request_token - Bearer token for OIDC provider request
- oidc_request_url - URL for OIDC provider
- ado_pipeline_service_connection_id - Azure DevOps service connection ID
ARM_USE_OIDCARM_OIDC_TOKENARM_OIDC_TOKEN_FILE_PATHARM_OIDC_REQUEST_TOKEN/ACTIONS_ID_TOKEN_REQUEST_TOKEN/SYSTEM_ACCESSTOKENARM_OIDC_REQUEST_URL/ACTIONS_ID_TOKEN_REQUEST_URL/SYSTEM_OIDCREQUESTURI
5. Managed Identity
ARM_USE_MSIARM_MSI_ENDPOINT(custom endpoint)
6. Azure CLI
ARM_USE_CLI (defaults to true)
7. AKS Workload Identity
ARM_USE_AKS_WORKLOAD_IDENTITY
Cloud Environments
environment
- Type: String
- Optional: Yes
- Default:
"public" - Environment Variable:
ARM_ENVIRONMENT - Valid Values:
public,usgovernment,china - Description: The Azure cloud environment
metadata_host
- Type: String
- Optional: Yes
- Environment Variables:
ARM_METADATA_HOSTNAME,ARM_METADATA_HOST - Description: Hostname for Azure Metadata Service (custom cloud environments)
environment when using metadata_host.