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

In my previous article Creating Provider-Hosted App in Office 365 and Azure Using VS 2013: Part 1 you saw how to 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.

In this article you will perform the following procedure:

  1. Publish the web to Microsoft Azure Websites.
  2. Register the App in Office 365.
  3. Configure the app settings for Azure Website.

Publish the web to Microsoft Azure Websites

  1. In the Solution Explorer, right-click on MyFirstProvidedHostedApp and then click on Publish.

    publish

  2. Select the publish target as Microsoft Azure Websites.

    ms azure websites

  3. In the Select Existing Website wizard, click on the Sign In button.

    sign in

  4. Enter the email address of the Azure account.

    enter enail

  5. Click on the Continue button.

  6. Enter the Azure credentials and then click on the Sign in button.

    sign in button

  7. Once you have signed in, click on the New button to create a new website in Azure.

    new website

  8. Enter the Site Name, select the Region and then click on the Create button.

    select region

  9. Create a new website in Azure.

    website creating

  10. In the Publish web wizard, click on the Publish button.

    publish web

  11. The site is opened in a new tab and you will be getting an error message as shown below. This is because we have not yet configured the app settings, that will be done in a later section. Save the site URL (http://myfirstprovidedhostedapp.azurewebsites.net/) separately for later use that will be used when configuring the app.

    save url

Register the app in Office 365

  1. Log into the O365 developer site as an administrator (Example: https://c986.sharepoint.com/).

  2. From the developer site, navigate to /_layouts/15/appregnew.aspx (Example: https://c986.sharepoint.com/_layouts/15/appregnew.aspx).

  3. Click Generate next to the Client ID.

  4. Click Generate next to the Client Secret.

  5. Enter First Provider Hosted App as the Title.

  6. Enter the App Domain for the Azure web site you created earlier (for example: myfirstprovidedhostedapp.azurewebsites.net).

  7. Enter the Redirect URI as the reference for the page (for example: https://myfirstprovidedhostedapp.azurewebsites.net/). Make sure you add the reference URL with the https protocl.

  8. Click on the Create button.

    click create

  9. The App identifier is created successfully as shown below. Save the Client ID and Client Secret separately for later use.

    save client id

Configure the app settings for Azure Website

  1. Log into the Windows Azure portal as an administrator.

  2. Click on Websites in the left navigation. You could be able to see the website that we have deployed previously.

    websites

  3. Click on the website.

  4. Click on the Configure tab.

    configure tab

  5. Go to the app settings section and create the following entries. (Copy the Client Id and Client Secret that we have generated in Office 365 previously).

    app settings

  6. Save the changes.

In the next article you will see how to publish the app and add the app to the Office 365 developer site.

Up Next
    Ebook Download
    View all
    Learn
    View all