Setting up provider hosted app to Windows Azure for Office365 tenant


One thing I get lot of questions all the time privately is the detailed steps on how to setup the provider hosted apps to be running in Windows Azure. One common question is that how the personal site branding app can be setup properly with Office365 tenant.

To show this one in practice, I’ve created quick video where we install the personal site branding app to Windows Azure and configure it to work in Office365 for any user. This is pretty easy task, but wanted to ensure that you can actually achieve this as well easily by mimicking the steps from this video. There are obviously lot of additional other capabilities in Windows Azure, but this should help you to get started with the provider hosted apps for Office365.

Video is available for download from my SkyDrive if needed for offline purposes.

References

Few useful links and recourses on the topic


Comments (6)

  1. Sonam says:

    Hi, thanks for the blog.

    I have added the app under site collection and it is visible there under site contents.

    but when I try to add it in Site Page – it is not listed under App Part. Please Guide.

  2. sonofthesun says:

    Hi Sonam,

    first thing to check is that you have specifically added app part to the app it self, so that it will be visible in the App Part gallery selection. If you do not have app part definition in the app project, you will only have so called full page experience of the app by clicking the app icon from the site contents page.

  3. Sonam says:

    Thanks Vesa. The issue got resolved after adding web part in app project. Thanks for the wonderful blog.

  4. Rehan says:

    Excellent blog – very clear and easy to follow!!

  5. Chakrapani says:

    Hi ,this is what i'm getting ,please help

    Server Error in '/' Application.

    ——————————————————————————–

    The remote server returned an error: (400) Bad Request.

     Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Net.WebException: The remote server returned an error: (400) Bad Request.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

    Stack Trace:

    [WebException: The remote server returned an error: (400) Bad Request.]

      System.Net.HttpWebRequest.GetResponse() +1465

      Microsoft.IdentityModel.S2S.Protocols.OAuth2.OAuth2WebRequest.GetResponse() +241

      Microsoft.IdentityModel.S2S.Protocols.OAuth2.OAuth2S2SClient.Issue(String securityTokenServiceUrl, OAuth2AccessTokenRequest oauth2Request) +57

    [RequestFailedException: Token request failed.]

      Microsoft.IdentityModel.S2S.Protocols.OAuth2.OAuth2S2SClient.Issue(String securityTokenServiceUrl, OAuth2AccessTokenRequest oauth2Request) +156

      PersonalInfoWeb.TokenHelper.GetAccessToken(String refreshToken, String targetPrincipalName, String targetHost, String targetRealm) +115

      PersonalInfoWeb.TokenHelper.GetAccessToken(SharePointContextToken contextToken, String targetHost) +103

      PersonalInfoWeb.SharePointAcsContext.<get_UserAccessTokenForSPHost>b__0() +26

      PersonalInfoWeb.SharePointAcsContext.RenewAccessTokenIfNeeded(Tuple`2& accessToken, Func`1 tokenRenewalHandler) +58

      PersonalInfoWeb.SharePointAcsContext.GetAccessTokenString(Tuple`2& accessToken, Func`1 tokenRenewalHandler) +13

      PersonalInfoWeb.SharePointAcsContext.get_UserAccessTokenForSPHost() +59

  6. sonofthesun says:

    Hi Chakrapani,

    this simply means that there's something wrong on the registration. One common challenge is that app.config file deployed to Azure is not updated accordingly. I'd double check the registered ClientId, Secret and the URL used for the provider hosted add-in. I'd also use Azure admin UI to assign ClientId and Secret to the provider hosted add-in which is running at Azure side.

    I'd also suggest to use Office 365 Developer Patterns and Practices Yammer group for this kind of questions where we have more than 3500 community members helping each other at aka.ms/OfficeDevPnPYammer.