Configure Apps for SharePoint 2013

Microsoft has published a very comprehensive set of guidelines for installing, configuring and managing Apps for SharePoint 2013. These guidelines are available . Without duplicating those details however, I wanted to capture the few necessary steps for those who wanted to quickly get apps for SharePoint 2013 going on a dev. farm. Please note that the examples assume you are using the VM downloaded from my earlier blog post:

ahp_freehostSHP

  • Configure DNS entries: First a little background on why we need to do this – Each installation of an app has a unique URL in your environment. You determine the template for that URL (by determining a domain name and an app prefix), and then app URLs are automatically generated based on that template. Paths for the apps are based on the URL for the site where they are installed. When you install an app to a site, a SubWeb of that site is created to host the app content. The SubWeb for the app is hierarchically below the site collection, but has an isolated unique host header instead of being under the site’s URL. It is recommended to configure a separate DNS for your apps. The difference in domain names provides a layer of isolation for the apps. The use of a different domain name from the SharePoint sites prevents cross-site scripting between the apps and sites and unauthorized access to users’ data. Once you have configured the DNS, you will want to create a wildcard DNS so any app URLs that SharePoint creates can be serviced. The screen shot below shows a “*.apps” wildcard CNAME record:
  • Enable Services on the server : Browse to “Central Administration –> System Settings –> Manage Services on server” and ensure that the “App Management Service” and “Microsoft SharePoint Foundation Subscription Settings Service” services are started:
    Configure the Subscription Settings service application and proxy: You can do so by running the following commands in the SharePoint 2013 Management Shell (PowerShell) – examples below assume you are using the VM downloaded.

    • $account = Get-SPManagedAccount “<farm account>”
    • Where: <farm account> is the name of the Farm administrators account in the SharePoint farm
    • Example: $account = Get-SPManagedAccount “sp_farm”
    • $appPoolSubSvc = New-SPServiceApplicationPool -Name SettingsServiceAppPool -Account $account
    • $appSubSvc = New-SPSubscriptionSettingsServiceApplication –ApplicationPool $appPoolSubSvc –Name SettingsServiceApp –DatabaseName <SettingsServiceDB>
    • Where: <SettingsServiceDB> is the name that you’d like to give to the new Subscription Settings Service database that the above command will create
    • Example: $appSubSvc = New-SPSubscriptionSettingsServiceApplication –ApplicationPool $appPoolSubSvc –Name SettingsServiceApp –DatabaseName App_SubscriptionSettingsService
    • $proxySubSvc = New-SPSubscriptionSettingsServiceApplicationProxy –ServiceApplication $appSubSvc
      Configure the App Management service application and proxy: You can do so by running the following commands in SharePoint 2013 Management Shell (PowerShell) – again, examples below assume you are using the VM downloaded through my blog post:
    • $account = Get-SPManagedAccount “<farm account>”
    • Where: <farm account> is the name of the Farm administrators account in the SharePoint farm
    • Example: $account = Get-SPManagedAccount “sp_farm”
    • $appPoolAppSvc = New-SPServiceApplicationPool -Name AppServiceAppPool -Account $account
    • $appAppSvc = New-SPAppManagementServiceApplication -ApplicationPool $appPoolAppSvc -Name AppServiceApp -DatabaseName <AppServiceDB>
    • Where: <AppServiceDB> is the name that you’d like to give to the new App Management Service database that the above command will create
    • Example: $appSubSvc = New-SPSubscriptionSettingsServiceApplication –ApplicationPool $appPoolSubSvc –Name SettingsServiceApp –DatabaseName App_AppManagmentService
    • $proxyAppSvc = New-SPAppManagementServiceApplicationProxy -ServiceApplication $appAppSvc
      Configure the app URLs in Central Admin: Browse to “Central Administration –> Apps –> Configure App URLs” and enter the wildcard CNAME entry that you created above (in step 1) along with an app prefix as depicted below:

That’s all you would need to do to get started. Now, a few issues that I faced in my environment (and how to overcome them):
Access denied error when trying to configure the Subscription Settings service application: You are most likely going to face this issue if you are using the VM created by me. The underlying cause for this issue is that for some reason, the SQL server installation did not configure permissions correctly on the “Data” directory. This results in a failure when PowerShell tries to create the database for the service application. To overcome the issue you will manually need to grant the “SQLServerMSASUser$SP2013$MSSQLSERVER” Read and Write access to the data directory.

error: The second issue that I faced was the http 401.1 error that I received after adding an app from the SharePoint App Store and browsing to this newly added app. There are 2 workarounds for this issue that Microsoft describes in this KB article. I am going to duplicate the recommended approach described in this KB:

  • Open the registry editor (regedit.exe)
  • Browse to the following path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0
  • Add a new Multi-String Value and call it: BackConnectionHostNames
  • Edit the value and enter *.gauravmahajan.net and gauravmahajan.net in two different lines:
  • Close the registry editor and restart the machine
  • Browse to your app again and it should now open just fine after you provide the required credentials.

In case the above does not work, you may want to go for the second workaround described in the KB (but only in non-production environments)
Hope the above helps you in getting a quick start on using Apps for SharePoint 2013!