To create the Apps Management Service in SharePoint 2013 we can use a simple PowerShell script:

$serviceTypeName = "App Management Service"
$accountName = "mydomain\sharepoint.service" 
$appPool = "SharePoint Service Applications"
$serviceName = "App Management Service"
$serviceDB = "App_Management_Service"
$appDomain = "sharepointapps.local"
$siteSubscriptionName = "app"

$service = Get-SPServiceInstance | where { $_.TypeName -eq $serviceTypeName }
Start-SPServiceInstance $service

Write-Host "Service instance started."

# Gets the name of the managed account and sets it to the variable $account for later use.
$account = Get-SPManagedAccount $accountName

$appPoolAppSvc = Get-SPServiceApplicationPool $appPool

if ($appPoolAppSvc -eq $null)
{
    # Creates an application pool for the Subscription Settings service application. 
    # Uses a managed account as the security account for the application pool.
    # Stores the application pool as a variable for later use.
    $appPoolAppSvc = New-SPServiceApplicationPool -Name $appPool -Account $account
}

Write-Host "Have the application pool..."

# Creates the Application Management service application, using the variable to associate it with the application pool that was created earlier.
# Stores the new service application as a variable for later use.
$appAppSvc = New-SPAppManagementServiceApplication -ApplicationPool $appPoolAppSvc -Name $serviceName -DatabaseName $serviceDB

Write-Host "Service application created..."

# Creates a proxy for the Subscription Settings service application.
$proxySubSvc = New-SPAppManagementServiceApplicationProxy  –ServiceApplication $appAppSvc

Write-Host "Service application proxy created..."

Set-SPAppDomain $appDomain

Write-Host "AppDomain set..."

Set-SPAppSiteSubscriptionName -Name $siteSubscriptionName -Confirm:$false

Write-Host "SiteSubscriptionName set..."

Write-Host -ForegroundColor green "Done."

Change the variables

  • $accountName
  • $appPool
  • $serviceName
  • $serviceDB
  • $appDomain
  • $siteSubscriptionName

so you can use the script in your environment.

 

Advertisements