AzureTipsAndTricks/blog/tip111.md

2.6 KiB

type title excerpt tags date
post Tip 111 - Deployment Slots for Web Apps using the Azure CLI Learn how to work with deployment slots with this quick tutorial
Management and Governance
Web
2018-04-02 17:00:00

::: tip 💡 Learn more : Azure Command-Line Interface (CLI). :::

This post was brought to you by Lohith (kashyapa).

Deployment Slots for Web Apps using the Azure CLI

What are Deployment Slots?

Deployment Slots are a feature of Azure App Service. They actually are live apps with their own hostnames. You can create different slots for your application (for e.g. Dev, Test or Stage). The Production slot is the slot where your live app resides. With deploymet slots, you can validate app changes in staging before swapping it with your production slot. You can read more about deployment slots here.

Pre-Requisites

  • Microsoft Azure Subscription (Sign up for free/ "Create your Azure free account today"))
  • Microsoft Azure CLI (Install from here)

Log in to Azure

Before executing any Azure CLI commands, you will need to login first.

  • Open Command Prompt or a Powershell session
  • Enter following command:

az login

The command will prompt you to log in with an authentication code via a website.

Listing Deployment Slots

To list deployment slots in an Azure App Service, execute the following command:

az webapp deployment slot list -n "web app name" -g "resource group name"

Creating Deployment Slot

To create a new deployment slot in an Azure App Service, execute the following command:

az webapp deployment slot create -n "web app name" -g "resource group name" -s "deployment slot name"

Swapping Deployment Slot

To swap a deployment slot in an Azure App Service, execute the following command:

az webapp deployment slot swap -n "web app name" -g "resource group name" -s "source slot name" --target-slot "target slot"

Deleting a Deployment Slot

To delete a deployment slot in an Azpp Service, execute the following command:

az webapp deployment slot delete -n "web app name" -g "resource group name" -s "deployment slot name"

Conclusion