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 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 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
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Set Up Cloud Shell
- Set the location to be the same as the storage account’s location.
- Use the existing resource group.
- Use the existing storage account.
- 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:
- 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.
- 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
- Swap Staging and Production Slots
- Swap staging to production.