2016-06-10 19:27:57 +02:00
---
layout: "remotestate"
2016-06-10 20:04:40 +02:00
page_title: "Remote State Backend: azure"
sidebar_current: "docs-state-remote-azure"
2016-06-10 19:27:57 +02:00
description: |-
Terraform can store the state remotely, making it easier to version and work with in a team.
---
2016-06-10 20:04:40 +02:00
# azure
2016-06-10 19:27:57 +02:00
Stores the state as a given key in a given bucket on [Microsoft Azure Storage ](https://azure.microsoft.com/en-us/documentation/articles/storage-introduction/ ).
-> **Note:** Passing credentials directly via config options will
make them included in cleartext inside the persisted state.
Use of environment variables or config file is recommended.
## Example Usage
2016-11-10 18:55:15 +01:00
This example follows the recommended approach of storing the access_key in the environment variable `ARM_ACCESS_KEY` .
2016-06-10 19:27:57 +02:00
```
terraform remote config \
2016-06-10 20:04:40 +02:00
-backend=azure \
2016-06-10 19:27:57 +02:00
-backend-config="storage_account_name=terraform123abc" \
-backend-config="container_name=terraform-state" \
-backend-config="key=prod.terraform.tfstate"
```
## Example Referencing
2016-11-10 18:55:15 +01:00
This example follows the recommended approach of storing the access_key in the environment variable `ARM_ACCESS_KEY` .
2016-06-10 19:27:57 +02:00
```hcl
# setup remote state data source
data "terraform_remote_state" "foo" {
2016-06-10 20:04:40 +02:00
backend = "azure"
2016-06-10 19:27:57 +02:00
config {
storage_account_name = "terraform123abc"
container_name = "terraform-state"
key = "prod.terraform.tfstate"
2016-11-10 18:55:15 +01:00
access_key = "< primary or secondary storage account access key > "
2016-06-10 19:27:57 +02:00
}
}
```
## 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
2016-09-20 15:53:34 +02:00
* `access_key` / `ARM_ACCESS_KEY` - (Required) Storage account access key