Sample .NET 8 solution with:
src/Api: ASP.NET Core minimal APIsrc/Ui: Razor Pages UIterraform/: Azure infrastructure (App Configuration, Key Vault, App Service plan, Linux Web Apps).github/workflows/deploy.yml: infra + app deployment workflow
The API uses Azure App Configuration for feature flags and both API/UI consume MY_API_KEY through Key Vault references in App Service settings.
- API endpoint
GET /api/dashboard-modechecks feature flagNewDashboard. - API returns
dashboard: "New"or"Classic". - UI reads that value and renders one of two distinct dashboard layouts/styles.
- API endpoint
GET /api/my-api-key-checkreturns safe diagnostics only:hasValuelength- masked
preview - short SHA-256
fingerprint
- UI computes the same diagnostics for its own
MY_API_KEYand compares fingerprints. - UI page shows
Fingerprint match: True/Falsefor quick verification.
- Razor route convention maps
/index.htmlto theIndexpage.
- Terraform creates a Storage Account and uploads
terraform/assets/sample.pngto a private blob container. - Terraform saves these values in Azure App Configuration:
Storage:ConnectionStringStorage:ContainerNameStorage:SampleBlobName
- API endpoint
GET /api/sample-imagereads those keys from App Configuration at runtime and streams the PNG.
GET /api/healthGET /api/featureGET /api/featuresGET /api/dashboard-modeGET /api/my-api-key-checkGET /api/sample-image
- API App Service settings include:
APP_CONFIG_ENDPOINTMY_API_KEY(Key Vault reference)
- App Configuration key-values now include storage settings used by the API at runtime:
Storage:ConnectionStringStorage:ContainerNameStorage:SampleBlobName
- UI App Service settings include:
API_BASE_URLMY_API_KEY(Key Vault reference)
Workflow uses OIDC federated login (not AZURE_CREDENTIALS).
Required repository secrets:
AZURE_CLIENT_IDAZURE_TENANT_IDAZURE_SUBSCRIPTION_ID
Required repository variables for Terraform backend:
TF_STATE_RESOURCE_GROUPTF_STATE_STORAGE_ACCOUNTTF_STATE_CONTAINERTF_STATE_KEY
Run deployment from GitHub Actions with workflow_dispatch and environment input (dev or prod).
dotnet run --project src/Api/AzureAppConfiguration.Apidotnet run --project src/Ui/AzureAppConfiguration.UiOptional local environment variables:
- API:
APP_CONFIG_ENDPOINT,MY_API_KEY - UI:
API_BASE_URL,MY_API_KEY