# Azure Terraform state lock

This lab provisions a uniquely named Azure resource group, storage account and
private blob container with Terraform. A separate Terraform configuration uses
one blob for remote state. The lab then deliberately acquires a real Azure blob
lease, causing Terraform's next plan to fail to acquire its state lock.

This is a **known lab-held lease**, not a crashed Terraform process or a stale
Terraform-generated lock. Release only the lease created by this exercise.
Never disable locking, break leases or force-unlock an active production run.
Do not add containers or blobs to the lab account. Teardown refuses unexpected
resources or data, and removes the lab state blob and storage account.

Azure Storage and transactions can incur charges. Use an isolated subscription
with known safe guardrails and clean up promptly. The storage endpoint is
publicly reachable using account credentials, but anonymous blob access is
disabled. The account key, Terraform state, plans and lease ID are sensitive;
use a private Linux filesystem and never publish them.

Install Azure CLI, Terraform 1.5+, Python 3 and Bash on Linux. Log in and select
the intended subscription. `Microsoft.Resources` and `Microsoft.Storage` must
already be registered, and your identity must be able to read storage account
keys. The Blob endpoint must be reachable.

```sh
export AZURE_SUBSCRIPTION_ID="your-subscription-id"
./setup.sh "$AZURE_SUBSCRIPTION_ID" northeurope --accept-costs
./lab.sh plan
./lab.sh status
```

Inspect the failure and the lab-owned holder before releasing it. Use
`./lab.sh` without arguments for the available lab-only commands, then run
`./verify.sh` and `./teardown.sh`. Teardown releases only this lab's recorded
lease and checks identity, contents and the Terraform destroy plan. It retains
private state on failure and after cleanup; confirm the group is absent before
removing `.lab-state`.
