Host apps for SharePoint 2013 on a Microsoft Azure Cloud Service
Learn how to host a provider-hosted app for SharePoint on a Microsoft Azure cloud service instead of a web app, how to add an app for SharePoint to an Azure web role, and why hosting on Azure might be better than on a web app.
Last modified: August 13, 2014
The prerequisites for How to: Create a basic provider-hosted app for SharePoint.
The Microsoft Azure SDK for .NET (VS 2012) 1.8.1, which you can install by using the Web Platform Installer.
Add a cloud service to an existing app
If you already have a provider-hosted app for SharePoint that you want to host on Azure, choose the web app project in the solution for the app for SharePoint. On the menu bar, choose Project, Add Microsoft Azure Cloud Service Project. A Azure project, called NameOfTheWebAppProject.Azure, is added to the solution for your app for SharePoint. A web role for the web project is also added to the project for the Azure cloud service. The Office Developer Tools for Visual Studio 2012 sets the necessary project properties so that the web role can work with the app for SharePoint.
Figure 1 shows how an app for SharePoint is converted to use an Azure cloud service.
Add an app to an existing web role
If you already have a web role in an Azure cloud service that you want to use as a host for a provider-hosted app for SharePoint, open the Azure cloud project in Visual Studio, and then, in Solution Explorer, choose the web role project. On the menu bar, choose Project, Add App for SharePoint Project. A project for a provider-hosted app for SharePoint is created, called NameOfTheWebAppProject.Azure, and added to the solution. Visual Studio references the Azure web role as the web project host for the app for SharePoint.
Figure 2 shows how an app for SharePoint is added to an existing web role.
You can take advantage of the hosting services and scalability of Azure by migrating the web application of your provider-hosted app for SharePoint to an Azure Cloud Service. You can also enhance the performance and usability of your app for SharePoint, especially if the app is heavily used or demand for it changes over time. You can run a web application in Azure with minimal changes to your existing app for SharePoint. A Azure web role is, essentially, a website that's based on Internet Information Services (IIS) and hosted on Azure.
To understand how Azure can help, you need a little background information. A project for an app for SharePoint that's cloud-based (that is, provider-hosted) is typically associated with a web application project, or "web app." The web app is deployed and hosted outside of the SharePoint farm. Provider-hosted apps for SharePoint interact with a SharePoint site through a service in the web app and can also use resources and services that reside on the remote site.
See the following links for more information.
The web app for your app for SharePoint may reside on an on-premises server farm that requires hardware, facilities, and personnel to maintain. Azurehandles all of that for you, eliminating the expense and hassle of growing and maintaining a server farm. If the app for SharePoint ever requires more server resources, Azurecan dynamically allocate them to the app. By switching an app for SharePoint to use an Azurecloud service, you give your app more room to grow. See Autoscaling and Microsoft Azure.
If you already have a web role in Azure, you can leverage it by making it the host for your app for SharePoint, rather than creating a new web role for it. You can also package your website as an app for SharePoint and then publish it on the Office Store, potentially exposing your website to more customers.