As modern development environments become increasingly cloud-based, Microsoft Dev Box empowers developers with ready-to-use, high-performance, and secure development workstations in the cloud. To make Dev Box environments scalable and manageable, automation and version control play a crucial role — and this is where terraform and GitHub integration come into the picture.
In our previous article Microsoft Dev Box Creation using Terraform, we explored how to create Microsoft Dev Boxes using Terraform. Now, we’ll take the next step: **deploying Dev Box catalogs and synchronizing them with a GitHub repository**. This ensures that your development environments remain consistent, version-controlled, and easily maintainable across teams.
In this article, we will extend the setup by:
- Deploying Dev Box Catalogs using terraform.
- Synchronizing these catalogs with GitHub for version control.
Why Dev Box Catalogs?
Dev Box Catalogs enable organizations to define, manage, and share standardized development environments — tailored to specific teams or projects. A catalog acts as a blueprint, containing Dev Box definitions, base images, pre-installed tools, and necessary configurations to ensure every developer has a consistent setup.
What Makes Dev Box Catalogs Valuable?
By leveraging Dev Box Catalogs, teams can streamline how they deliver and maintain development environments. This approach ensures developers can focus on writing code instead of setting up and troubleshooting local configurations.
A Dev Box Catalog allows you to:
- Define customized development environments with pre-installed tools and dependencies
- Maintain consistent configurations for specific projects or teams
- Use version-controlled templates to manage changes over time
You can read more about Dev Box Catalogs in Microsoft documentation: Add and configure a catalog from GitHub
Pre-Requisites
Before deploying catalogs, ensure the following:
General Requirements
- Azure Subscription with Dev Box enabled.
- Terraform installed locally or via Azure Cloud Shell.
- Azure CLI installed and authenticated.
- GitHub repository for catalog synchronization.
Resources from Previous Blog
You should have already created:
- Resource Group
- Virtual Network and Subnet
- Network Connection
- Dev Center
- Project
- Dev Box Definition
- Dev Box Pool
Now we will create the below set of resources as part of this deployment:
-
Dev Box Catalog
- Azure Key Vault
Deploy the Dev Box Catalog and Key Vault to the 'West Europe' location.
Step 1: Create a Dev Box Catalog using Terraform
# This Terraform script creates a Dev Center Catalog in Azure.
#Creating a Dev Center Catalog
resource "azurerm_dev_center_catalog" "catalogs" {
name = "devCenterCatalog"
resource_group_name = azurerm_resource_group.resourceGroup.name
dev_center_id = azurerm_dev_center.devCenter.id
catalog_adogit {
branch = "feature/devCenterCatalog"
path = "/catalog"
uri = "https://github.com/devCenter-org/devCenter-catalog"
key_vault_key_url = "https://${azurerm_key_vault.this.name}.vault.azure.net/secrets/Pat"
}
}
**Explanation of Parameters: **
- `name`: Name of the catalog
- `resource_group_name`: Name of the Resource group
- `dev_center_id`: ID of the Dev Center resource
- `uri`: URL of your GitHub repository
- `branch`: Branch to sync (e.g., `main`)
- `path`: Directory inside catalog
- `key_vault_key_url`: Secure token for GitHub authentication
Step 2: Create Key vault and secure Your GitHub Token
resource "azurerm_key_vault" "this" {
name = "devCenterCatalog-keyv"
location = azurerm_resource_group.resourceGroup.location
resource_group_name = azurerm_resource_group.resourceGroup.name
enabled_for_disk_encryption = true
tenant_id = data.azurerm_client_config.current.tenant_id
soft_delete_retention_days = 7
purge_protection_enabled = false
enable_rbac_authorization = true
sku_name = "standard"
}
resource "azurerm_key_vault_secret" "github_pat" {
name = "Pat"
value = var.devops_pat
key_vault_id = azurerm_key_vault.this.id
lifecycle {
ignore_changes = [
value
]
}
}
Step 3: Synchronize Catalog with GitHub
Once the catalog is linked to GitHub:
- Any changes in the GitHub repo will automatically sync to the Dev Center
- Developers can use updated definitions without manual intervention
Conclusion:
By deploying catalogs and syncing them with GitHub, you ensure:
- Consistent Dev Box environments
- Easy collaboration
- Automated updates