terraform/website/source/docs/backends/types/azure.html.md

1.6 KiB

layout page_title sidebar_current description
backend-types Backend Type: azure docs-backends-types-standard-azure Terraform can store state remotely in Azure Storage.

azure

Kind: Standard (with no locking)

Stores the state as a given key in a given bucket on Microsoft Azure Storage.

Example Configuration

terraform {
  backend "azure" {
    storage_account_name = "abcd1234"
    container_name       = "tfstate"
    key                  = "prod.terraform.tfstate"
  }
}

Note that for the access credentials we recommend using a partial configuration.

Example Referencing

# setup remote state data source
data "terraform_remote_state" "foo" {
  backend = "azure"
  config {
    storage_account_name = "terraform123abc"
    container_name       = "terraform-state"
    key                  = "prod.terraform.tfstate"
  }
}

Configuration variables

The following configuration options are supported:

  • storage_account_name - (Required) The name of the storage account
  • container_name - (Required) The name of the container to use within the storage account
  • key - (Required) The key where to place/look for state file inside the container
  • access_key / ARM_ACCESS_KEY - (Required) Storage account access key
  • lease_id / ARM_LEASE_ID - (Optional) If set, will be used when writing to storage blob.
  • environment / ARM_ENVIRONMENT - (Optional) The cloud environment to use. Supported values are:
    • public (default)
    • usgovernment
    • german
    • china