Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Azure icon
Labs

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.

Azure icon
Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 1h 0m
Published
Clock icon Jun 03, 2022

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Set Up Cloud Shell

    1. On the top navigation menu, select Cloud Shell.
    2. Select Bash.
    3. Click Mount storage account.
    4. Choose the provided Storage account subscription.
    5. Click Apply.
    6. Choose Select existing storage account.
    7. Click Next.
    8. Choose the provided Subscription, Resource Group, and Storage account name.
    9. Click Create file share.
    10. Give the file share the name cshell.
    11. Click Ok.
    12. Click Select.
  2. Challenge

    Set Up a .NET Web App in Azure App Service

    1. Create a new demonstration web application.

    2. Build the web application.

    3. 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.
  3. Challenge

    Update Your App and Upload to a Staging Slot

    1. Update your application.
    2. Create a staging slot.
    3. Deploy to the staging slot: a) Publish the updated code. b) Zip the deployment. c) ZipDeploy to the staging slot.
  4. Challenge

    Swap Staging and Production Slots

    Swap staging to production.

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

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.

Start learning by doing today

View Plans