HOW TO: Deploy a provider hosted app as an Azure site

Published 05-01-2019 03:50 PM 398 Views
Microsoft

First published on TECHNET on Sep 05, 2013

This post is a contribution from Charls Tom Jacob, an engineer with the SharePoint Developer Support team.

In this blog, I will describe the steps to deploy a provider hosted app on Windows Azure hosted site (same steps should work for any IIS sites for that matter).  The app will be deployed into SharePoint Online site, whereas the underlying business logic will reside on a separate server.  It could be an on-premise server or a server provided by a hosting company.  For this blog post, I decided to use a site hosted on Azure.

1. Create a provider hosted app project in Visual Studio 2012.

2. Select ACS.

3. Navigate to your App Catalog site collection URL (/_layouts/15/appregnew.aspx).

a. Generate a Client ID and Client Secret.

b. Make sure to give correct values for AppDomain and Redirect URL. This should be corresponding to where you want to host your app web.

4. Publish the App project by specifying the same Redirect URL, Client ID and Client Secret as in the previous step.

5. This gives you the deployable units as below.

a. Rename the .app file to .zip and verify that app manifest contains the correct Client ID.

6. Upload the app to the App Catalog site collection in your SharePoint site.

7. Modify the AppWeb web.config file to include the Client ID and Client Secret as shown below.

8. Deploy the web site to the desired location using any of the publishing methods available.

9. Add the app to one of the sites and launch it.

NOTE : You will run into “The parameter ‘token’ cannot be null or empty string” error if you make a mistake in the Client ID and/or Client Secret or redirect URL.

Hope this walk-through was helpful!

%3CLINGO-SUB%20id%3D%22lingo-sub-509863%22%20slang%3D%22en-US%22%3EHOW%20TO%3A%20Deploy%20a%20provider%20hosted%20app%20as%20an%20Azure%20site%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-509863%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSTRONG%3E%20First%20published%20on%20TECHNET%20on%20Sep%2005%2C%202013%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EThis%20post%20is%20a%20contribution%20from%20Charls%20Tom%20Jacob%2C%20an%20engineer%20with%20the%20SharePoint%20Developer%20Support%20team.%3C%2FP%3E%0A%3CP%3EIn%20this%20blog%2C%20I%20will%20describe%20the%20steps%20to%20deploy%20a%20provider%20hosted%20app%20on%20%3CA%20href%3D%22http%3A%2F%2Fwww.windowsazure.com%2Fen-us%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%20Windows%20Azure%20%3C%2FA%3E%20hosted%20site%20(same%20steps%20should%20work%20for%20any%20IIS%20sites%20for%20that%20matter).%26nbsp%3B%20The%20app%20will%20be%20deployed%20into%20SharePoint%20Online%20site%2C%20whereas%20the%20underlying%20business%20logic%20will%20reside%20on%20a%20separate%20server.%26nbsp%3B%20It%20could%20be%20an%20on-premise%20server%20or%20a%20server%20provided%20by%20a%20hosting%20company.%26nbsp%3B%20For%20this%20blog%20post%2C%20I%20decided%20to%20use%20a%20site%20hosted%20on%20Azure.%3C%2FP%3E%0A%3CP%3E1.%20Create%20a%20provider%20hosted%20app%20project%20in%20Visual%20Studio%202012.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20523px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F111509i656C249B89B17E0D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E2.%20Select%20ACS.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20525px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F111510iBB377E8323D2EC3D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E3.%20Navigate%20to%20your%20App%20Catalog%20site%20collection%20URL%20(%2F_layouts%2F15%2Fappregnew.aspx).%3C%2FP%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3Ea.%20Generate%20a%20Client%20ID%20and%20Client%20Secret.%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3Eb.%20Make%20sure%20to%20give%20correct%20values%20for%20AppDomain%20and%20Redirect%20URL.%20This%20should%20be%20corresponding%20to%20where%20you%20want%20to%20host%20your%20app%20web.%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20563px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F111511i45B2C806EC68040D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3CP%3E4.%20Publish%20the%20App%20project%20by%20specifying%20the%20same%20Redirect%20URL%2C%20Client%20ID%20and%20Client%20Secret%20as%20in%20the%20previous%20step.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20534px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F111512iCD10361DF62233CF%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E5.%20This%20gives%20you%20the%20deployable%20units%20as%20below.%3C%2FP%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3Ea.%20Rename%20the%20.app%20file%20to%20.zip%20and%20verify%20that%20app%20manifest%20contains%20the%20correct%20Client%20ID.%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20546px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F111513iF846E51302A90ECE%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3CP%3E6.%20Upload%20the%20app%20to%20the%20App%20Catalog%20site%20collection%20in%20your%20SharePoint%20site.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20538px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F111514i68402C1740238E9B%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E7.%20Modify%20the%20AppWeb%20web.config%20file%20to%20include%20the%20Client%20ID%20and%20Client%20Secret%20as%20shown%20below.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20538px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F111515iB3A60AB3A49EB41B%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E8.%20Deploy%20the%20web%20site%20to%20the%20desired%20location%20using%20any%20of%20the%20publishing%20methods%20available.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20540px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F111516i20338ECB4BDD95FF%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E9.%20Add%20the%20app%20to%20one%20of%20the%20sites%20and%20launch%20it.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20540px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F111517i1B06216D7B6F9728%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ENOTE%20%3C%2FSTRONG%3E%20%3A%20You%20will%20run%20into%20%E2%80%9CThe%20parameter%20%E2%80%98token%E2%80%99%20cannot%20be%20null%20or%20empty%20string%E2%80%9D%20error%20if%20you%20make%20a%20mistake%20in%20the%20Client%20ID%20and%2For%20Client%20Secret%20or%20redirect%20URL.%3C%2FP%3E%0A%3CP%3EHope%20this%20walk-through%20was%20helpful!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-509863%22%20slang%3D%22en-US%22%3E%3CP%3EFirst%20published%20on%20TECHNET%20on%20Sep%2005%2C%202013%20This%20post%20is%20a%20contribution%20from%20Charls%20Tom%20Jacob%2C%20an%20engineer%20with%20the%20SharePoint%20Developer%20Support%20team.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-509863%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Version history
Last update:
‎Sep 01 2020 02:29 PM
Updated by: