Move Azure website between App Service Plans

◇◆丶佛笑我妖孽 提交于 2019-12-08 17:50:43

问题


Is it possible to move an Azure Website to a different (or new) App Service Plan?

I have already tried both the old and new portals but cannot find the options for this.


回答1:


The option "Change App Service plan" has been moved to the APP SERVICE PLAN menu.




回答2:


The original accepted answer is more than a year old. In Azure world, that's an eternity. The "Change App Plan" button in the Azure Portal is no longer present it appears (as of 2016-06-17), so I'm throwing in the Powershell command I needed to use in order to move a Webapp to another App Service Plan.

Set-AzureRmWebApp -Name <webapp name> -ResourceGroupName <resource group name> -AppServicePlan <new app service plan>
Set-AzureRmWebAppSlot -Name <webapp name> -Slot <slot name> -ResourceGroupName <resource group name> -AppServicePlan <new app service plan>



回答3:


Yes, you can do this from the Web app blade in the Azure portal. You have to expand the toolbar though to see the option. See below.




回答4:


I needed to move things between different subscriptions, which is quite possible according to documentation. Much is shamelessly copied from the azure website. This solution is taking advantage of the Azure Powershell 1.0.

First off, if you need to move a Web app and it's connected webfarm there are some limitations:

You can move Azure Web App resources using the ARM Move Resources Api.

Azure Web Apps currently supports the following move scenarios:

  • Moving the entire contents of a resource group (web apps, app service plans, and certificates) to another resource group.
    • Note: The destination resource group can not contain any Microsoft.Web resources in this scenario
  • Moving individual web apps to a different resource group, while still hosting them in their current app service plan (the app service plan stays in the old resource group)

Basically you need to get the resource id from the resources you want to move and use the Move-AzureRmResource command. You'll naturally need an Azure login which is able to read and write to the subscriptions involved.

$webapp = Get-AzureRmResource -ResourceGroupName OldGroup -ResourceName WebApp -ResourceType Microsoft.Web/sites

$plan = Get-AzureRmResource -ResourceGroupName OldGroup -ResourceName Plan -ResourceType Microsoft.Web/serverFarms

Move-AzureRmResource -DestinationResourceGroupName NewGroup -ResourceId ($webapp.ResourceId, $plan.ResourceId) -DestinationSubscriptionId xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

I'd point out that if you're moving the resources to another subscription, there are some caveats. First, that subscription must have rights to provision the website in that region, the API's for that are beyond this scope, but simply creating a website and removing it will give the subscription those rights. In my case i had a second error which is still unresolved, but i suspect that other resources that are connected to the resources being moved are the culprits. Will update with further information if i resolve the issue.

As a final note, there is also the possibility to use the REST API.



来源:https://stackoverflow.com/questions/32189610/move-azure-website-between-app-service-plans

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!