How To Clone An Azure Web App?

Part Nine: A Simple Guide to Cloning an Azure Web App using PowerShell and Azure Portal.
7 minutes read
November 18, 2020

Table of Content

Share this


This is the ninth article 🎉 in the “Getting Started with Azure App Service” Series where I publish in-depth tutorials and walkthroughs on using Azure App Service and best practices every week. In the last article, we discussed how you can set up Easy Auth for Azure App Service.

There might be a time when you’d be using Azure App Service and think if you could make an identical copy of a web application and test it externally without affecting any production workloads. App Service clone feature is here to rescue you.

This week, we are looking at how to clone Azure App Service that you can use either for testing something on identical environment if you have a production application already, or you are simply learning what the possibilities are while using App Service. Let’s dive right in!


If you decide to follow along, confirm the following pre-requisites before you begin.

  • Be sure that you have the latest version of PowerShell installed. You can use Cloud Shell if you prefer to stay within Azure Portal.
  • Your app service plan should be running on at least Standard Tier to perform the clone on the application. This operation cannot be performed on the Basic/Free Tier applications.
  • You need a running Web App to perform the test. Follow alone once you have a POC web application to test the following steps.

Cloning Web App Using Azure Portal

Suppose you want to move your application from Canada Central to West US, it can be accomplished using Azure Portal or PowerShell command that will create a clone of your current application in the new region.

If you prefer to use Azure Portal instead of PowerShell for the clone, follow the steps below. It’s fairly easy to perform the clone in a few clicks instead of going through PowerShell.

  • Navigate to Azure Portal and your Web App resource.
  • On the left side blade, choose “Clone” option.
  • Use the following screenshot and the steps below to follow
  • Fill out the name for new web application and pick a resource group where you’d like to deploy it.
  • You have the option to create a new App Service Plan in either the same or different region. Create one with a name of your choice.
  • Under Clone Setting, make sure you enable the feature that you’d like to clone with the application.
  • You can turn ON the “Application Insights” optionally.

The clone should take only a few minutes and you should see new resources in your destination resource group as shown in the screenshot below.

Cloning Web App Between Regions using PowerShell

If you are PowerShell fan, follow the instructions below to achieve the same results as with Azure Portal.

Before you run the command, you would want to confirm your application name and the resource group it resides in. Use the following command to prepare your source information of the application and replace the value of resourcegroupname and name that matches your environment names.

$srcapp = Get-AzWebApp -ResourceGroupName "RGNAME" -Name "AppName"

Once you run this command, it will store the information about your application in a variable called srcapp that we can use later to use during the clone command.

Since your new app will sit in a different region, you’d need to create an App Service Plan that matches your destination region. You can use Azure Portal to do this or follow the command below to achieve the same results. I assume the destination location to be west us. Be sure to use Standard tier as it is the minimum plan required for cloning application..

New-AzAppServicePlan -Location "West US" -ResourceGroupName "DestRGName" -Name "DestAppPlanName" -Tier Standard

Cloning a Standalone Web App to New Region

Next up is the step to perform the clone on the new application. Use the following commands to create a new web app using an existing application as a source app. Pay attention to the flag SourceWebApp as we are using that to point to the already available application.

$destApp = New-AzWebApp -ResourceGroupName "DestRGName" -Name "dest-webapp" -Location "West US" -AppServicePlan "DestAppPlanName" -SourceWebApp $srcApp

The script output should be minimal as shown in the image below:
PowerShell Results for Standalone App Clone

You should see a similar view in your account with new resources in West US.
Portal View of Standalone App Clone

Cloning a Web App With App Slots

If you have any slots configure for your application and would like to clone them as well along with the source app, use the following commands to achieve the desired results. We are only introducing one new flag IncludeSourceWebAppSlots at the end.

$destApp = New-AzWebApp -ResourceGroupName "DestRGName" -Name "dest-webapp" -Location "West US" -AppServicePlan "DestAppPlanName" -SourceWebApp $srcApp -IncludeSourceWebAppSlots

PowerShell results from the script are below:
PowerShell Results for App Slot Clone

As you can also see from the screenshot below, all the slots from the source would be available in the new region once cloned.
Portal View of App Slot Clone

Cloning a Web App to Same Region

The same steps can be performed to clone an application in same region as well. You’d still need to create a new App Service Plan and use that to host the new applications. All the steps would be similar to perform the clone as it was a different region.

Cloning Existing App Slot Only

There can be a case where you would only want to clone an app slot to either a new application or to a new slot for many different regions. The new app can be either in same or different region than the original app.

Follow through the steps below to see how you can create a new application from an existing slot. The command below takes a snapshot variable that holds the information about an existing application.

$srcAppSlot= Get-AzWebAppSlot -ResourceGroupName "SourceRGName" -Name "SourceApp" -Slot "SourceAppSlot"

Once you have the source app information in a variable srcAppSlot, you can use that to create a new application using SourceWebApp flag in the New-AzWebApp command.

#Create a new App Service PlanNew-AzAppServicePlan -Location "West US" -ResourceGroupName "DestRGName" -Name "DestAppPlanName" -Tier Standard#Create new Web App$destApp = New-AzWebApp -ResourceGroupName "DestRGName" -Name "DestApp" -Location "West US" -AppServicePlan "DestAppPlanName" -SourceWebApp $srcAppSlot

Here are final PowerShell results:
PowerShell Results for Slot Only Clone

You should also notice some new resources in your destination resource group now.
Verification for Slot Only Clone


  • Autoscale settings are not cloned. You would have to migration your scale settings manually if you have any.
  • The backup setting is tied to Web App resource which you’d need to create once the application is up and running in the new region.
  • VNET settings are not cloned. However, the Outbound IP address of the application will change if application is clone to different scale unit.
  • App Insights would have to be configured with the new web app as they don’t migrate with the clone.
  • Easy Auth settings and Kudu Extension are not cloned.
  • Database content is not cloned to new application.
  • Unfortunately, you can only clone Windows App as of now.


If it’s your first time here, please check out other articles in the series:

Part 1: Up and Running with Azure App Service

Part 2: Continuous Deployment for Azure App Service

Part 3: Using Deployment Slots with Azure App Service

Part 4: Setup Custom Domain for Azure App Service

Part 5: Deploying Next.JS App on Azure App Service

Part 6: Next.JS App with Cosmos DB on Azure App Service

Part 7: Why Should You Use Azure App Service?

Part 8: Easy Auth for Azure App Service

Part 9: How To Clone An Azure Web App?

Stay wired with our newsletter!

Recommended Articles

Stay Up To Date with
Cloud News and Tutorials!

Subscribe to our weekly newsletter!

By entering your email address, you agree to our privacy policy.