- Lab
- A Cloud Guru
Stage a .NET Web App Using App Service Deployment Slots and Azure CLI
The Azure App Service includes deployment slots to help improve the way in which updates to your code can be deployed to production. In this hands-on lab, we'll use the Azure CLI within the Cloud Shell, in order to deploy a basic .NET web application to a staging slot. We'll then use the Azure portal to promote the staging slot to production. Cloud Shell includes the Azure CLI and the .NET CLI, which we will use to perform all tasks. **Scenario** You've recently been employed as a cloud developer for a company that uses Azure App Service. A web application has been deployed by a previous cloud consultant, but no one you work with is familiar with Azure. After a recent change to the production web app caused an outage, your manager has asked whether you could recommend any improvements to the code deployment processes. You have suggested the use of App Service deployment slots. Before implementing this change, you must demonstrate the functionality to your manager. In order to perform this proof of concept, you will need to: * Deploy a simple .NET Core web application to a new web app in Azure App Service. * Make changes to your web application, and deploy these to a staging slot. * Perform a slot swap, so that your changes are promoted to production.
Path Info
Table of Contents
-
Challenge
Set Up Cloud Shell
- On the top navigation menu, select Cloud Shell.
- Select Bash.
- Click Mount storage account.
- Choose the provided Storage account subscription.
- Click Apply.
- Choose Select existing storage account.
- Click Next.
- Choose the provided Subscription, Resource Group, and Storage account name.
- Click Create file share.
- Give the file share the name cshell.
- Click Ok.
- Click Select.
-
Challenge
Set Up a .NET Web App in Azure App Service
-
Create a new demonstration web application.
-
Build the web application.
-
Create and deploy your web app.
NOTE: If you encounter a zip deployment error then rerun the
az webapp up
command again. Also keep in mind that this deployment can take a few minutes.
- We recommend you use the same location for your new web app, as your existing storage account (to avoid possible Cloud Shell errors).
- Remember, the APP_NAME must be unique across Azure.
- You can press the TAB key to auto-complete the RESOURCE_GROUP and the APP_NAME value.
- Make to pass -r "dotnet:7" to the az webapp up command.
-
-
Challenge
Update Your App and Upload to a Staging Slot
- Update your application.
- Create a staging slot.
- Deploy to the staging slot: a) Publish the updated code. b) Zip the deployment. c) ZipDeploy to the staging slot.
-
Challenge
Swap Staging and Production Slots
Swap staging to production.
What's a lab?
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.