Provider-Hosted App (SharePoint Add-In) Configuration in SharePoint Server 2013
Read this to find out how to add your provider-hosted app to the SharePoint server. Yup, that's pretty much it.
Join the DZone community and get the full member experience.
Join For FreeSharePoint Provider-hosted apps provides functionality to host the web application on non-SharePoint servers, SharePoint server, and Azure. When App is hosting on an on-premises server with a different domain than SharePoint, the user requires multiple authentications for access to the SharePoint App. To overcome this issue, ADFS (Active Directory Federation Services) component by Microsoft will help to create high-trust relationship between the SharePoint application and the Provider-hosted app.
Follow each step to configure ADFS on your system:
An add-in uses digital certificates to establish a trust between the remote web application and SharePoint 2013. High-trust add-ins can only be installed to on-premises SharePoint, not to Microsoft SharePoint Online, and they are primarily intended for use with an on-premises, rather than cloud-based, web application.
Below are mentioned the steps to configure SharePoint Add-in in SharePoint Server 2013:
Step 1
Register Domain Account in SharePoint Central Admin.
Step 2
Configure Provider APP Services by running the below script. Run this command to configure service: (set variable accordingly)
(Prerequisite: Services account must be registered )
$serviceTypeName = "App Management Service"
$accountName = "domain\services"
$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."
Outcome:
Once the code is run, it will start App Management Services from Manage Services in Services on Server. ( If not started automatically, start manually)
It will also create App pool and Proxy Service.
It will set APPDomain and Site Subscription.
Opinions expressed by DZone contributors are their own.
Comments