{"id":13289010,"url":"https://github.com/Azure/reliable-web-app-pattern-dotnet","last_synced_at":"2025-03-10T06:34:00.027Z","repository":{"id":66003988,"uuid":"521686887","full_name":"Azure/reliable-web-app-pattern-dotnet","owner":"Azure","description":"The Reliable Web App Pattern is a set of objectives to help your web application converge on the cloud. This repo contains a reference implementation of a reliable web application for .NET.","archived":false,"fork":false,"pushed_at":"2024-09-30T19:07:11.000Z","size":11085,"stargazers_count":402,"open_issues_count":4,"forks_count":124,"subscribers_count":22,"default_branch":"main","last_synced_at":"2025-03-02T10:37:05.564Z","etag":null,"topics":["architecture","azd-templates","azure","azure-app-configuration","azure-app-service","azure-cache-redis","azure-frontdoor","azure-keyvault","azure-private-endpoints","azure-sql-database","bicep-templates","dotnet","microsoft","reference-implementation"],"latest_commit_sha":null,"homepage":"https://aka.ms/eap/rwa/dotnet/doc","language":"Bicep","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Azure.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":"SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-05T15:23:23.000Z","updated_at":"2025-02-28T01:19:15.000Z","dependencies_parsed_at":"2024-04-11T18:38:04.735Z","dependency_job_id":"e4b205e8-e96b-4d29-8d08-a12757bf348b","html_url":"https://github.com/Azure/reliable-web-app-pattern-dotnet","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azure%2Freliable-web-app-pattern-dotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azure%2Freliable-web-app-pattern-dotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azure%2Freliable-web-app-pattern-dotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azure%2Freliable-web-app-pattern-dotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Azure","download_url":"https://codeload.github.com/Azure/reliable-web-app-pattern-dotnet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242805659,"owners_count":20187996,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["architecture","azd-templates","azure","azure-app-configuration","azure-app-service","azure-cache-redis","azure-frontdoor","azure-keyvault","azure-private-endpoints","azure-sql-database","bicep-templates","dotnet","microsoft","reference-implementation"],"created_at":"2024-07-29T17:00:17.998Z","updated_at":"2025-03-10T06:33:55.020Z","avatar_url":"https://github.com/Azure.png","language":"Bicep","funding_links":[],"categories":["azure","dotnet"],"sub_categories":[],"readme":"# Reliable web app pattern for .NET\n\n\u003e :mega: **Got feedback?** Fill out [this survey](https://aka.ms/eap/rwa/dotnet/survey) to help us shape the future of Enterprise App Patterns and understand whether we're focusing on the business goals and features important to you. [Microsoft Privacy Statement](https://go.microsoft.com/fwlink/?LinkId=521839)\n\nThe reference implementation provides a production-grade web application that uses best practices from our guidance and gives developers concrete examples to build their own Reliable Web Application in Azure. This repository specifically demonstrates a concert ticketing application for the fictional company Relecloud, embodying the reliable web app pattern with a focus on .NET technologies. It guides developers through a simulated migration from an on-premises ASP.NET application to Azure, detailing the architectural changes and enhancements that capitalize on the cloud's strengths during the initial adoption phase. \n\nThis project has [a companion article in the Azure Architecture Center](https://aka.ms/eap/rwa/dotnet/doc) that describes design patterns and best practices and [a six-part video series (YouTube)](https://aka.ms/eap/rwa/dotnet/videos) that details the reliable web app pattern for .NET web app. Here's an outline of the contents in this readme:\n\n- [Architecture](#architecture)\n- [Workflow](#workflow)\n- [Steps to deploy the reference implementation](#steps-to-deploy-the-reference-implementation)\n- [Additional links](#additional-links)\n- [Data Collection](#data-collection)\n\n## Architecture\n\nRelecloud aligned to a hub and spoke network topology in the production deployment architecture to centralize common resources. This network topology provided cost savings, enhanced security, and facilitated network integration (platform and hybrid):\n\n![architecture diagram](./assets/icons/reliable-web-app-dotnet.svg)\n\nThis diagram describes the production deployment which is described in the [prod-deployment.md](./prod-deployment.md) file. The following steps below are for a [development deployment](./assets/icons/reliable-web-app-dotnet-dev.svg) which is a simplified version.\n\n-\tCost efficiency: The hub acts as a central point for shared resources, promoting cost-effective resource reuse. For instance, Azure Bastion is a shared service in the hub, providing secure and cost-effective remote access without the need for separate deployments for each application.\n-\tTraffic control and security: Network traffic is managed and secured using Network Security Groups and Route tables in each subnet, creating secure boundaries for Azure resources. Private endpoints add an extra layer of security, and a jump box allows for deployment within these boundaries, maintaining local IP access to resources.\n-\tNetwork integration: The topology supports network integrations for data transfer across applications and hybrid scenarios. While the reference architecture doesn't include ExpressRoute or Azure VPN Gateway, these should be considered for applications requiring hybrid network connections.\n\n## Workflow\n\nThis description details the workflow for Relecloud's concert ticketing application. It highlights key components and functionality to help you emulate its design:\n \n- Global traffic routing: Azure Front Door acts as a global traffic manager, routing users to the primary region for optimal performance and failing over to a secondary region during outages for uninterrupted service.\n- Security inspection: Incoming traffic is inspected by Azure Web Application Firewall to protect against web vulnerabilities before reaching the web app.\n- Static and dynamic content delivery: Users receive static content, like the home page, immediately upon request. Dynamic content, such as 'Upcoming Concerts', is generated by making API calls to the backend, which fetches data from Azure SQL Database and returns it in a JSON format.\n- Session state management: User sessions, including shopping cart data, are managed by Azure Cache for Redis, ensuring persistence and consistency across scale-out events.\n- User authentication: Microsoft Entra ID handles user authentication, suitable for environments where accounts are centrally managed, enhancing security and control.\n- API interaction and token management: The front-end web app uses the MSAL library to obtain tokens for authenticated API calls, caching them in Azure Cache for Redis to optimize performance and manageability.\n- Payment and checkout flow: While this example doesn't process real payments, the web app captures payment information during checkout, demonstrating how a web app can handle sensitive data.\n- Purchase and ticket generation: The backend API processes purchase requests and generates tickets that are immediately accessible to users.\n- Networking and access control: Azure Private DNS, Network Security Groups, and Azure Firewall tightly control the flow of traffic within the app's network, maintaining security and isolation.\n- Monitoring and telemetry: Application Insights provides monitoring and telemetry capabilities, enabling performance tracking and proactive issue resolution.\n- Configuration and secrets management: Initial configuration and sensitive information are loaded from Azure App Configuration and Azure Key Vault into the app's memory upon startup, minimizing access to sensitive data thereafter.\n\n## Steps to deploy the reference implementation\n\nThe following detailed deployment steps assume you are using a Dev Container inside Visual Studio Code.\n\n\u003e For your convenience, we use Dev Containers with a fully-featured development environment. If you prefer to use Visual Studio, we recommend installing the necessary [dependencies](./prerequisites.md) and skip to the deployment instructions starting in [Step 3](#3-log-in-to-azure).\n\n### 1. Clone the repo\n\n\u003e For Windows users, we recommend using Windows Subsystem for Linux (WSL) to [improve Dev Container performance](https://code.visualstudio.com/remote/advancedcontainers/improve-performance).\n\n```pwsh\nwsl\n```\n\nClone the repository from GitHub into the WSL 2 filesystem using the following command:\n\n```shell\ngit clone https://github.com/Azure/reliable-web-app-pattern-dotnet.git\ncd reliable-web-app-pattern-dotnet\n```\n\n### 2. Open Dev Container in Visual Studio Code\n\nIf required, ensure Docker Desktop is started and enabled for your WSL terminal [more details](https://learn.microsoft.com/windows/wsl/tutorials/wsl-containers#install-docker-desktop). Open the repository folder in Visual Studio Code. You can do this from the command prompt:\n\n```shell\ncode .\n```\n\nOnce Visual Studio Code is launched, you should see a popup allowing you to click on the button **Reopen in Container**.\n\n![Reopen in Container](assets/images/vscode-reopen-in-container.png)\n\nIf you don't see the popup, open the Visual Studio Code Command Palette to execute the command. There are three ways to open the command palette:\n\n- For Mac users, use the keyboard shortcut ⇧⌘P\n- For Windows and Linux users, use Ctrl+Shift+P\n- From the Visual Studio Code top menu, navigate to View -\u003e Command Palette.\n\nOnce the command palette is open, search for `Dev Containers: Rebuild and Reopen in Container`.\n\n![WSL Ubuntu](assets/images/vscode-reopen-in-container-command.png)\n\n### 3. Log in to Azure\n\nBefore deploying, you must be authenticated to Azure and have the appropriate subscription selected. Run the following command to authenticate:\n\nIf you are not using PowerShell 7+, run the following command (you can use [$PSVersionTable.PSVersion](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_powershell_editions) to check your version):\n\n```shell\npwsh\n```\n\n```pwsh\nImport-Module Az.Resources\n```\n\n```pwsh\nConnect-AzAccount -UseDeviceAuthentication\n```\n\nSet the subscription to the one you want to use (you can use [Get-AzSubscription](https://learn.microsoft.com/powershell/module/az.accounts/get-azsubscription?view=azps-11.3.0) to list available subscriptions):\n\n```pwsh\n$AZURE_SUBSCRIPTION_ID=\"\u003cyour-subscription-id\u003e\"\n```\n\n```pwsh\nSet-AzContext -SubscriptionId $AZURE_SUBSCRIPTION_ID\n```\n\nUse the next command to login with the Azure Dev CLI (AZD) tool:\n\n```pwsh\nazd auth login --use-device-code\n```\n\n\n### 4. Create a new environment\n\nNext we provide the AZD tool with variables that it uses to create the deployment. The first thing we initialize is the AZD environment with a name.\n\nThe environment name should be less than 18 characters and must be comprised of lower-case, numeric, and dash characters (for example, `dotnetwebapp`).  The environment name is used for resource group naming and specific resource naming.\n\nBy default, Azure resources are sized for a development deployment. If doing a production deployment, see the [production deployment](./prod-deployment.md) instructions for more detail.\n\n```pwsh\nazd env new \u003cpick_a_name\u003e\n```\n\nSelect the subscription that will be used for the deployment:\n\n```pwsh\nazd env set AZURE_SUBSCRIPTION_ID $AZURE_SUBSCRIPTION_ID\n```\n\n(Optionally) Set your principal name:\n\n```pwsh\nazd env set AZURE_PRINCIPAL_NAME (Get-AzContext).Account.Id\n```\n\nSet the `AZURE_LOCATION` (Run `(Get-AzLocation).Location` to see a list of locations):\n\n```pwsh\nazd env set AZURE_LOCATION \u003cpick_a_region\u003e\n```\n\n### 5. Create the Azure resources and deploy the code\n\nRun the following command to create the Azure resources and deploy the code (about 15-minutes to complete):\n\n```pwsh\nazd up\n```\n\n\u003e **Errors during provisioning?**  See our [known issues list](./known-issues.md) or file an issue on our [GitHub repo](https://github.com/azure/reliable-web-app-pattern-dotnet/issues).\n\n### 6. Open and use the application\n\nUse the URL displayed in the console output to launch the web application that you have deployed:\n\n![screenshot of web app home page](assets/images/WebAppHomePage.png)\n\nYou can learn more about the web app by reading the [Pattern Simulations](demo.md) documentation.\n\n### 7. Tear down the deployment\n\nRun the following command to tear down the deployment:\n\n```pwsh\nazd down --purge --force\n```\n\n## Additional links\n\n- [Known issues](known-issues.md)\n- [Troubleshooting](troubleshooting.md)\n- [Pattern Simulations](demo.md)\n- [Developer Experience](developer-experience.md)\n- [Calculating SLA](./assets/sla-calculation.md)\n- [Find additional resources](additional-resources.md)\n- [Report security concerns](SECURITY.md)\n- [Find Support](SUPPORT.md)\n- [Contributing](CONTRIBUTING.md)\n\n## Trademarks\n\nThis project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft \ntrademarks or logos is subject to and must follow \n[Microsoft's Trademark \u0026 Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).\nUse of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.\nAny use of third-party trademarks or logos are subject to those third-party's policies.\n\n## Data Collection\n\nThe software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft's privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkId=521839. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.\n\n### Telemetry Configuration\n\nTelemetry collection is on by default.\n\nTo opt out, run the following command `azd env set ENABLE_TELEMETRY` to `false` in your AZD environment.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAzure%2Freliable-web-app-pattern-dotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAzure%2Freliable-web-app-pattern-dotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAzure%2Freliable-web-app-pattern-dotnet/lists"}