The following repo contains everything required to showcase how to use an Azure Web App, integrating with Azure App Configuration Service and Key Vault to do configuration management for an application.
- Azure CLI - For Azure resource management
- Azure Developer CLI (azd) - For modern Azure development workflows
- Terraform - For infrastructure as code
- Docker - For containerization
- .NET SDK (6.0, 7.0, 8.0) - For .NET development
- HashiCorp Terraform
- Azure Terraform
- Azure Resource Groups
- Azure App Service
- Azure Container Apps
- Docker
- .NET and C# support
- Python support
- GitHub Copilot
- Azure CLI Tools
- Bicep
├── README.md
├── app # Provides a containerized application that shows the app config settings.
│ ├── AppConfigDemo.csproj
│ ├── Dockerfile
│ ├── Program.cs
│ ├── README.md
│ ├── docker-compose.yml
│ ├── obj
│ │ ├── AppConfigDemo.csproj.nuget.dgspec.json
│ │ ├── AppConfigDemo.csproj.nuget.g.props
│ │ ├── AppConfigDemo.csproj.nuget.g.targets
│ │ ├── project.assets.json
│ │ └── project.nuget.cache
│ ├── run.sh
│ └── test-local.sh
└── infra # Provides infrastructure-as-code to support deploying the infrastructure.
├── README.md
├── main.tf
├── outputs.tf
├── terraform.tfstate
├── terraform.tfstate.backup
├── terraform.tfvars.example
└── variables.tf
- Open the project in VS Code
- Install the "Dev Containers" extension if not already installed
- Press
F1
and select "Dev Containers: Reopen in Container" - Wait for the container to build and initialize
# Connect to azure government
az cloud set --name AzureUSGovernment
# Login to Azure
az login --use-device-code
# Verify your account
az account show
# Set subscription if needed
az account set --subscription "your-subscription-id"
You can go to the "./infra" directory and find an example of a tfvar file named "environment.tfvars":
Update this to have the configuration for your environment.
# Navigate to the infra directory:
cd ./infra
# Initialize Terraform
terraform init
# Plan deployment
terraform plan -var-file=./environment.tfvars
# Apply infrastructure
terraform apply -var-file=./environment.tfvars
# Navigate to app directory
cd app
# Build container image
docker build -t settings-app:latest .
# Test locally
docker run -p 8080:80 myapp
# Tag for ACR (replace with your ACR name from terraform output)
docker tag myapp <acr-name>.azurecr.io/myapp:latest
# Push to ACR
docker push <acr-name>.azurecr.io/myapp:latest
The devcontainer includes pre-configured tasks accessible via Ctrl+Shift+P
→ "Tasks: Run Task":
- Terraform: Init - Initialize Terraform
- Terraform: Validate - Validate configuration
- Terraform: Plan - Plan deployment
- Terraform: Apply - Apply infrastructure
- Terraform: Destroy - Destroy infrastructure
- Terraform: Format - Format code
- Docker: Build App - Build container image
- Docker: Run App Locally - Run container locally
- Azure: Login - Login to Azure
- Azure: Show Account - Show current account
- Build and Deploy: Full Pipeline - Complete build and deployment
- Set breakpoints in your .NET code
- Use the "Debug .NET App (Local)" configuration
- Or attach to a running container with "Attach to .NET App in Container"
- Build and run your container locally
- Use
docker exec -it <container-name> /bin/bash
to access the container - Check logs with
docker logs <container-name>
The devcontainer automatically forwards these ports:
- 3000 - Frontend development server
- 5000 - .NET app (HTTP)
- 5001 - .NET app (HTTPS)
- 8080 - Container app
- 8081 - Additional container port
- Edit Infrastructure: Modify
.tf
files for infrastructure changes - Plan Changes: Run
terraform plan
to see what will change - Apply Changes: Run
terraform apply
to update infrastructure - Develop App: Work in the
app/
directory - Build Container: Use Docker tasks to build and test
- Deploy: Push to ACR and update App Service
- The devcontainer runs as the
vscode
user for security - Docker socket is mounted for container operations
- All Azure authentication uses your personal credentials
- Terraform state is stored locally (consider remote state for production)
- Check Docker is running on your host
- Verify you have sufficient disk space
- Check the devcontainer logs in VS Code
- Ensure you're logged into Azure:
az login
- Check your subscription:
az account show
- Verify permissions on the subscription
- Try
az login --use-device-code
for authentication issues - Clear credentials:
az logout
thenaz login
- Check tenant:
az account tenant list