Loading...

Azure Tips and Tricks - How to use Deployment Slots in Azure App Service for Containers

Azure Tips and Tricks - How to use Deployment Slots in Azure App Service for Containers

How to use Deployment Slots in Azure App Service for Containers

 

 

Managed features for containerized applications

 

Using containers is a great way to make sure that your application can run anywhere and that it runs in the same environment, anywhere. In Azure, you can run containers in many services, including in Azure Kubernetes Service, Azure Container Instances, Azure Service Fabric and more. And you can also run containers in Azure App Service. Running containers in Azure App Service enables you to use features like deployment slots and easy authentication and authorization.

 

In this post, we'll take a look at using deployment slots for containers in Azure App Service.

 

Prerequisites

 

If you want to follow along, you'll need the following:

  • An Azure subscription (If you don't have an Azure subscription, create a free account before you begin)
  • Follow the instruction in Tip 236, to deploy an ASP.NET Forms application in a Windows container to Azure App Service

 

Using deployment slots

 

Deployment slots in Azure App Service help you to deploy new features of your app without any downtime. Let's see how we can do that with a containerized application. We'll start with an ASP.NET app that is already containerized and deployed to an Azure App Service.

  1. Go to the Azure portal
  2. Navigate to the Azure App Service
  3. In the overview blade, click on Browse to see the application that is running in a container in the App Service.

Application running in App ServiceApplication running in App Service

  1. The App Service gets the container from Docker Hub (opens new window), and you can also use Azure Container Registry (opens new window). We are going to change the application, publish a new version of the container image to the container registry and deploy that to a deployment slot. Open The application in Visual Studio and make a visible change to it
  2. In Visual Studio, right-click the project file and click Publish
  3. In the Publish window, change the Image Tag to something else than "latest"
  4. Click Publish to publish the new version of the application in a container to the container registry

Publish window in Visual StudioPublish window in Visual Studio

  1. Go back to the Azure portal and back to the App Service
  2. Select the Deployment slots menu
  3. We currently have no deployment slots, so let's add one by clicking on Add Slot
  4. Provide a name for the deployment slot
  5. Click Add
  6. You'll now see the new slot in the list of deployment slots. Click on it
  7. When the deployment slot is opened, it looks exactly the same as the App Service. That is because a deployment slot is another instance of an App Service that runs in the same App Service Plan. This means that you can use almost all App Service features in a deployment slot and that you don't pay extra for it. Go to the Container settings menu in the deployment slot
  8. In Container Settings, change the Full Image Name and Tag, so that it points to the latest version of the application
  9. Click Save
  10. Go back to the Overview blade and click Restart to restart the App Service. Now wait a few minutes and click Browse to see the new version of the app in action

New version of the app in a deployment slotNew version of the app in a deployment slot

The new version of the application runs in a deployment slot. The slot has almost the same URL as the original App Service (the production slot), only appended with the slot name, like container-tricks-staging.azurewebsites.net

  1. Now for the magic part of deployment slots, the swap. Go to the Deployment slots menu again
  2. Click on the Swap button
  3. Leave everything as it is and click Swap. This will warm up the staging slot and "swap" it with the production slot, to seamlessly deploy the new version of the application to production, without any downtime

Swap deployment slotsSwap deployment slots

  1. In the Deployment slot blade, click on the production slot
  2. Click on Browse in the overview blade to see the app that is running in production

New version of the app in productionNew version of the app in production

The latest version of the app is now running in production. If you check the deployment slot, you'll find that it is now running the old version of the app. This allows you to easily revert a deployment, by simply swapping back.

 

Conclusion

 

Deployment slots are a powerful feature of Azure App Service that allows you to deploy without any downtime. You can use them for containerized application with Azure App Service for Containers. Create a trial account today and go and check it out!

Published on:

Learn more
Azure Developer Community Blog articles
Azure Developer Community Blog articles

Azure Developer Community Blog articles

Share post:

Related posts

Boost your Azure Cosmos DB Efficiency with Azure Advisor Insights

Azure Cosmos DB is Microsoft’s globally distributed, multi-model database service, trusted for mission-critical workloads that demand high ava...

1 day ago

Microsoft Azure Fundamentals #5: Complex Error Handling Patterns for High-Volume Microsoft Dataverse Integrations in Azure

🚀 1. Problem Context When integrating Microsoft Dataverse with Azure services (e.g., Azure Service Bus, Azure Functions, Logic Apps, Azure SQ...

1 day ago

Using the Secret Management PowerShell Module with Azure Key Vault and Azure Automation

Automation account credential resources are the easiest way to manage credentials for Azure Automation runbooks. The Secret Management module ...

2 days ago

Microsoft Azure Fundamentals #4: Azure Service Bus Topics and Subscriptions for multi-system CRM workflows in Microsoft Dataverse / Dynamics 365

🚀 1. Scenario Overview In modern enterprise environments, a single business event in Microsoft Dataverse (CRM) can trigger workflows across m...

2 days ago

Easily connect AI workloads to Azure Blob Storage with adlfs

Microsoft works with the fsspec open-source community to enhance adlfs. This update delivers faster file operations and improved reliability f...

3 days ago

Microsoft Azure Fundamentals #3: Maximizing Event-Driven Architecture in Microsoft Power Platform

🧩 1. Overview Event-driven architecture (EDA) transforms how systems communicate.Instead of traditional request–response or batch integration...

3 days ago

Azure Developer CLI (azd) – October 2025

This post announces the October release of the Azure Developer CLI (`azd`). The post Azure Developer CLI (azd) – October 2025 appeared f...

4 days ago

Microsoft Azure Fundamentals #2: Designing Real-Time Bi-Directional Sync Between Dataverse and Azure SQL for Multi-Region Deployments

Here’s a detailed technical breakdown of designing a real-time bi-directional sync between Dataverse and Azure SQL for multi-region deployment...

4 days ago

Azure DevOps local MCP Server is generally available

Today we are excited to take our local MCP Server for Azure DevOps out of preview 🥳. Since the initial preview announcement, we’ve work...

5 days ago

Announcing the new Azure DevOps Server RC Release

We’re excited to announce the release candidate (RC) of Azure DevOps Server, bringing new features previously available in our hosted version....

11 days ago
Stay up to date with latest Microsoft Dynamics 365 and Power Platform news!
* Yes, I agree to the privacy policy