Starter template with Terraform as infrastructure provider for Azure Developer CLI (azd).
24
stars
17
commits
HCL
primary language
Mar 27, 2026
updated
A starter blueprint for getting your application up on Azure using Azure Developer CLI (azd). Add your application code, write Infrastructure as Code assets in Terraform to get your application up and running quickly.
Terraform (>= 1.1.7)
# macOS
brew install terraform
# Windows
winget install Hashicorp.Terraform
# Linux (Ubuntu/Debian)
sudo apt-get update && sudo apt-get install -y gnupg software-properties-common
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update && sudo apt install terraform
Azure CLI
# macOS
brew install azure-cli
# Windows
winget install Microsoft.AzureCLI
# Linux
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
Azure Developer CLI (azd)
# macOS
brew install azure-dev
# Windows
winget install Microsoft.Azd
# Linux
curl -fsSL https://aka.ms/install-azd.sh | bash
# Login to Azure CLI (required for Terraform auth)
az login
# Set your subscription
az account set --subscription "<YOUR_SUBSCRIPTION_ID>"
# Verify current subscription
az account show --query "{name:name, id:id, tenantId:tenantId}"
This template uses AzureRM Provider 4.x with the following key features:
| Setting (3.x) | Setting (4.x) |
|---|---|
skip_provider_registration = true | resource_provider_registrations = "none" |
For full migration guide, see: AzureRM 4.0 Upgrade Guide
├── azure.yaml # AZD project configuration
├── infra/
│ ├── provider.tf # Provider configuration (azurerm ~>4.21)
│ ├── main.tf # Main infrastructure
│ ├── variables.tf # Input variables
│ ├── output.tf # Output values
│ └── core/ # Reusable modules
│ ├── database/ # CosmosDB, PostgreSQL
│ ├── gateway/ # API Management
│ ├── host/ # App Service, App Service Plans
│ ├── monitor/ # Application Insights, Log Analytics
│ └── security/ # Key Vault
└── .devcontainer/ # Dev container with tools pre-installed
The following assets have been provided:
infra directory that demonstrate how to provision resources and setup resource tagging for azd..devcontainer directory that installs infrastructure tooling by default. This can be readily used to create cloud-hosted developer environments such as GitHub Codespaces..github directory, and Azure Pipelines under the .azdo directory that work for most use-cases.# Initialize azd environment
azd init
# Validate Terraform configuration
cd infra && terraform init && terraform validate && cd ..
# Provision Azure resources
azd provision
# Deploy application (if services configured)
azd deploy
# Or do both at once
azd up
Note: For
functionservices, it is recommended to initialize the project using the provided quickstart tools.
azure.yaml to reference the source code projects.azd package to validate that all service source code projects can be built and packaged locally.Update or add Terraform modules to provision the relevant Azure resources. This can be done incrementally, as the list of Azure resources are explored and added.
Run azd provision whenever you want to ensure that changes made are applied correctly and work as expected.
Certain changes to Terraform modules or deployment manifests are required to tie in application and infrastructure together. For example:
For more details, see additional details below.
When changes are made, use azd to apply your changes in Azure and validate that they are working as expected:
azd up to validate both infrastructure and application code changes.azd deploy to validate application code changes.Finally, run azd up to run the end-to-end infrastructure provisioning (azd provision) and deployment (azd deploy) flow. Visit the service endpoints listed to see your application up-and-running!
The following section examines different concepts that help tie in application and infrastructure.
It is recommended to have application settings managed in Azure, separating configuration from code. Typically, the service host allows for application settings to be defined.
appservice and function, application settings should be defined on the Terraform resource for the targeted host. Reference template example here.aks, application settings are applied using deployment manifests under the <service>/manifests folder. Reference template example here.Managed identities allows you to secure communication between services. This is done without having the need for you to manage any credentials.
Azure Key Vault allows you to store secrets securely. Your application can access these secrets securely through the use of managed identities.
For appservice, the following host configuration options are often modified:
HCL
100.0%
Starter template with Terraform as infrastructure provider for Azure Developer CLI (azd).
24
stars
17
commits
HCL
primary language
Mar 27, 2026
updated
A starter blueprint for getting your application up on Azure using Azure Developer CLI (azd). Add your application code, write Infrastructure as Code assets in Terraform to get your application up and running quickly.
Terraform (>= 1.1.7)
# macOS
brew install terraform
# Windows
winget install Hashicorp.Terraform
# Linux (Ubuntu/Debian)
sudo apt-get update && sudo apt-get install -y gnupg software-properties-common
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update && sudo apt install terraform
Azure CLI
# macOS
brew install azure-cli
# Windows
winget install Microsoft.AzureCLI
# Linux
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
Azure Developer CLI (azd)
# macOS
brew install azure-dev
# Windows
winget install Microsoft.Azd
# Linux
curl -fsSL https://aka.ms/install-azd.sh | bash
# Login to Azure CLI (required for Terraform auth)
az login
# Set your subscription
az account set --subscription "<YOUR_SUBSCRIPTION_ID>"
# Verify current subscription
az account show --query "{name:name, id:id, tenantId:tenantId}"
This template uses AzureRM Provider 4.x with the following key features:
| Setting (3.x) | Setting (4.x) |
|---|---|
skip_provider_registration = true | resource_provider_registrations = "none" |
For full migration guide, see: AzureRM 4.0 Upgrade Guide
├── azure.yaml # AZD project configuration
├── infra/
│ ├── provider.tf # Provider configuration (azurerm ~>4.21)
│ ├── main.tf # Main infrastructure
│ ├── variables.tf # Input variables
│ ├── output.tf # Output values
│ └── core/ # Reusable modules
│ ├── database/ # CosmosDB, PostgreSQL
│ ├── gateway/ # API Management
│ ├── host/ # App Service, App Service Plans
│ ├── monitor/ # Application Insights, Log Analytics
│ └── security/ # Key Vault
└── .devcontainer/ # Dev container with tools pre-installed
The following assets have been provided:
infra directory that demonstrate how to provision resources and setup resource tagging for azd..devcontainer directory that installs infrastructure tooling by default. This can be readily used to create cloud-hosted developer environments such as GitHub Codespaces..github directory, and Azure Pipelines under the .azdo directory that work for most use-cases.# Initialize azd environment
azd init
# Validate Terraform configuration
cd infra && terraform init && terraform validate && cd ..
# Provision Azure resources
azd provision
# Deploy application (if services configured)
azd deploy
# Or do both at once
azd up
Note: For
functionservices, it is recommended to initialize the project using the provided quickstart tools.
azure.yaml to reference the source code projects.azd package to validate that all service source code projects can be built and packaged locally.Update or add Terraform modules to provision the relevant Azure resources. This can be done incrementally, as the list of Azure resources are explored and added.
Run azd provision whenever you want to ensure that changes made are applied correctly and work as expected.
Certain changes to Terraform modules or deployment manifests are required to tie in application and infrastructure together. For example:
For more details, see additional details below.
When changes are made, use azd to apply your changes in Azure and validate that they are working as expected:
azd up to validate both infrastructure and application code changes.azd deploy to validate application code changes.Finally, run azd up to run the end-to-end infrastructure provisioning (azd provision) and deployment (azd deploy) flow. Visit the service endpoints listed to see your application up-and-running!
The following section examines different concepts that help tie in application and infrastructure.
It is recommended to have application settings managed in Azure, separating configuration from code. Typically, the service host allows for application settings to be defined.
appservice and function, application settings should be defined on the Terraform resource for the targeted host. Reference template example here.aks, application settings are applied using deployment manifests under the <service>/manifests folder. Reference template example here.Managed identities allows you to secure communication between services. This is done without having the need for you to manage any credentials.
Azure Key Vault allows you to store secrets securely. Your application can access these secrets securely through the use of managed identities.
For appservice, the following host configuration options are often modified:
HCL
100.0%