This guide is designed to help you get started with deploying a custom image for Azure Virtual Desktop using the provided Terraform template(s) within this repository. Before you deploy, it is recommended to review the template(s) to understand the resources that will be deployed and the associated costs.
This accelerator is to be used as starter kit and you can expand its functionality by developing your own deployments.
This guide describes how to deploy Azure Virtual Desktop Accelerator using the Terraform. To get started with Terraform on Azure check out their tutorial.
- Meet the prerequisites listed here
- Current version of the Azure CLI
- Current version of the Terraform CLI
- An Azure Subscription(s) where you or an identity you manage has
Owner
RBAC permissions
Deploy a customer image based on the latest version of the Azure Marketplace image for Windows 11 23H2 with M365 using Azure Image Builder to an Azure Compute Gallery. The custom image is optimized using Virtual Desktop Optimization Tool (VDOT) and patched with the latest Windows updates.
The Custom Image Terraform files structure:
file Name | Description |
---|---|
aib.tf | This file deploys Azure Image Builder and Compute Gallery |
outputs.tf | This will contains the outputs post deployment |
variables.tf | Variables have been created in all files for various properties and names, these are placeholders and are not required to be changed unless there is a need to. See below |
terraform.tfvars | This file contains all variables to be changed from the defaults, you are only required to change these as per your requirements |
The default templates write a state file directly to disk locally to where you are executing terraform from. If you wish to AzureRM backend please see AzureRM Backend. This deployment highlights using Azure Blog Storage to store state file and Key Vault
Click to expand
#### Using Azure CLIRESOURCE_GROUP_NAME=tstate
STORAGE_ACCOUNT_NAME=tstate$RANDOM
CONTAINER_NAME=tstate
az group create --name $RESOURCE_GROUP_NAME --location <eastus>
az storage account create --resource-group $RESOURCE_GROUP_NAME --name $STORAGE_ACCOUNT_NAME --sku Standard_LRS --encryption-services blob
ACCOUNT_KEY=$(az storage account keys list --resource-group $RESOURCE_GROUP_NAME --account-name $STORAGE_ACCOUNT_NAME --query '[0].value' -o tsv)
az storage container create --name $CONTAINER_NAME --account-name $STORAGE_ACCOUNT_NAME --account-key $ACCOUNT_KEY
echo "storage_account_name: $STORAGE_ACCOUNT_NAME"
echo "container_name: $CONTAINER_NAME"
echo "access_key: $ACCOUNT_KEY"
az keyvault create --name "<Azure Virtual Desktopkeyvaultdemo>" --resource-group $RESOURCE_GROUP_NAME --location "<East US>"
az keyvault secret set --vault-name "<Azure Virtual Desktopkeyvaultdemo>" --name terraform-backend-key --value "<W.........................................>"
- Modify the
terraform.tfvars
file to define the desired names, location, networking, and other variables - Before deploying, confirm the correct subscription
- Change directory to the Terraform folder
- Run
terraform init
to initialize this directory - Run
terraform plan
to view the planned deployment - Run
terraform apply
to confirm the deployment
Click to expand
Microsoft Support is not yet handling issues for any published tools in this repository. However, we would like to welcome you to open issues using GitHub issues to collaborate and improve these tools.