Creating Provider-Hosted App in Office 365 and Azure Using VS 2013: Part 1

Introduction

Provider-hosted apps for SharePoint include components that are deployed and hosted outside the SharePoint Farm. They are installed to the host web, but their remote components are hosted on another server. In this article the website is hosted in the Microsoft Windows Azure and the app is installed in Office 365.

In this article you will perform the following procedure.

  1. Sign up for an Office 365 Developer Site
  2. Sign up for an Azure trial subscription
  3. Set up an App Catalog in Office 365
  4. Create a Provider-Hosted App using Visual Studio 2013
Sign up for an Office 365 Developer Site

Be sure you have access to an Office 365 Developer Site. Here are three ways to get one:
  • Are you an MSDN subscriber? Visual Studio Ultimate and Visual Studio Premium with MSDN subscribers receive an Office 365 Developer Subscription as a benefit. Redeem your benefit today.
  • Do you have one of the following Office 365 subscription plans?
                  Office 365 Midsize Business
                  Office 365 Enterprise E1, E3, E4, or K1
                  Office 365 Education A2, A3, or A4
                  Office 365 Government G1, G3, G4, or K1

If so, you can provision a Developer Site from the Office 365 admin center. For more information, see How to: Create a Developer Site within your existing Office 365 subscription.
Please refer to Sign up for an Office 365 Developer Subscription and set up your tools and environment for more details.

Sign up for an Azure trial subscription

Be sure you have access to a Windows Azure. Here is the way to get the trial subscription:
  • Navigate to the Azure Portal.
  • If prompted, log in using the credentials you created for your O365 subscription.
  • After logging in, you should see a screen notifying you that you do not have a subscription
  • Click Sign Up for Windows Azure.
  • Fill out the form to obtain your free trial.
  • You should provide the credit card details to register but it will not be charged.
Set up an App Catalog in Office 365

In SharePoint 2013 there is a special site collection that holds the apps called the App Catalog. There cannot be more than one App Catalog site collection in a web application or each web application can have only one App Catalog site collection. An app catalog is a dedicated site collection in a SharePoint 2013 web application (or a SharePoint Online tenancy) that hosts document libraries for apps for SharePoint and apps for Office. Administrators can upload apps for Office manifest files to the app catalog for use within their organization.

Please refer to How to set up an App Catalog on SharePoint 2013 Online for more details.

Create a Provider-Hosted App using Visual Studio 2013:
  1. Open Visual Studio.
  2. Go to File => New => Project.
  3. From the install templates, select Apps.
  4. Click on App for SharePoint.
  5. Enter the name for the project and then click on the Ok button



  6. In the New app for SharePoint wizard, enter the Office 365 SharePoint developer site URL and select Provider-hosted as the hosting model.



  7. Click on the Next button.
  8. Select ASP.NET MVC Web Application as the type of web application for this app.



  9. Click on the Next button.
  10. Select Use Windows Azure Access Control Service (for SharePoint cloud apps).



  11. Click on the Finish button.
  12. Enter the Office 365 administrator credentials in the pop-up to allow Visual Studio to access the Office 365 developer site.



  13. Visual Studio is creating the project.



  14. Provider-hosted app solution is created successfully as shown below.

    The solution contains the 2 projects MyFirstProvidedHostedApp and MyFirstProvidedHostedAppWeb.

    MyFirstProvidedHostedApp project contains the app manifest file that will have all the metadata required for the app that must be installed in the SharePoint.

    MyFirstProvidedHostedAppWeb project is the web application that will be deployed in the Azure environment.


In the next article you will see how to publish the web to Azure and register the app in Office 365.