Azure website - how to change web hosting plan

In Windows Azure Websites Microsoft have introduced a concept called a web hosting plan. This allows you to control a group of websites all at once and makes for changing their hosting settings easier. The problem is, they haven’t yet introduced a way through the Portal to change theweb hosting plan for a website.

So if you’ve got a bunch of free websites and want to promote one of them to shared hosting, you’ll find that changing one changes them all – because hosting options are now configured at the web hosting plan, not the individual websites. When they introduced this change they created a default group for all your existing websites and you’ll find they are all grouped together.

If there’s no way to change this through the Azure Portal UI, how do you do it? Time to crack out the PowerShell. Open a Windows Azure PowerShell session and run through the following.



Switch to Azure resource mode

Switch-AzureMode AzureResourceManager

Create dictionary to represent the newweb hosting plan (note the fact that we’re setting the ‘serverfarm’ property here)
$whp=@{"serverfarm" = "<newplan>";}

Apply the changes
Set-AzureResource -name <sitename> -ResourceGroupName <groupname> -ResourceType Microsoft.Web/sites -apiversion 2014-04-01 -PropertyObject $whp

So the above works if you’ve already got a second web hosting plan to change the website(s) into. How do you create a new web hosting plan? The non-PowerShell way is described over at this article. Essentially – creating a new website, and specify to create a new hosting plan when creating it.

Microsoft have published an In Depth Overview of Azure Web Sites Hosting Plans if you want more detail on the above.