In today's tutorial, you will learn how to host an Umbraco website within Azure. Recently, I decided to move this website out of Wordpress and into Umbraco to be hosted within Azure. Over the years, Azure pricing has become more reasonable and combined with the ease of set-up, it seemed a no-brainer to put some time and effort into migrating.
In this guide, I'm going to assume you created your Umbraco application the traditional way, within Visual Studio and you are now in a position to upload a working website into the cloud. This page might look quite long, but the steps are pretty easy.
Your first step is to head over to the Azure portal and log-in, https://portal.azure.com. In here you will see a pretty overwhelming dashboard, but after a few hours, it gets pretty familiar, pretty quickly. I decided to use a Web App and Azure SQL to host my application, rather than a virtual server. To get your Umbraco site up and running you'll need a few things:
- A Resource Group
- An App Service Plan
- A SQL Server
- A web app, to upload your Umbraco files into
- An Azure DB, to host your Umbraco database
With all costs included, my set-up costs me about £2 a day which is pretty cheap! First, we will create a resource group.
On the top-left hand side, click the 'New' button.
In the search box, type in the resource group and select it.
Find the resource group in the list and click 'Create'
The resource group can be thought of as a parent container where you will add all your web apps and sql database. The resource group defines where in the world your apps will be created. After you create your apps you can't change the location easily, so you need to make sure you set this up correctly first time around.
Note, you need to have your SQL database and your web app in the same resource group and geographic location, otherwise, your website's performance will be terrible. I used different resource groups the first time I set-up Umrbaco with Azure by accident and it took about 2 minutes for Umbraco to load a pretty simple page.. so it you run into massive performance issues, check this one out first.
Next, we need to create an 'App Service plan'. This will determine the amount of resources your app will have available to it. In the main dashboard, click on the 'New' button and search for 'App Service plan'
App Service Plan -. Get your plan a name, it doesn't really matter what as no one will see it.
Resource Group-> Use the resource group you created above
Location -> Important, this must be the same as resource group
Pricing -> I used the standard S! but up to you
Now we have an app plan, we need a SQL server. Again, through the portal, click 'New' and search for SQL server
Add in your SQL details, the name, admin log-in and password will be the details you'll add in your Umbraco connection string. Again, choose the resource group you created in step one and then make sure you choose the same location. After you have a resource group, an app plan, and a SQL server configured, we can do the rest in Visual Studio!
In Visual Studio, open up your Umbraco project, right-click on the website and select 'Publish'. When the Visual Studio Publish dialog opens, select the Azure Web Apps option.
Log into your Azure account, and select the 'New' button on the right.
Now give your app a name, like 'Umbraco Website', select the resource group, the app service plan and the SQL server password you created above. Click create and Azure will create a database and website for you. It goes without saying that when the app has been created and you click the final Publish upload within Visual Studio, you obviously need to make sure you have the right connection details in your web.config. I won't cover .config transforms in this guide, but that's the next step, make sure your release file contains the Azure SQL connection details.
Warning Ok, so far you have created the web apps you need to host your application in the cloud within Azure and you have copied your web files into Azure. You will still need to upload your database into Azure. The first time you use the Visual Studio publish, it will create a blank database for you, but, obviously this no good.
To learn how to upload your database read part two, How To Setup Umbraco With Azure - Part Two - Uploading A Database