This repository contains Infrastructure as Code (IaC) templates using Azure Bicep for deploying a complete cloud infrastructure. The infrastructure includes serverless functions, content delivery, database, and storage components configured for both production and non-production environments.
![Architecture Diagram] The infrastructure consists of the following components:
- Azure Front Door: Global load balancer and CDN
- Azure Functions: Serverless compute with staging slots
- Azure Storage Accounts: Blob storage for various purposes
- Azure Cosmos DB: NoSQL database with serverless configuration
- Azure DNS: Custom domain management
- App Service Plan: Hosting plan for Function Apps
- Azure CLI (version 2.50.0 or later)
- Azure subscription with Owner/Contributor access
- PowerShell 7+ or Azure Cloud Shell
- Visual Studio Code with Bicep extension (optional)
.
├── main.bicep # Main deployment template
├── main.bicepparam # Parameter file
├── modules/
│ ├── appServicePlan.bicep # App Service Plan configuration
│ ├── cosmosDbAccount.bicep # Cosmos DB configuration
│ ├── createContainer.bicep # Storage container creation
│ ├── dnsZone.bicep # DNS configuration
│ ├── frontDoor.bicep # Front Door configuration
│ ├── functionAppProd.bicep # Production function app
│ ├── functionAppStage.bicep # Staging function app
│ └── storageAccount.bicep # Storage account configuration
- Install Azure CLI and login:
# Install Azure CLI (Windows)
winget install Microsoft.AzureCLI
# Login to Azure
az login
az account set --subscription "<subscription-id>"az group list --query "[].name" -o tsv | ForEach-Object { az group delete --name $_ --yes --no-wait }
- Configure environment variables:
$RG="rg-webapp-102-lz"
$LOCATION="centralus"
$TEMPLATE="main.bicep"
$PARAMS="main.bicepparam"- Create Resource Group:
az group create --name $RG --location $LOCATIONUpdate main.bicepparam with your specific values:
environment: 'prod' or 'nonprod'location: Azure regionzoneName: Your custom domainfuncName: Base name for function appsprofileName: Front Door profile nametags: Resource tagging structurednsRecords: DNS configuration including verification codes
- Set up environment variables:
# Run the environment setup script
./scripts/Set-Environment.ps1 -ResourceGroupName "your-resource-group" -Location "your-location" -Environment "prod"- Validate the deployment:
az deployment group what-if --resource-group $env:AZURE_RG --template-file $TEMPLATE --parameters $PARAMS- Deploy the infrastructure:
az deployment group create --resource-group $env:AZURE_RG --template-file $TEMPLATE --parameters $PARAMS- Update Storage Account Verification:
# Connect to Azure (if not already connected)
Connect-AzAccount
# Run the storage verification script (uses environment variables)
./scripts/Update-StorageVerification.ps1-
All storage accounts are configured with:
- HTTPS-only access
- TLS 1.2 minimum version
- Disabled public blob access
- OAuth authentication enabled
-
Function Apps include:
- HTTPS-only access
- Managed identity authentication
- CORS configuration for specified domains
- FTPS-only state
-
Front Door provides:
- WAF protection (optional)
- TLS 1.2 minimum version
- Managed certificates for custom domains
- Monitor deployments:
az deployment group list --resource-group $RG --query "[].{Name:name, ProvisioningState:properties.provisioningState}" -o table- Check resource health:
az resource list --resource-group $RG --query "[].{Name:name, Type:type, Status:properties.provisioningState}" -o tableCommon issues and solutions:
-
Deployment Failures
- Verify parameter values in main.bicepparam
- Check resource name availability
- Verify subscription permissions
-
DNS Configuration
- Ensure DNS verification codes are correct
- Allow time for DNS propagation (up to 48 hours)
- Verify domain ownership
-
Function App Issues
- Check App Service Plan scaling
- Verify storage account connections
- Review application settings
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions, please open an issue in the repository.