Setup SharePoint 2013 App Development Environment Using Powershell

Setup SharePoint 2013 App Development Environment Using Powershell

Note: You can use this method on sandbox environment where developers don’t want to setup the domain Name in DNS, Visual Studio will modify the host file during debugging to skip the need of creating the Domain name in DNS for App development on Development Environment.

Assumptions - You have SharePoint 2013 Installed with web application and root site collection created.

Step 1: Start App Management Service

$appManagementService = Get-SPServiceInstance | where {$_.TypeName -like “App Management Service”}

if($appManagementService.Status -ne “Online”) {
Write-Host “Starting App Management Service”
Start-SPServiceInstance $appManagementService | Out-Null
}
else{
Write-Host “App Management Service was already started”
}

# wait for App Management Service to start”
while ($service.Status -ne “Online”) {
# delay 5 seconds then check to see if service has started sleep 5
$service = Get-SPServiceInstance | where {$_.TypeName -like “App Management Service”}
}

Step2: Start Subscription Settings Service

$subscriptionSettingsService = Get-SPServiceInstance | where {$_.TypeName -like “Microsoft SharePoint Foundation Subscription Settings Service”}

if($subscriptionSettingsService.Status -ne “Online”) {
Write-Host “Starting Subscription Settings Service”
Start-SPServiceInstance $subscriptionSettingsService | Out-Null
}
else{
Write-Host “Subscription Settings Service was already started”
}

while ($service.Status -ne “Online”) {
# delay 5 seconds then check to see if service has started sleep 5
$service = Get-SPServiceInstance | where {$_.TypeName -like “Microsoft SharePoint Foundation Subscription Settings Service”}
}

Step 3: Create Service Application and Proxy for App Management Service

$appManagemetnServiceApplicationName = “App Management Service”
$appManagementServiceApplication = Get-SPServiceApplication | where {$_.Name -eq $appManagemetnServiceApplicationName}

# create an instance App Management Service Application and proxy if they do not exist
if($appManagementServiceApplication -eq $null) {
Write-Host “Creating App Management Service Application…”
$pool = Get-SPServiceApplicationPool “SharePoint Web Services Default”
$appManagementServiceDB= “Sharepoint_AppManagementServiceDB”
$appManagementServiceApplication = New-SPAppManagementServiceApplication `
-ApplicationPool $pool `
-Name $appManagemetnServiceApplicationName `
-DatabaseName $appManagementServiceDB

Write-Host “Creating App Management Service Application Proxy…”
$appManagementServicApplicationProxy = New-SPAppManagementServiceApplicationProxy `
-ServiceApplication $appManagementServiceApplication

}
else{
Write-Host “App Management Service Application already exist…”
}

Step 4: Create Service Application and Proxy for Subscription Setting Service

$subscriptionSettingsServiceApplicationName = “Subscription Settings Service Application”
$subscriptionSettingsServiceApplication = Get-SPServiceApplication | where {$_.Name -eq $subscriptionSettingsServiceApplicationName}

# create an instance Subscription Service Application and proxy if they do not exist
if($subscriptionSettingsServiceApplication -eq $null) {
Write-Host “Creating Subscription Settings Service Application…”
$pool = Get-SPServiceApplicationPool “SharePoint Web Services Default”
$subscriptionSettingsServiceDB= “Sharepoint_SiteSubscriptionSettingsServiceDB”
$subscriptionSettingsServiceApplication = New-SPSubscriptionSettingsServiceApplication `
-ApplicationPool $pool `
-Name $subscriptionSettingsServiceApplicationName `
-DatabaseName $subscriptionSettingsServiceDB

Write-Host “Creating Subscription Settings Service Application Proxy…”
$subscriptionSettingsServicApplicationProxy = New-SPSubscriptionSettingsServiceApplicationProxy `
-ServiceApplication $subscriptionSettingsServiceApplication

}
else{
Write-Host “Subscription Settings Service Application already exist…”
}

Step 5: Assign root domain name to configure URL used to access app webs

Set-SPAppDomain “apps.com” –confirm:$false

Step 6: Assign name to default tenant to configure URL used to access web apps

Set-SPAppSiteSubscriptionName -Name “app” -Confirm:$false

Step 7: At this point, your environment is ready for app development, Download Visual Studio and Office Developer Tools For VS 2012

This setup will work perfect when you debug and deploy your app using Visual Studio by pressing F5, you don’t need to change host file as Visual Studio is smart enough to change host file however if you are trying to setup app catalog to distribute apps within development environment, you would need to change host file for every app instance installed from app catalog however if you want to go through that route, you must setup the domain name in DNS to avoid modifying the host file every time.

** Original Post - http://spdevstore.com/blogs/2013/08/23/setup-sharepoint-development...

Leave a Comment
  • Please add 7 and 7 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Sort by: Published Date | Most Recent | Most Useful
Comments
  • Balaji M Kundalam edited Revision 1. Comment: Removed extra spaces.

Page 1 of 1 (1 items)
Wikis - Comment List
Sort by: Published Date | Most Recent | Most Useful
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Comments
  • Balaji M Kundalam edited Revision 1. Comment: Removed extra spaces.

Page 1 of 1 (1 items)