Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Provider-Hosted App (SharePoint Add-In) Configuration in SharePoint Server 2013

DZone's Guide to

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.

· Cloud Zone ·
Free Resource

See why enterprise app developers love Cloud Foundry. Download the 2018 User Survey for a snapshot of Cloud Foundry users’ deployments and productivity.

SharePoint 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.

Image title

Image title

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)
    Image title

  • It will also create App pool and Proxy Service.

  • It will set APPDomain and Site Subscription.

Image title

Cloud Foundry saves app developers $100K and 10 weeks on average per development cycle. Download the 2018 User Survey for a snapshot of Cloud Foundry users’ deployments and productivity. Find out what people love about the industry standard cloud application platform.

Topics:
sharepoint server 2013 ,provider hosted application ,tutorial ,cloud ,microsoft

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}