Tuesday, 17 March 2015

Powershell to configure App Management Service Application

Power shell script to configure App Management Service Application and Subscription Settings Service

The below script performs the following:


  1. Creates new application pool for App Management Service Application and Subscription Settings Service
  2. Starts the App Management and Subscription Settings Services
  3. Creates the new Database for App Management Service Application and Subscription Settings Service
  4. Configures the App Management Service Application and Subscription Settings Application
  5. Configures the App URL


Assuming that you have already been configured “Domain Name in DNS to host the apps” if not please follow the below link to configure it.



Note: Copy the below script in notepad and save as ConfigureAppManagmentService.ps1
======================================================================

#create a new application pool for App Management Service application 
$apppool = New-SPServiceApplicationPool -Name "App Management_AppPool" -Account "Domian\sp_farm"  #change your account here..

$appname = "App Management Service"
$dbname = "AppManagement_DB"

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

Write-Host "App Management Service started successfully" -ForegroundColor "Yellow" -BackgroundColor "Black"

#Create App Management Service Application
$appmanagmentsa = New-SPAppManagementServiceApplication -ApplicationPool $apppool -Name $appname -DatabaseName $dbname

Write-Host "App Managment Service Application created successfully" -ForegroundColor "Green" -BackgroundColor "Black"

New-SPAppManagementServiceApplicationProxy -ServiceApplication $appmanagmentsa 

Write-Host "App Managment Service Application Proxy created successfully" -ForegroundColor "Green" -BackgroundColor "Black"

$Subscriptionappname = "Subscription Settings Service"
$Subscriptiondbname = "Subscription_Settings_Service_DB"

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

Write-Host "Subscription Settings Service Started successfully" -ForegroundColor "Yellow" -BackgroundColor "Black"

# Create the Subscription Settings service Application
$Subscriptionsa = New-SPSubscriptionSettingsServiceApplication -ApplicationPool $appPool -Name $Subscriptionappname -DatabaseName $Subscriptiondbname

Write-Host "Subscription Settings Service Application created" -ForegroundColor "Green" -BackgroundColor "Black"

New-SPSubscriptionSettingsServiceApplicationProxy -ServiceApplication $Subscriptionsa

Write-Host "Subscription Settings Service Application proxy created" -ForegroundColor "Yellow" -BackgroundColor "Black"

# Configure your app domain and location
Set-spappdomain -appdomain "appsdomain.com" #change your App domain name here..
Set-spappSiteSubscriptionName -Name "apps"

Write-Host "App domain registred successfully" -ForegroundColor "Green" -BackgroundColor "Black"

#End of script

No comments:

Post a Comment