SharePoint 2013 - You receive "Sorry, apps are turned off. If you know who runs the server, tell them to enable apps" when trying to add Apps on Host Header site collection

 

Issue

I recently worked on a case where customer was facing issue when trying to add Apps on Host Header Site collection. He does not face any issues while trying to add apps on site collection created without host header mode.

Repro

Here are the steps to reproduce the issue, these steps can also help you in configuring HH mode site collection in case you were not sure on how to do it :) (These steps will also work on SharePoint 2007)

1. Create a New web application, In my case it is https://sps2013-a.com

2. $Sub = New-SPSiteSubscription (This cmmdlet will help in generating new SPSite Subscription)

3. New-SPSite https://test.walia.com -OwnerAlias walia\administrator -HostHeaderWebApplication https://sps2013-a -language 1033 -sitesubscription $sub

The above command will create a new Site collection in HH mode and assign a unique subscription ID(We generated this ID in Step 2)

4. new-spsite -url https://sps2013-a/sites/tadminsite -template TENANTADMIN#0 -owneralias walia\administrator -AdministrationSiteType tenantadministration -language 1033 -sitesubscription $sub

(The above command will create a new Tenant Administration site and will tie the HH mode site collection to it,We assign it the same Subscription ID of the HH mode site)

5) Browse to the Site https://test1.walia.com

6) Click on Site Contents and try to add App from App Store

You will receive "Sorry, apps are turned off. If you know who runs the server, tell them to enable apps"

Data Analysis

Following message is logged in ULS logs

01/02/2013 15:42:10.29        w3wp.exe (0x0A0C)        0x03E0        SharePoint Foundation        App Deployment        adysh        High        The site subscription name for site https://test.walia.com does not exist. The site subscription name must exist to complete this operation.        19fdf09b-7152-3086-ee69-b85fa6faa86c

Resolution

1) Browse to Tenant Administration Site of the HH mode Site collection

2) Create App Catalog for Tenant by clicking on Manage App Catalog

image

Note – Every Tenant Admin will require a App Catalog(Make sure Self site creation is enabled in order for App Catalog to get created)

3) $Sub = Get-SPSiteSubscription https://hhmodeSite (This CMDlet will help in fetching the subscription ID of the HH mode site collection)

Set-SPAppSiteSubscriptionName -Name "Name for Subscription" -SiteSubscription $Sub

We need to run the above command in order to set the unique name for domain under which these apps will run.More details can be found under https://technet.microsoft.com/en-us/library/jj219503.aspx

 

Feel free to post comments if you have any confusion regarding any of the steps.