PowerShell Script to Configure App Management Proxy for Workflow Manager in Multi-Server SharePoint 2013 farm

Note: Download PowerShell script discussed in this article from Here.

Last September, I have blogged an article regarding hidden dependency for Workflow Manager in SharePoint 2013 SAML environment – App Management Service Application Proxy.

As I have mentioned in that article, you must enable App Management Proxy on the SharePoint farm to register & publish SharePoint 2013 workflows for SharePoint SAML environment. You don’t have to configure SharePoint 2013 App Domain for the farm to host SharePoint Apps. As long as you have both App Management Service and Subscription Settings Service are running on the farm along with both App Management and Subscription Settings Service Applications and proxies provisioned, workflow manager should be running like charm.

In this article, I am posting the PowerShell script I have used to provision and configure App Management Service in the multi-server SharePoint 2013 farm. Please note that this script does not configure or enable App domain on the SharePoint farm. Goal for this script is to make SharePoint farm ready to host SharePoint 2013 workflows in SAML environment by configuring App Management Service Application, not full blown App Domain to host SharePoint 2013 Apps.

Before posting the script, I have to first confess that initial version of script I have derived from Critical Path‘s member section in SharePoint 2013 Developer Machine Installation Guide. Some of the limitations/advantages of Critical Path’s script is it’s written for Single Server developer machine in addition to enable full blown App domain to host SharePoint 2013 Apps. Critical Path script wouldn’t work for Multi-Server farm. I have expanded and updated Critical Path’s script to support multi-server farm to enable App Management Service Application Proxy and disable AppDomain creation logic.

Here is the script available to download and posted below for your use. Please use as it is and ensure to test in your environment before running on production farm. I am not responsible for any damage to your SharePoint environment.

In this sample script, you can specify parameters for one or more server names for multi-server or single-server farm, Service application pool for app management service, and database names for app management & subscription settings service application.

# Configures a SharePoint 2013 App Management Service Proxies for hosting Workflow Manager.
# Specify parameters for your environment
$ServerNames = @("Niks-SP13-App1", "Niks-SP13-App2") #Specify 1 or more servers where you would like to activate services
$ServiceAppPoolName = “SharePoint Hosted Services”  #See Shared Services App Pool Account in Service Accounts page in central admin
$AppManagementServiceDB = "NikSP_AppManagement" #Specify Prefix to App management database
$SubscriptionSettingsServiceDB = "NikSP_SubscriptionSettings" #Specify prefix to subscription settings database

# Start the transcript output
Start-Transcript

# Load SharePoint PowerShell snapin
Write-Host
Write-Host "Load SharePoint PowerShell snapin."
$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.PowerShell'}
if ($snapin -eq $null) {
Add-PSSnapin Microsoft.SharePoint.PowerShell -EA 0
}

# Start SharePoint App Management Service on requestd servers if it's not started
Write-Host
Write-Host "Start SharePoint App Management Service on requestd servers if it's not started."
foreach($ServerName in $ServerNames){
$appMgmtSvcInstance = Get-SPServiceInstance –Server $ServerName | Where-Object { $_.GetType().Name -eq "AppManagementServiceInstance" }
if ($appMgmtSvcInstance.Status -ne "Online") {
$silence = Start-SPServiceInstance -Identity $appMgmtSvcInstance
}
}

# Start SharePoint Subscription Settings Service on requestd servers if it's not started
Write-Host
Write-Host "Start SharePoint Subscription Settings Service on requestd servers if it's not started."
foreach($ServerName in $ServerNames){
$appSubSettingSvcInstance = Get-SPServiceInstance –Server $ServerName | Where-Object { $_.GetType().Name -eq "SPSubscriptionSettingsServiceInstance"}
if ($appSubSettingSvcInstance.Status -ne "Online") {
$serviceInstance = Start-SPServiceInstance -Identity $appSubSettingSvcInstance
}
}

# Getting Application Pool for hosting service applications
Write-Host
Write-Host "Getting Application Pool for hosting service applications."
$appPoolServiceApps = Get-SPServiceApplicationPool -Identity $ServiceAppPoolName

# Provision Subscription Settings Service Application if it's not provisioned
Write-Host
Write-Host "Provision Subscription Settings Service Application if it's not provisioned."
$SubscriptionSettingsServiceApplicationName = "Subscription Settings Service Application"
$appSubSettingSvcAppInstance = Get-SPServiceApplication | where {$_.Name -eq $SubscriptionSettingsServiceApplicationName}
if ($appSubSettingSvcAppInstance -eq $null) {
$appSubSvc = New-SPSubscriptionSettingsServiceApplication –ApplicationPool $appPoolServiceApps –Name $SubscriptionSettingsServiceApplicationName –DatabaseName $SubscriptionSettingsServiceDB
$proxySubSvc = New-SPSubscriptionSettingsServiceApplicationProxy –ServiceApplication $appSubSvc
}

# Provision App Management Service Application if it's not provisioned
Write-Host
Write-Host "Provision App Management Service Application if it's not provisioned."
$AppManagementServiceApplicationName = "App Management Service Application"
$appMgmtSvcAppInstance = Get-SPServiceApplication | where {$_.Name -eq $AppManagementServiceApplicationName}
if ($appMgmtSvcAppInstance -eq $null) {
$appAppSvc = New-SPAppManagementServiceApplication -ApplicationPool $appPoolServiceApps -Name $AppManagementServiceApplicationName -DatabaseName $AppManagementServiceDB
$proxyAppSvc = New-SPAppManagementServiceApplicationProxy -ServiceApplication $appAppSvc
}

Write-Host
Write-Host "Finished configuring SharePoint 2013 App Management Service to host workflow manager."

# Stop the transcript output
Stop-Transcript

Write-Host "Press any key to continue ..."
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
Advertisements
This entry was posted in SP2013 Admin. Bookmark the permalink.

3 Responses to PowerShell Script to Configure App Management Proxy for Workflow Manager in Multi-Server SharePoint 2013 farm

  1. You have mentioned “not full blown App Domain to host SharePoint 2013 Apps.” in you third paragraph. How can it be possible to host SP Apps without App Domain? Please clarify

    • Nik Patel says:

      Here is what paragraph says.. Goal for this script is to make SharePoint farm ready to host SharePoint 2013 workflows in SAML environment by configuring App Management Service Application, not full blown App Domain to host SharePoint 2013 Apps.

    • Nik Patel says:

      Goal of this article to not getting ready to host SharePoint Apps.. If you are planning to host SharePoint Apps, you would need App Domain. For workflow manager, you require only Subscription Setting Service Proxy and App Management Service Proxy, not full domain.. Hope that clarifies…

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s