Create Subscription Settings Service Application in SharePoint using PowerShell
What is subscription settings service application in SharePoint? Well, the SharePoint Apps platform relies on the Microsoft SharePoint Foundation Subscription Settings service application. So, If you want to use Apps in SharePoint, it’s a prerequisite to creating a Subscription Settings service application.
How to create subscription settings service application?
Subscription Settings service application can be created only via PowerShell. There is no GUI to create this Service Application! Let’s configure the subscription settings service application by using Windows PowerShell.
Don’t forget to change configuration parameters such as the service account, database name, etc., on the below script as per your environment. Once done, run this PowerShell script from either PowerShell ISE or through SharePoint Server 2013 Management Shell.
PowerShell to Create Subscription Settings Service Application in SharePoint
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#Configuration Parameters
$ServiceAppName = "Subscription Settings Service Application"
$AppPoolAccount = "Crescent\SP16-AppPool"
$AppPoolName = "Service Application App Pool"
$DatabaseServer = "SP16-SQL001"
$DatabaseName = "SP16_SubsSett_ServiceApp"
Try {
#Set the Error Action
$ErrorActionPreference = "Stop"
#Check if Managed account is registered already
Write-Host -ForegroundColor Yellow "Checking if Application Pool Accounts already exists"
$AppPoolAccount = Get-SPManagedAccount -Identity $AppPoolAccount -ErrorAction SilentlyContinue
if($AppPoolAccount -eq $null)
{
Write-Host "Please Enter the password for the Service Account..."
$AppPoolCredentials = Get-Credential $AppPoolAccount
$AppPoolAccount = New-SPManagedAccount -Credential $AppPoolCredentials
}
#Check if the application pool exists already
Write-Host -ForegroundColor Yellow "Checking if the Application Pool already exists"
$AppPool = Get-SPServiceApplicationPool -Identity $AppPoolName -ErrorAction SilentlyContinue
if ($AppPool -eq $null)
{
Write-Host -ForegroundColor Green "Creating Application Pool"
$AppPool = New-SPServiceApplicationPool -Name $AppPoolName -Account $AppPoolAccount
}
#Check if the Service application exists already
Write-Host -ForegroundColor Yellow "Checking if Subscription Settings Service Application exists already"
$ServiceApplication = Get-SPServiceApplication -Name $ServiceAppName -ErrorAction SilentlyContinue
if ($ServiceApplication -eq $null)
{
Write-Host -ForegroundColor Green "Creating Subscription Settings Service Application..."
$ServiceApplication = New-SPSubscriptionSettingsServiceApplication -ApplicationPool $AppPoolName -Name $ServiceAppName -DatabaseName $DatabaseName -DatabaseServer $DatabaseServer
$Proxy = New-SPSubscriptionSettingsServiceApplicationProxy -ServiceApplication $ServiceApplication
Write-Host -ForegroundColor Green "Subscription Settings Service Application created successfully!"
}
#Start service instance
$ServiceInstance = Get-SPServiceInstance | Where-Object { $_.TypeName -eq "Microsoft SharePoint Foundation Subscription Settings Service"}
#Check the Service status
if ($ServiceInstance.Status -ne "Online")
{
Write-Host -ForegroundColor Yellow "Starting the Subscription Settings Service Instance..."
Start-SPServiceInstance $ServiceInstance
}
}
catch {
Write-Host $_.Exception.Message -ForegroundColor Red
}
finally {
#Reset the Error Action to Default
$ErrorActionPreference = "Continue"
}
This creates subscription settings service application in SharePoint 2013 and SharePoint 2016.
I got an issue as below:
Checking if Application Pool Accounts already exists
Please Enter the password for the Service Account…
Login failed for user ‘SD\username’.
Login Failed indicates – The provided account could be locked, password expired, password mismatch, etc.