Skip Ribbon Commands
Skip to main content

Quick Launch

Todd Klindt's home page > Todd Klindt's Office 365 Admin Blog > Posts > Using PowerShell to Set Up your App Domain in SharePoint 2013
August 11
Using PowerShell to Set Up your App Domain in SharePoint 2013

This blog post was written about the Preview of SharePoint 2013. This behavior may be different in the RTM version of the product.

One of the biggest additions to SharePoint 2013 is the introduction of the App model. I’m not going to go into a lot of detail on it here. It’s essentially a framework for publishing code that extends the functionality of SharePoint. As with anything, it needs to be installed and configured to work correctly. Mirjam van Olst (Blog | Twitter) has a great blog post on how to do this. This post is not designed to replace her post, only augment it. Mirjim’s post walks you through how to configure it all. My blog post will show how to do the same SharePoint tasks in PowerShell.

The first thing you need to do is read Mirjam’s blog post to understand what you’re doing. Then go back and do all the steps she outlines in DNS. Create all the zones and records. You can make the DNS changes in native PowerShell, but it’s ugly. It requires some gnarly WMI. Alternatively you can use the DnsShell Codplex project. (thanks, Jonathan)

That should take you to the “Configuring SharePoint” section. Here is the PowerShell I used to create those service applications, start their service instances, and configuring the paths you defined in DNS.

# Assumes you have a Service App Pool named "Default SharePoint Service App Pool"

$apppool = Get-SPServiceApplicationPool "Default SharePoint Service App Pool"

$appname = "App Management Service"

$dbname = "AppManagement_DB"

# Create the App Management service and start its service instance

$sa = New-SPAppManagementServiceApplication -ApplicationPool $apppool -Name $appname -DatabaseName $dbname

New-SPAppManagementServiceApplicationProxy -ServiceApplication $sa -Name "$appname Proxy"

Get-SPServiceInstance | Where-Object { $_.typename -eq "App Management Service" } | Start-SPServiceInstance

 

# Create the Subscription Settings service and start its service instance

$sa = New-SPSubscriptionSettingsServiceApplication -ApplicationPool $appPool -Name "Subscription Settings Service" -DatabaseName "Subscription_Settings_Service_DB"

New-SPSubscriptionSettingsServiceApplicationProxy -ServiceApplication $sa

Get-SPServiceInstance | where{$_.TypeName -eq "Microsoft SharePoint Foundation Subscription Settings Service"} | Start-SPServiceInstance

# Configure your app domain and location

# assumes path of app.contoso-apps.com

Set-spappdomain -appdomain "contoso-apps.com"

Set-spappSiteSubscriptionName -Name "app"

That should do it. That should get you the same service applications and settings and Mirjam’s post.

tk

ShortURL: http://www.toddklindt.com/SP2013AppDomainPosh

Updated 8/14/2012 with better PowerShell for the App Management service (thanks, Spence) and a link to the DNSShell Codeplex project.

Comments

Great post. One suggestion

Todd,
Thanks for reaching into developer land for this post about app management. This is a required step for devs looking to use the new app model.
One suggestion, you created a variable to hold "App Management Service". You could use it on line 8 instead of hard coding the same string again.
Tom
 on 10/28/2012 10:16 AM

Re: Great post. One suggestion

Hey Tom,
I didn't use the variable because the string is a different value that just happens to be the same in this case. But if someone wanted to name their App Management Service to something else, then using the variable in the 8th line will break. That line tries to find the Service Instance name, which is the same regardless of the Service Application's name.

tk
Todd O. KlindtNo presence information on 10/28/2012 1:45 PM

Enjoyable post, which account should I use?

Todd,
 Thank you for your post, however the first line you are getting the App Pool account. When creating the App Pool account which is outside of this blog, what account should I use?
The TechNet article http://technet.microsoft.com/en-us/library/fp161236.aspx states to use the SP Farm account. Surely that's too much privilege to give the App Pool?
 on 12/16/2012 2:11 PM

Re: Enjoyable post, which account should I use?

As far as I know there's no reason to use the Farm account. If anyone has any solid evidence for why it should be used, let me know.

tk
Todd O. KlindtNo presence information on 12/21/2012 9:08 PM

App Store

Can the app Management Service application be federeated from another farm?
 on 9/23/2014 1:12 PM

Re: App Store

I went in to Central Admin and both the Application Management and Subscription Settings services look like they can be published. I've never talked to anyone that's done it though.

tk
Todd O. KlindtNo presence information on 9/26/2014 3:13 PM

Add Comment

Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Title


Body *


Today's date *

Select a date from the calendar.
Please enter today's date so I know you are a real person

Twitter


Want a message when I reply to your comment? Put your Twitter handle here.

Attachments

 

 SysKit