Freigeben über


Move Azure Website from one AppServicePlan to another

Here are the steps to move Azure Websites from one AppServicePlan to another.

 

write-host "trying to load azure dlls"

Import-module azure

 

write-host "trying to log into Azure"

#Select-AzureSubscription -Default "Microsoft Azure Internal Consumption"

#Add-AzureAccount

#Login-AzureRmAccount

 

 

$AzureSubscription = "<GUID>"

$ResourceGroupName = "InternalConsumptionResourceGroup"

$WebsiteName = "nptesting"

$NewAppServicePlanName = "My2ndAppServucePlan"

# $NewAppServicePlanName = "InternalConsumptionAppServicePlan"

 

$NewServerFarmId = "/subscriptions/" + $AzureSubscription + "/resourceGroups/" + $ResourceGroupName + "/providers/Microsoft.Web/serverfarms/" + $NewAppServicePlanName

 

write-host "trying to get website details"

$websiteResource = Get-AzureRMResource -ResourceType "microsoft.web/sites" -ResourceGroupName $ResourceGroupName -ResourceName $WebsiteName

$websiteResource.Properties.ServerFarmId = $NewServerFarmId

 

write-host "trying to udpate website details"

$websiteResource | Set-AzureRmResource -Force

 

write-host "done changing ASP"

 

Exit