While Infrastructure as Code (IaC) is gaining popularity and Bicep is becoming increasingly mature, I noticed that teams struggle to find a consistent way to organize their code within repositories. Although there are no strict rules, establishing standards and some governance for your team can be highly beneficial.

The teams I work with come from diverse backgrounds, including engineers and developers, having different maturity-levels and using a variety of tools and project configurations. This diversity often results in inconsistencies in code structure and management.

To tackle this issue, you could implementing a standardized minimal directory structure that can be tailored to meet the needs of most teams. In the upcoming series, I will further highlight the directory structure in more detail.

Example: Directory structure template

Over the past year, I have gained insights by examining community solutions and their code structures. I was impressed by the high level of maturity and organization in the Common Azure Resource Module Library (CARML) repository on GitHub, now referred to as Azure Verified Modules (AVM).

This template is primarily inspired by the AVM community and offers a foundational setup for Visual Studio Code and Azure DevOps directories, workload deployments, and Custom Verified Modules (see tips). It also features a source code directory containing shared PowerShell modules and solutions, and finally some key root files.

High-level summary

root
├─ .vscode
├─ azdevops
├─ deployments
│  ├─ authorization
│  ├─ management
│  ├─ network
│  ├─ workloads
│  └─ ...
├─ cvm
│  ├─ ptn
│  └─ res
├─ source
│  ├─ shared
│  ├─ app-001
│  ├─ app-002
│  └─ ...
├─ .gitignore
├─ bicepconfig.json
└─ README.md


Tip: Sometimes, you may need a resource template without the overhead of an Azure Verified Module (AVM). For instance, if you are deploying a simple Azure Storage Account and do not require the additional features and configurations provided by an AVM, you can create a Custom Verified Module (CVM) tailored to your specific needs, still using the guidelines and directory structure from AVM.

Tip: This approach allows you to streamline the deployment process and reduce complexity. The advantage of adopting the directory structure from AVM is the ease of transition if you are already familiar with AVM. Additionally, you can benefit from their documentation and utilities for your own modules.

Note: Don't try to reinvent the wheel. Get inspired what is already available online but respect authors copyright.

What’s next

Resources