This article explains the steps involved in deploying a sharepoint provider-hosted app to Azure and installing the app on the sharepoint tenant.
To start with, I have created a provider-hosted MVC app which allows user to vote on certain survey questions and also displays current result of the survey in the form of a Pie chart. Now, I want to deploy this app to Azure. This can be done in 10 simple steps. Easy right? Lets get started!
- Create a simple web site (or with the new app services launch lets call it web app) from windows azure portal. Follow this tutorial’s How to: Create a web app Using the Azure Portal section if you don’t already know how to do that.
- Download the publish profile from the web app’s dashboard.
- In Visual studio, right click the sharepoint app (not the web app) and say Publish
- It opens up ‘Publish your app’ page. You won’t have any Publish profiles the first time so click on New in the Current Profile drop down.
- Import the downloaded publish profile. (Here we can create new profile and skip the part above where we created the web app from windows azure portal and downloaded the profile. This wizard would do that on our behalf)
- Put ClientId and Client Sercret on the next screen (You can generate this from the appregnew.aspx page in sharepoint tenant. But DO NOT CREATE THE APP THERE). and click finish. This publishes your app on azure. Yeyy! Wait!! we are not done yet.
- On Azure portal, in the web app created go to the configure tab and add clientID and Client secret in the app settings as azure refers to these config entries and not the web.config.
- In the ‘Publish your App’ in visual studio, click on the ‘Package the app’ which creates a ‘.app’ file on your local disk
- Install the app on your Sharepoint tenant.
- Go to ‘Apps in Testing’
- Add new Item
- Browse to the .app file created in step 8 and select it.
- Click on Deploy
- Now if you click on the installed app in ‘Apps in Testing’, it should navigate to the azure web site and display the app correctly.
Here you go! We have our sharepoint app running on azure. More details about this app coming up soon. Stay tuned!