Friday 10 March 2017

Enabling SharePoint 2013 ‘Apps’

After installing and configuring SharePoint 2013, if you try to visit the SharePoint App Store you will notice a warning message ‘Sorry, apps are turned off. If you know who runs the server, tell them to enable apps.”. Well lucky for us, we run this server so it’s time to configure it to run Apps or Crapps (@jimmywim).
I thought it would be as simple as creating an App Management Service Application and starting the service but alas sadly not.
Basically SharePoint apps can be deployed in three ways -
- Provider-hosted (Developer or IT department provides the hosting infrastructure)
- Autohosted (Uses Windows Azure or SQL Azure for hosting)
- SharePoint-hosted (Hosted inside existing SharePoint infrastructure)
In order to install an App from the App Store you must setup an isolated App Domain, this is because Apps from the store deploy to their own app domain and run under a separate process from your SharePoint sites. If your SharePoint site uses the DNS alias http://sharepoint.contoso.com you could have *.apps.contoso.com as your app domain. I’m going to walkthrough the process required to set-up your environment for Apps but at a high level, if you need more details for each step then head on over to the MSDN documentation.
Follow the steps below to setup your environment for Apps:
1. Start the App Management Service from Services on Server
2. Provision an App Management Service Application (You can use the UI for this)
3. Create a subdomain domain in DNS – e.g. *.apps.contoso.com. You can either create a subdomain or a new domain to host your apps. I’ll leave that choice up to you. Make sure that when setting up the subdomain in a multi-server environment you set the FQDN of the target host to be your SharePoint 2013 box.
4. Set your isloated App Domain by running this command:
[code language="lang="]Set-SPAppDomain -AppDomain "apps.contoso.com"[/code]
5. Start the SPSubscriptionSettings Service by running the following PowerShell command:
[code lang="ps"]Get-SPServiceInstance | where{$_.GetType().Name -eq "SPSubscriptionSettingsServiceInstance"} | Start-SPServiceInstance[/code]
6. Ensure the App Management Service and SPSubscriptionSettings Services are online by running this command:
[code lang="ps"]Get-SPServiceInstance | where{$_.GetType().Name -eq "AppManagementServiceInstance" -or $_.GetType().Name -eq "SPSubscriptionSettingsServiceInstance"}[/code]
7. Provision a Subscription Settings Service Application (You will need to use PowerShell for this as it can’t be created through the UI). In my example below I am using the same Application Pool I created for the App Management Service Application.
[code lang="ps"]$appPool = Get-SPServiceApplicationPool "SharePoint Service AppPool"$appSubSvc = New-SPSubscriptionSettingsServiceApplication –ApplicationPool
$appPool –Name "Subscription Settings Service Application" –DatabaseName Settings_Service
$proxySubSvc = New-SPSubscriptionSettingsServiceApplicationProxy –ServiceApplication $appSubSvc [/code]
8. Visit the Manage Service Applications page in Central Admin and verify that both the App Management Service App and Subscriptions Settings Service App are provisioned and started.

9. The next thing to do is create an App Catalog. This is essentially a Document Library which is hosted within a separate Site Collection. Choose Apps > Manage App Catalog from Central Admin.
10. Select your Web Application and ensure ‘Create a new app catalog site’ is checked and click OK.
11. Fill in the details for your App Catalog Site and click OK to create it.
12. Nearly there! now we need to configure the App URLs. Select configure App URLs in the Apps section of Central Admin. Enter your App domain you setup earlier (apps.contoso.com) and for the App prefix enter ‘app’.
13. *Important – please note that if you are using Host Headers for your Web Application then you will need to create a new Web Application on port 80 that doesn’t use Host Headers. This Web App must have a root site collection which can be of any template. If you don’t do this then when you try to click on an App you will be met with a 404 error. This is because SharePoint uses the site running on Port 80 to resolve the app url, this must be a SharePoint site so the Default Web Site won’t work.  Once you have created the Web Application and blank Site Collection do an IISRESET just to be sure. For more details on this check out Mirjam’s post here.
14. Done! your environment is now configured for Apps. Now when you navigate to your Site Collection and browse to the SharePoint Store you will notice that the warning/error message has disappeared. Try downloading the Facebook Integration App and see how you get on.
15. Grab a brew and congratulate yourself on a job well done!
Here are a few screenshots of the process when adding an App -

No comments: