A demo ASP.NET Core 10.0 web application showcasing modern DevOps practices, cloud deployment strategies, and Infrastructure as Code (IaC) patterns.
- SimpleWeb
SimpleWeb is a demonstration project designed to showcase best practices for:
- Building ASP.NET Core web applications
- Implementing CI/CD pipelines with Azure DevOps and GitHub Actions
- Container deployment using Docker and Kubernetes (AKS)
- Infrastructure provisioning using Terraform and Bicep
- Security scanning and code quality analysis
- ASP.NET Core 10.0 MVC - Modern web framework with MVC architecture
- Health Check Endpoint - Built-in health monitoring at
/health - File Upload - Support for local and Azure Blob Storage
- Application Insights - Telemetry and monitoring integration
- User Authentication - Azure AD authentication header support
- Flexible Storage - Configurable storage providers (Local/Azure)
SimpleWeb/
├── src/
│ ├── SimpleWeb/ # Main web application
│ │ ├── Controllers/ # MVC controllers
│ │ ├── Models/ # Data models
│ │ ├── Views/ # Razor views
│ │ ├── wwwroot/ # Static files
│ │ ├── Dockerfile # Container definition
│ │ └── appsettings.json # Application configuration
│ ├── SimpleWeb.UnitTest/ # Unit tests
│ ├── SimpleWeb.IntegrationTest/ # Integration tests
│ └── SimpleWeb.UITest/ # UI automation tests
├── src-java/ # Java edition (Spring Boot 4.1.1 / Java 21)
│ ├── pom.xml # Maven project (builds target/simpleweb.jar)
│ ├── mvnw / mvnw.cmd / .mvn/ # Maven Wrapper
│ ├── Dockerfile # Container definition
│ ├── src/ # Application and test sources
│ └── README.md # Java edition documentation (Traditional Chinese)
├── ci/ # Azure DevOps pipeline definitions
│ ├── 01.build.yml # Basic build pipeline
│ ├── 01.prwithlimitbranch.yml # PR validation with branch restriction
│ ├── 02.packagescan.yml # Security scanning (Snyk)
│ ├── 03.sonarcloud.yml # Code quality analysis
│ ├── 04.publish.artifacts.yml # Artifact publishing
│ ├── 05.multistagerelease.yml # Multi-stage release
│ ├── 06.dockerseperate.yml # Docker separate build
│ ├── 07.dockerbuildandpush.yml # Docker build and push
│ ├── 08.aks.yml # AKS deployment
│ ├── 09.terraform.build.yml # Terraform build
│ ├── 09.terraform.release.yml # Terraform release
│ └── 10.bicep.yml # Bicep deployment
├── bicep/ # Azure Bicep templates
│ ├── main.bicep # Main infrastructure template
│ └── parameters.json # Parameters file
├── tf/ # Terraform configurations
│ └── infra.tf # Azure infrastructure
├── manifests/ # Kubernetes manifests
│ ├── deployment.yml # K8s deployment
│ └── service.yml # K8s service (LoadBalancer)
├── scripts/ # Utility scripts
│ └── TestifyZeroDowntime.ps1 # Zero-downtime testing
└── .github/workflows/ # GitHub Actions
├── 01.build.yml # Build and test workflow
├── 01.prwithlimitbranch.yml # PR validation with branch restriction
├── 02.packagescan.yml # Security scanning (Snyk)
├── 03.sonarcloud.yml # Code quality analysis (SonarCloud)
├── 04.publish.artifacts.yml # Artifact publishing
├── 05.multistagerelease.yml # Multi-stage release to Azure Web App
├── 06.dockerseperate.yml # Docker build and push to GHCR
├── 07.dockerbuildandpush.yml # Docker build and push to ACR
├── 08.aks.yml # Deploy to Azure Kubernetes Service
├── 09.terraform.build.yml # Terraform build workflow
├── 09.terraform.release.yml # Terraform release workflow
├── 10.bicep.yml # Bicep deployment workflow
├── 12.java-build.yml # Java edition build and test
└── 13.java-vm-deploy.yml # Java edition manual VM deployment
- .NET 10.0 SDK or later
- Docker (for containerization)
- Azure CLI (for Azure deployments)
- Terraform (for IaC with Terraform)
- kubectl (for Kubernetes deployments)
git clone https://github.com/MoneyYu/SimpleWeb.git
cd SimpleWebdotnet restore src/SimpleWeb.slndotnet build src/SimpleWeb.sln --configuration Releasecd src/SimpleWeb
dotnet runThe application will be available at https://localhost:5001 or http://localhost:5000.
The application supports the following configuration options in appsettings.json:
{
"Storage": {
"Type": "Local", // Options: "Local" or "Azure"
"FileName": "sample.jpg",
"Azure": {
"ConnectionString": "" // Azure Storage connection string
}
},
"APPINSIGHTS_CONNECTIONSTRING": "" // Application Insights connection
}For secure storage of sensitive configuration in development:
# Initialize user secrets
dotnet user-secrets init
# Set Azure Storage connection string
dotnet user-secrets set "Storage:Azure:ConnectionString" "your-connection-string"
# Set Application Insights connection
dotnet user-secrets set "APPINSIGHTS_CONNECTIONSTRING" "your-connection-string"For more information, see Safe storage of app secrets in development in ASP.NET Core.
| Variable | Description |
|---|---|
Storage__Type |
Storage provider type (Local or Azure) |
Storage__Azure__ConnectionString |
Azure Blob Storage connection string |
APPINSIGHTS_CONNECTIONSTRING |
Application Insights connection string |
dotnet test src/SimpleWeb.UnitTest/SimpleWeb.UnitTest.csproj --verbosity normaldotnet test src/SimpleWeb.IntegrationTest/SimpleWeb.IntegrationTest.csproj --verbosity normaldotnet test src/SimpleWeb.sln --verbosity normalcd src/SimpleWeb
docker build -t simpleweb:latest .docker run -d -p 8080:80 --name simpleweb simpleweb:latestAccess the application at http://localhost:8080.
# Build and run
docker-compose up -d
# Stop and remove
docker-compose downThis project includes multiple CI/CD pipeline definitions for Azure DevOps:
| Pipeline | Description |
|---|---|
01.build.yml |
Basic build and test pipeline |
01.prwithlimitbranch.yml |
PR validation requiring dev branch |
02.packagescan.yml |
Security scanning with Snyk |
03.sonarcloud.yml |
Code quality analysis with SonarCloud |
04.publish.artifacts.yml |
Build artifacts publishing |
05.multistagerelease.yml |
Multi-stage deployment to Azure Web App |
06.dockerseperate.yml |
Separate Docker build stages |
07.dockerbuildandpush.yml |
Docker image build and push to ACR |
08.aks.yml |
Deploy to Azure Kubernetes Service |
09.terraform.*.yml |
Infrastructure deployment with Terraform |
10.bicep.yml |
Infrastructure deployment with Bicep |
The project includes comprehensive GitHub Actions workflows (.github/workflows/) that mirror the Azure DevOps pipelines:
| Workflow | Description |
|---|---|
01.build.yml |
Build and test on push to any branch |
01.prwithlimitbranch.yml |
PR validation requiring PRs to master from dev branch |
02.packagescan.yml |
Security scanning with Snyk |
03.sonarcloud.yml |
Code quality analysis with SonarCloud |
04.publish.artifacts.yml |
Build artifacts publishing |
05.multistagerelease.yml |
Multi-stage deployment to Azure Web App |
06.dockerseperate.yml |
Docker build and push to GitHub Container Registry |
07.dockerbuildandpush.yml |
Docker image build and push to Azure Container Registry |
08.aks.yml |
Build, push to ACR, and deploy to Azure Kubernetes Service |
09.terraform.build.yml |
Build and prepare Terraform artifacts |
09.terraform.release.yml |
Deploy infrastructure with Terraform and deploy app |
10.bicep.yml |
Deploy Azure infrastructure with Bicep |
Alongside the ASP.NET Core application in src/, this repository also contains a Java edition
of SimpleWeb in src-java/ — a Spring Boot 4.1.1 / Java 21 application that exposes
the same kind of environment and build information. Both editions are built and deployed
independently, so the same DevOps practices can be demonstrated on two technology stacks.
cd src-java
# Build, test and package (produces target/simpleweb.jar)
./mvnw -B verify
# Run locally on http://localhost:8080
./mvnw spring-boot:runEndpoints: / (home page), /api/info (JSON), /actuator/health, /actuator/info.
Full documentation (Traditional Chinese) — local run, tests, Docker, environment variables and the
generic VM deployment layout under /opt/simpleweb/{test,prod} — is in
src-java/README.md.
| Workflow | Description |
|---|---|
12.java-build.yml |
Build and test the Java edition on pushes touching src-java/** |
13.java-vm-deploy.yml |
Manual (workflow_dispatch) deployment of the Java edition to a Linux VM, targeting the test or production GitHub Environment |
Deploy Azure infrastructure using Terraform:
cd tf
# Initialize Terraform
terraform init
# Preview changes
terraform plan
# Apply changes
terraform applyThis creates:
- Azure Resource Group
- App Service Plan (Linux, Standard S1)
- Azure App Service (with .NET 10.0)
Deploy Azure infrastructure using Bicep:
# Using Azure CLI
az deployment group create \
--resource-group <resource-group-name> \
--template-file bicep/main.bicep \
--parameters bicep/parameters.json
# Using PowerShell
New-AzResourceGroupDeployment \
-ResourceGroupName <resource-group-name> \
-TemplateFile bicep/main.bicepThis creates:
- Virtual Network with Subnet
- Storage Account
- Public IP Address
- Network Interface
- Windows Server Virtual Machine
Deploy to Kubernetes (AKS or any K8s cluster):
# Apply deployment
kubectl apply -f manifests/deployment.yml
# Apply service (LoadBalancer)
kubectl apply -f manifests/service.yml
# Check deployment status
kubectl get deployments
kubectl get pods
kubectl get services- Deployment: Creates pods running the SimpleWeb container
- Service: Exposes the application via LoadBalancer on port 80
| Endpoint | Method | Description |
|---|---|---|
/ |
GET | Home page |
/Home/Privacy |
GET | Privacy policy page |
/Home/Upload |
GET | File upload page |
/Home/Upload |
POST | Upload file |
/health |
GET | Health check endpoint (JSON) |
The application exposes a health check endpoint at /health that returns a JSON response:
{
"status": "Healthy",
"results": {}
}- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is open source and available under the MIT License.