|
| 1 | +## 1 - Tooling and Deployment |
| 2 | + |
| 3 | +Welcome to the RWA .NET Workshop, we are going to learn how build reliable web applications using .NET and enterprise Cloud Apps. We are going to deploy a Ticket Store Application, Relecloud Concerts! |
| 4 | + |
| 5 | +For this guide, we use Dev Containers to provide a complete development environment for the project. |
| 6 | + |
| 7 | +> 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). |
| 8 | +
|
| 9 | +### 1. Clone the repo |
| 10 | + |
| 11 | +> For Windows users, we recommend using Windows Subsystem for Linux (WSL) to [improve Dev Container performance](https://code.visualstudio.com/remote/advancedcontainers/improve-performance). |
| 12 | +
|
| 13 | +Open a PowerShell terminal window, then run the following command. |
| 14 | + |
| 15 | +```pwsh |
| 16 | +wsl |
| 17 | +``` |
| 18 | + |
| 19 | +Clone the repository from GitHub into the WSL 2 filesystem using the following command: |
| 20 | + |
| 21 | +```shell |
| 22 | +git clone https://github.com/Azure/reliable-web-app-pattern-dotnet.git |
| 23 | +cd reliable-web-app-pattern-dotnet |
| 24 | +``` |
| 25 | + |
| 26 | +> You still can run this guide outside of WSL in Windows, but performance may be affected. Clone the repo with the instructions above. |
| 27 | +
|
| 28 | +### 2. Open Dev Container in Visual Studio Code |
| 29 | + |
| 30 | +If required, ensure Docker Desktop is installed, configured to use WSL, and started [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 in WSL: |
| 31 | + |
| 32 | +```shell |
| 33 | +code . |
| 34 | +``` |
| 35 | + |
| 36 | +> If you are not running WSL, ensure Docker Desktop is started, then open Visual Studio Code and start the Dev Container. |
| 37 | +
|
| 38 | +Once Visual Studio Code is launched, you should see a popup allowing you to click on the button **Reopen in Container**. |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | +If 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: |
| 43 | + |
| 44 | +- For Mac users, use the keyboard shortcut ⇧⌘P |
| 45 | +- For Windows and Linux users, use Ctrl+Shift+P |
| 46 | +- From the Visual Studio Code top menu, navigate to View -> Command Palette. |
| 47 | + |
| 48 | +Once the command palette is open, search for `Dev Containers: Rebuild and Reopen in Container`. |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | +### 3. Log in to Azure |
| 53 | + |
| 54 | +Before deploying, you must be authenticated to Azure and have the appropriate subscription selected. |
| 55 | + |
| 56 | +Run the following commands to authenticate: |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | +> If 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). |
| 61 | +
|
| 62 | +Open PowerShell on VSCode, or use: |
| 63 | + |
| 64 | +```shell |
| 65 | +pwsh |
| 66 | +``` |
| 67 | + |
| 68 | +Import Az.Resources use Azure command in our Shell. |
| 69 | + |
| 70 | +```pwsh |
| 71 | +Import-Module Az.Resources |
| 72 | +``` |
| 73 | + |
| 74 | +Login into Azure: |
| 75 | + |
| 76 | +```pwsh |
| 77 | +Connect-AzAccount -UseDeviceAuthentication |
| 78 | +``` |
| 79 | + |
| 80 | +Set the subscription to the one you want to use selecting from the list available subscriptions on the terminal. Enter the number corresponding to the subscription you do wish to use. |
| 81 | + |
| 82 | +Use the next command to login with the Azure Dev CLI (AZD) tool: |
| 83 | + |
| 84 | +```pwsh |
| 85 | +azd auth login --use-device-code |
| 86 | +``` |
| 87 | + |
| 88 | + |
| 89 | +### 4. Create a new environment |
| 90 | + |
| 91 | +Next 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. |
| 92 | + |
| 93 | +The 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. |
| 94 | + |
| 95 | +By 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. |
| 96 | + |
| 97 | +```pwsh |
| 98 | +azd env new <pick_a_name> |
| 99 | +``` |
| 100 | + |
| 101 | +Use the Azure Subscription ID from the current Subscription, add this as variable. |
| 102 | + |
| 103 | +```pwsh |
| 104 | +$AZURE_SUBSCRIPTION_ID=(Get-AzContext).Subscription.Id |
| 105 | +``` |
| 106 | + |
| 107 | +Select the subscription that will be used for the deployment: |
| 108 | + |
| 109 | +```pwsh |
| 110 | +azd env set AZURE_SUBSCRIPTION_ID $AZURE_SUBSCRIPTION_ID |
| 111 | +``` |
| 112 | + |
| 113 | +Set the `AZURE_LOCATION` (Run `(Get-AzLocation).Location` to see a list of locations): |
| 114 | + |
| 115 | +```pwsh |
| 116 | +azd env set AZURE_LOCATION <pick_a_region> |
| 117 | +``` |
| 118 | + |
| 119 | +### 5. Create the Azure resources and deploy the code |
| 120 | + |
| 121 | +Run the following command to create the Azure resources and deploy the code (about 15-minutes to complete): |
| 122 | + |
| 123 | +```pwsh |
| 124 | +azd up |
| 125 | +``` |
| 126 | + |
| 127 | +### 6. Open and use the application |
| 128 | + |
| 129 | +Use the URL displayed in the console output to launch the web application that you have deployed: |
| 130 | + |
| 131 | + |
| 132 | + |
| 133 | +The application is for the fictional company Relecloud, embodying the reliable web app pattern with a focus on .NET technologies. Relecloud Tickets is 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. Guiding 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. |
| 134 | + |
| 135 | + |
| 136 | + |
| 137 | +The infrastructure-as-code implementation implements the production deployment (shown above) and a development deployment, which is geared towards developer productivity and is more cost effective to run. Key aspects include: |
| 138 | + |
| 139 | +- Cost Efficiency: Utilizes a hub for shared resources, such as Azure Bastion, to enable secure, cost-effective remote access without individual deployments. |
| 140 | +- Traffic Control & Security: Employs Network Security Groups and Route tables for secure traffic management within subnets, complemented by Private endpoints and a jump box for secure local IP access. |
| 141 | +- Network Integration: Facilitates data transfer and hybrid scenarios, with recommendations to consider ExpressRoute or Azure VPN Gateway for hybrid network connections. |
| 142 | + |
| 143 | +For more details on the architecture and workflow for the Relecloud application, read the [main instructions](../../README.md) to learn more about the application in detail. |
| 144 | + |
| 145 | +### 7. Next Steps |
| 146 | + |
| 147 | +Fantastic! We've successfully deployed a production-like Relecloud concerts monolithic web application to Azure. Relecloud Concerts leverages the Reliable Web App Pattern with minimal code changes, seamlessly deployed to Azure using simple steps via azd. Now, let's dive deeper and explore the patterns and best-practices used in this application. As we advance, we'll simplify things by deploying a more basic application to help illustrate these concepts clearly before reviewing them in our main app. Ready to start? Click [next](../2%20-%20RWA%20Overview/README.MD). |
| 148 | + |
| 149 | +### Appendix A (To be run only after completing the workshop) |
| 150 | + |
| 151 | +See how to clean up the app in [Chapter 8](../8%20-%20Clean%20Up/README.md). |
0 commit comments