none
VS2013 Cloud Business App (Lightswitch) provider hosted Azure/Sharepoint

    Question

  • Has anyone ACTUALLY made this work?

    • VS2013
    • Cloud Business App (HTML)
    • Provider Hosted - Azure
    • SharePoint 2013 online version

    When I launch my app in production, at best I am getting kicked to the browser search screen, or I am told I don't have permissions.  I have had little glimpses of hope where it appears to work, but as soon as I upgrade I end up with the above again.

    Am I performing the impossible?

    Thanking you in advance

    Monday, October 07, 2013 11:46 AM

All replies

  • I could be wrong, but I think 'Cloud Bus App' is auto-hosted only.  Meaning you have to let O365 provision the Azure web app for you.  If you changed it to 'provider hosted' and provided your own azure creds then it prolly won't work.

    Josh

    Monday, October 07, 2013 1:26 PM
  • Thanks for your reply Josh...by extension do you imply that any provider hosted solution using Azure on Office 365 wont work?

    I have tried all combinations  - Cloud Business App, Lightswitch HTML App, Lightswitch Desktop App, VS2013, VS2012

    I do not doubt what you say but surely they would have disabled the provider hosted function in the Cloud Business App if it was unavailable?

    I have largely relied on this post...http://www.looselytyped.net/2012/10/24/build-a-sharepoint-provider-hosted-app-in-5-mins/ which isnt lightswitch but is similar.  Has anyone made it work?

    Monday, October 07, 2013 8:06 PM
  • Provider-hosted on O365 is supported.  You need to 'Enable SharePoint' in LS and set the AppID &  Secret etc. as in this article:

    http://blogs.msdn.com/b/lightswitch/archive/2013/04/02/sharepoint-hosting-options-for-lightswitch.aspx

    I haven't seen any LS specific articles which step through manually provisioning your azure site, but I assume that part is similar to your article.

    >"surely they would have disabled the provider hosted function in the Cloud Business App if it was unavailable"

    You would think so, but I wouldn't be so sure.  LS team could be doing a better job documenting the options and implications of the O365 hosting options.  Between the restrictiveness of the SharePoint app model, the complexity of O365 Auth and the looseness of LS design tooling, the potential road blocks are many.

    Hopefully the team will sort this all out so LS can become THE RAD tool for SharePoint apps.  That's 'aways away', I'm afraid.

    I'd try using the steps in the above article and if you have trouble, post again with specific errors, etc.

    HTH,

    Josh


    • Edited by joshbooker Monday, October 07, 2013 9:45 PM
    Monday, October 07, 2013 9:20 PM
  • Thanks Josh, the article is consistent with what I do in VS 2012 and @013 (I have tried it all), and there error is mostly that I do not have permissions to visit the page after production deployment.
    Monday, October 07, 2013 10:48 PM
  • skolle,

    I got it to work using the steps in the following article:

    http://blogs.msdn.com/b/lightswitch/archive/2012/06/07/publishing-lightswitch-apps-to-azure-with-visual-studio-2012.aspx

    Since the example isn't 'sharepoint enabled' I had to incorporate the steps seen in this article to register the app on the sharepoint site.

    http://blogs.msdn.com/b/lightswitch/archive/2012/06/07/publishing-lightswitch-apps-to-azure-with-visual-studio-2012.aspx

    My specs are these:

    VS2013 preview

    LS HTML App, SharePoint enabled, Provider Hosted, SharePoint Data Source (no database)

    Published to Azure Website

    Aside from being extra careful to copy the secret values from sharepoint appregnew.aspx into the LS publish wizard and doing the same for the azure web address,  the main thing I took away is that the site collections specified on the enable sharepoint window and in update datasourse window had to be the same (that is, if you're using SPO lists as your datasource).

    Getting it installed on my SharePoint Online Developer Site wasn't a problem, but installing in the App Catalog for use on other sites was difficult.  This is not a LS problem per-se it's par for the course using sharepoint app model.

    It would be nice if someone could do step-by step blog specifically about publishing a sharepoint- enabled, provider-hosted LS app to Azure (including what changes need to be made if the same app is later published to a different SP site via app catalog, having SPO lists as datasource)

    As I said, we're 'aways away' from a friendly deployment experience for sharepoint apps.  The fault is not entirely on LS team since SP2103 app model is unfriendly too.

    Tell us your specs and we'll see if we can help further.  For example, are you using SPO lists for your datasource?  Are the lists on the same site on which you're registering and installing the app?

    PS>  I got a white page with 'you don't have permission...'  a few times in my trials.  It seemed to happen when I wasn't logged into the Sharepoint site, or when the SP site on 'Enable SharePoint' page differed from that which I was logged into. Take away:  you cannot simply register and upload the .app package to many sites even if your same o365 credentials are valid on those sites.  You need to do the appregnew.aspx then change secrets in LS pub wiz as well as change the sp url on enable sharepoint window every time you publish to make a new .app file for each site.

    HTH,

    Josh

    Tuesday, October 08, 2013 3:22 PM
  • I'm about to contradict myself, but I found something interesting today...which simplifies deployment a bit...

    1) Let's say you have a SharePoint-Enabled, Provider-Hosted app that you want to install on several SPO site collections in the same O365 tenancy...this means you have to go to each site and use appregnew.aspx to get the ClientID and Secret then put those in LS pub wiz then publish, upload, deploy the .app file...the whole process has to be repeated for each site you want to install the same app since the secret is different.

    Solution:  Use Seller Dashboard to get the secret like so:

    http://msdn.microsoft.com/en-us/library/office/apps/jj220036.aspx

    Now you can skip the appregnew.aspx, publish from LS only once and upload the .app to you AppCatalog once then deploy to many sites in a batch!!!  (I believe the same .app file can be uploaded to AppCatalog of other tenancies as well, as long as you don't use SP datasource) Big win!

    2) Now say the app has SharePoint Online Datasource (same tenancy) and you want to deploy the app to a site collection other than the one that was specified in LS pub wiz...You can do that and the app will launch, but permissions to the lists on the other site collection will fail so LS will display an error.

    Solution: Alter  AppManifest.xml in SharePoint Project to request tenant permissions like so:

    Voila! Now the app can be deployed anywhere in the tenancy and the sharepoint lists will be accessible.  In this case the datasource URL used in LS pub wiz specifies the lists that all instances of the app will use.

    Now if only LS team would allow changing the datasource url at runtime, we'd have full control!

    You can vote for that bit here:

    UserVoice: Enable Dynamic Connection Strings

    HTH,

    Josh





    • Edited by joshbooker Tuesday, October 08, 2013 6:35 PM UV link
    Tuesday, October 08, 2013 6:25 PM
  • Thank you for your assistance in this Josh.  I am in the middle of a new sample now the same as your with no external data (inc sharepoint lists).  Can you advise...

    What did you use as the start page in the app manifest?  Did you leave it as the default sharepointlaunch.aspx?

    Did you update the code in the app manifest and web config with the client ID and Secret or did you leave it "as is"?

    thanks

    Sally

    Tuesday, October 08, 2013 7:25 PM
  • Hi Sally,

    All of those AppManifest settings are made by LS from values you enter in the LS Publish Wizard.  The only thing I changed manually in the AppManifest was changing the permission from Web to Tenant.

    In LS Pub Wiz I left the default sharepointlaunch.aspx and entered ClientID & Secret from Seller Dashboard.

    PS.. Seller Dashboard required a 'redirect URL' which is not required by LS.  I used the following:

    https://<mysite>.azurewebsites.net/SharePointLaunch.aspx?{StandardTokens}

    HTH,

    Josh

    Tuesday, October 08, 2013 7:35 PM
  • Thanks Josh

    Well at least I can rule out fiddling around with that.  So I can see that I am doing everything the same as you but I am getting my client ID from appregnew in my production site not the seller dashboard. (though I think you may have been doing that earlier and it still worked - please confirm).

    I am using a simple one table, 2 screen app with no external connections (or SP lists), and my website has a database.

    I am using the production site in enable SP, and I am sure I am logged in.

    This error still persists for me....

    You do not have permission to view this directory or page.

    The url it is trying to open is...

    http://skolleapp.azurewebsites.net/SharePointLaunch.aspx?SPHostUrl=https%3A%2F%2F,<site_name>%2Esharepoint%2Ecom&SPLanguage=en%2DUS&SPClientTag=35&SPProductNumber=16%2E0%2E2016%2E1224&SPAppWebUrl=https%3A%2F%2F<site_name>%2D9009751b8e1ef6%2Esharepoint%2Ecom%2Fskolleapp

    Tuesday, October 08, 2013 7:57 PM
  • Try using https for your azure site in the pub wiz like https://skolleapp.azurewebsites.net/SharePointLaunch.aspx
    Tuesday, October 08, 2013 8:19 PM
  • No joy I'm afraid...(same result)

    https://skolleapp.azurewebsites.net/SharePointLaunch.aspx%3FSPHostUrl=https%3A%2F%2F<site_name>.sharepoint.com&SPLanguage=en-US&SPClientTag=35&SPProductNumber=16.0.2016.1224&SPAppWebUrl=https%3A%2F%2F<site_name>-9009751b8e1ef6.sharepoint.com%2Fskolleapp

    Tuesday, October 08, 2013 8:35 PM
  • Did you put the ClientID and Client secret in the app config bit in the Azure portal?
    Tuesday, October 08, 2013 8:37 PM
  • Don't recall any clientid in azure If you change to https in pub wiz I think you must also do the same on appregnew.aspx then change clientid and secret in pubwiz of course.
    Tuesday, October 08, 2013 8:56 PM
  • It was step included in the original tut I specified. Anyway removing the id's from Azure didn't make any difference:(

    The reason I want to use provider hosted is to keep my data safe, and to capitalise on the "created by"  and "person" etc field facilities.  If I use an external data source such as azure or access I wont have these options.  I don't want to use SharePoint LIsts as the data set is too large.

    Tuesday, October 08, 2013 9:10 PM
  • How exactly are you installing and launching the app in your SPO environment?  Something like the following?

    http://blogs.msdn.com/b/lightswitch/archive/2013/04/29/publishing-lightswitch-apps-for-sharepoint-to-the-catalog.aspx

    Wednesday, October 09, 2013 1:43 AM
  • thanks again for your interest Josh.  Unfortunately I am installing it exactly like that.

    I think my issues may be azure related.  I just attempted a stand alone Azure web app with forms authentication (which I have done successfully many times before in VS2012) and I am getting Server Error in '/' Application. on the web site after deployment.

    Investigating this now. 

    • Proposed as answer by NGCBSiegel Wednesday, November 27, 2013 4:01 AM
    • Unproposed as answer by NGCBSiegel Wednesday, November 27, 2013 4:01 AM
    Wednesday, October 09, 2013 3:24 AM
  • I ran into this same “permission” issue the first time I attempted my first provider hosted sharepoint to an azure website. Publishing as a Sharepoint hosted app worked fined as did the Sharepoint Dev site.

    As others hint above, my solution was to follow this process…

    First a brief description of my app…

    Hosted on an Azure Website and only references oData feeds back to my Enterprise (no local data on Azure). I wanted to create a provider hosted sharepoint app (manifest) that redirects to the app published to the Azure site.

    ie...
    Enterprise  oData  >>> Azure Website HTML Sharepoint Enabled  >>>>  Sharepoint Catalog

    My Process…

    1. Create the VS 2013 LightSwitch HTML app and enable for Sharepoint


    2. Create your account in the Sharepoint Seller Portal located at:

    http://go.microsoft.com/fwlink/?LinkId=248605

    Create a client oauth ID for your app and save the client ID and secret key. No need to wait to be authorized for app publication

    Note: When defining the redirect URL, you only need to root URL of the Azure website:
    ie: company.azurewebsites.net

    No need to include "/htmlclient…" as one might consider since it’s a LightSwitch HTMLClient App

    3. Publish the App from LightSwitch 2913 (VS 2013)

    Here are the screen steps described verbally>>>

    SharePoint Options: Provider Hosted
    Application Server Configuration: Windows Azure
    Subscription: Sign in and select your subscription – I was using a Partner Network Subscription

    Service Type: in my case I was using a website
    Service Configuration: I select the domain prefix for my Azure WebSite
    Security Settings: Yes for HTTPS
    Data Connections: Confirmed my local oData feed sources
    Sharepoint Authentication: Use client secret key (ACS connected): past in your secret key from the seller portal
    Sharepoint Client ID: Past in your client ID key from the seller portal

    Finally: Publish…

    Worked first time out of the gate !!!



     

    Wednesday, November 27, 2013 4:24 AM
  • This is still soooo not working for me.  I have tried all recommended strategies.  My only workaround is to publish the app to Azure directly, then create a second autohosted app using the data from the first app as external data.  This is a pain however as you have to write code into the modified/created fields.

    Why doesnt it JUST WORK?

    Is anyone else still experiencing this as an issue?

    Thursday, January 02, 2014 1:28 AM
  • Sally,

    Sorry this is still troubling you.

    I'd suggest a new LS project, new Azure Website and use the seller dashboard to get client id and secret.  That should eliminate all issues with your LS solution, existing Azure site and sharepoint app registration respectively.  I'll bet the prob is with app reg and seller dashboard is the fix.

    If that works then reintroduce appregnew.aspx should you not want to use the seller dashboard.  Then reintroduce your existing azure site should you want to. Lastly try to make it work on your existing LS project if that a requirement. 

    If that doesn't work then perhaps it's time for drastic measures...you could start a new trial azure account and new trial O365 account until you eliminate and thus identify the problem area.

    HTH,

    Josh

    Friday, January 03, 2014 2:18 AM
  • Thanks again for your interest Josh.  As I have said I have tried all of these strategies...(short of creating a new Azure/Office 365 account - not an option) and it sill is not working.

    Is anyone else making it work/not making it work?

    Friday, January 03, 2014 12:32 PM