次の方法で共有


Resource move validation failed. Cannot move Azure App Service

The scenarios in which you can and cannot move an Azure App Service are nicely documented here “App Service limitations”.  I also wrote an article about this as well here “Moving an Azure App Service”.

It is possible to move your Azure App Service between subscriptions and resource groups.  Like I have stated many times though, you cannot, with a click, physically move an App Service Plan nor an App Service (unless they remain in the same tenant).  Remember the logical hierarchy is: Subscription –> Resource Group –> App Service Plan –> App.  The App Service Plan and App have a physical/virtual relationship and a logical one, which is why they simply cannot be moved by a clickity-clack, don’t talk back (*).

One of the scenarios I got asked about was about the following:

“App Service resources can only be moved from the resource group in which they were originally created. If an App Service resource is no longer in its original resource group, it must be moved back to that original resource group first, and then it can be moved across subscriptions.”

The question was how to see if the App Service was previously in a different resource group and which one it was in.

If this happens in real-time the ERROR DETAILS explain it for you.  Here is what I got when I reproduced the error:

“Cannot move resources because some site(s) are hosted by other resource group(s) but located in resource group 'MOVEIT-MOVEIT-AGAIN'. The list of sites and corresponding hosting resource groups: 'sitename1:PARKED-DB3-001,sitename2:PARKED-DB3-001,sitename3:PARKED-DB3-001,sitename4:PARKED-DB3-001,sitename5:PARKED-DB3-001,sitename5:PARKED-DB3-001'. This may be a result of prior move operations. Move the site(s) back to respective hosting resource groups and try again. (Code: BadRequest, Target: Microsoft.Web/serverFarms)”

But, I was asked the question and here is the answer I have.  The simplest way I could see the current and previous Resource Group was by using the Azure PowerShell cmdlet Get-AzureRmResource as seen below, the output is shown in Figure 1.  The current Resource Group name is the value under the ResourceGroupName heading and the original Resource Group is under the Tags heading.

 
Get-AzureRmResource
   -ResourceId "/subscriptions/<SUB-ID>/resourceGroups/<RG-NAME>/resources" 
  | select Name, ResourceType, ResourceGroupName, Tags

image

Figure 1, how to see original Resource Group of an Azure App Service

You can also see the same in Resource Manager here, but it is not as friendly, see Figure 2.

image

Figure 2, how to see original Resource Group of an Azure App Service

Now you know and so do I.