Enterprise-ready Azure infrastructure deployment using declarative Infrastructure as Code with Bicep.
This repository provides a foundational setup for managing Azure infrastructure using Azure Bicep, Microsoft's domain-specific language for deploying Azure resources. It enables you to define your cloud resources in a clear, concise, and declarative manner, allowing for consistent and repeatable deployments across different environments (e.g., Development, Staging, Production).
The primary focus of this initial setup is the deployment of an Azure App Service Plan, configured with environment-specific parameters.
- Declarative Infrastructure: Define your Azure resources using Bicep's intuitive syntax.
- Environment-Specific Deployments: Utilize parameter files (
.bicepparam) to manage different configurations for various environments (dev, hml, prd). - App Service Plan Deployment: Easily provision an Azure App Service Plan with customizable names and locations.
- Modular Design (Planned): Structured with a
modulesdirectory, ready for implementing reusable Bicep components.
- IaC Language: Azure Bicep
- Cloud Platform: Microsoft Azure
- CLI Tool: Azure CLI
To deploy the infrastructure defined in this repository, you'll need the Azure CLI and the Bicep extension.
- An active Azure Subscription.
- Azure CLI installed. You can download it from Azure CLI documentation.
- Bicep CLI extension for Azure CLI. Install it using:
az bicep install
-
Clone the repository:
git clone https://github.com/efssantos/azure.git cd azure -
Log in to Azure: Ensure you are logged into your Azure account via the CLI:
az login
Follow the browser-based authentication prompt.
-
Create a Resource Group: Choose an existing resource group or create a new one to deploy your resources.
az group create --name my-bicep-rg --location eastus
Replace
my-bicep-rgandeastuswith your desired resource group name and Azure region.
The main.bicep file requires environment and location parameters. We use .bicepparam files for environment-specific configurations.
-
Configure Environment Parameters: The
.bicepparamfiles in this repository are currently empty. You will need to populate them with the appropriate values for each environment.For example, create/update
main.dev.bicepparam:using 'main.bicep' param environment = 'dev' param location = 'eastus' // Or another desired location
Repeat for
main.hml.bicepparam(e.g.,environment = 'hml') andmain.prd.bicepparam(e.g.,environment = 'prd'), adjustinglocationas needed. -
Deploy to Azure: Use the Azure CLI to deploy the
main.biceptemplate with the corresponding parameter file to your resource group.For Development (dev) environment:
az deployment group create \ --resource-group my-bicep-rg \ --template-file main.bicep \ --parameters main.dev.bicepparam
For Homologation (hml) environment:
az deployment group create \ --resource-group my-bicep-rg \ --template-file main.bicep \ --parameters main.hml.bicepparam
For Production (prd) environment:
az deployment group create \ --resource-group my-bicep-rg \ --template-file main.bicep \ --parameters main.prd.bicepparam
Upon successful deployment, an Azure App Service Plan named
appserviceplan-[environment](e.g.,appserviceplan-dev) will be created in your specified resource group and location.
azure/
├── main.bicep # Main Bicep template defining infrastructure
├── main.dev.bicepparam # Parameters for the development environment
├── main.hml.bicepparam # Parameters for the homologation/staging environment
├── main.prd.bicepparam # Parameters for the production environment
├── modules/ # Directory for reusable Bicep modules (currently empty)
└── README.md # Project README file
The main.bicep template accepts the following parameters:
| Parameter | Type | Description | Default Value | Required |
|---|---|---|---|---|
environment |
string |
The environment name (e.g., dev, hml, prd). |
(None) | Yes |
location |
string |
The Azure region to deploy resources to. | resourceGroup().location |
No |
These parameters should be provided via .bicepparam files or directly in the CLI during deployment.
These files (main.dev.bicepparam, main.hml.bicepparam, main.prd.bicepparam) are used to override default parameter values defined in main.bicep for specific environments. They allow you to manage unique settings (like environment name, resource location, or specific SKU details) without modifying the core Bicep template.
We welcome contributions to enhance this Azure Bicep infrastructure. Please see our Contributing Guide for details on how to get started.
- Ensure you have the Prerequisites installed.
- Clone the repository and set up your Azure CLI authentication.
- Familiarize yourself with the existing Bicep files and structure.
- If adding new modules, place them in the
modules/directory.
This project is licensed under the LICENSE_NAME - see the LICENSE file for details.
- Azure Bicep team for providing an excellent IaC language.
- Microsoft Azure documentation for comprehensive guides.
- 🐛 Issues: GitHub Issues
⭐ Star this repo if you find it helpful!
Made with ❤️ by efssantos