SharePoint 2019 Upgrade Part 4: SharePoint 2019 Upgrading Service Applications

SharePoint 2019 Upgrading Service Applications and Content Databases

In this blog post we are going to cover SharePoint 2019 Upgrade. Upgrading Service Applications databases and Content databases from SharePoint 2016:

SharePoint 2019 Upgrade 

SharePoint 2019 upgrade involves following activities: 
  1. Backup 2016 databases and Restore it into 2019 environment.
  2. Upgrade Service Applications
  3. Upgrade Web Application.

Restore Database backups

Before restoring below mentioned services please make sure to restore corresponding database backups to SQL Server 2019 instance (SP19SQL01).

Backup Databases from SQL 2016 instance (SP16SQL01)

  1. Open SQL Server Management Studio on SP16SQL01 server.
  2. Create BackupDatabase.sql file with following commands for every SQL database
  3. Check and update (if required) backup file location and execute command to create backups

Restore backups to SP19SQL01

  1. Copy backup files into SP19SQL01 server.
  2. Open SQL Server Management Studio on SP19SQL01 server.
  3. Create RestoreDatabase.sql file with following commands for every SQL database backups
  4. Check and update (if required) backup file location, data file location, log file location and execute command to restore backups.

Upgrade Secure Store Service

You must record the Passphrase used in previous install of Secure Store service or if you forgot it then generate new Passphrase and update the service before taking database backup.

Save the following PowerShell code in Restore-SecureStoreService.ps1
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Restore Secure Store Service
$sssPassphrase = '<Passphrase used in old installation>'
$appPoolName = 'SharePoint Web Services System'
$dbName ='SP2019_SecureStoreService'
$serviceName ='Secure Store Service Application'
$serviceProxyName ='Secure Store Service Application Proxy'

$applicationPool = Get-SPServiceApplicationPool -Identity $appPoolName

if($applicationPool -ne $null){

    #Create Secure Store Service from Restored Database
    $sss = New-SPSecureStoreServiceApplication -Name $serviceName -ApplicationPool $applicationPool -DatabaseName $dbName -AuditingEnabled
    Write-Host "Secure Store Service Created successfully $sss ..." -ForegroundColor Green

    #Create Secure Store Service Application Proxy
    $sssp = New-SPSecureStoreServiceApplicationProxy -Name $serviceProxyName -ServiceApplication $sss -DefaultProxyGroup
    Write-Host "Secure Store Service proxy Created successfully $sssp ..." -ForegroundColor Green

    Write-Host 'Updating Secure Store Passphrase...' -ForegroundColor Yellow
    Update-SPSecureStoreApplicationServerKey -Passphrase $sssPassphrase -ServiceApplicationProxy $sssp
    Write-Host 'Secure Store Passphrase updated successfully.' -ForegroundColor Green
}

Open SharePoint Management Shell in administrator mode and run Restore-SecureStoreService.ps1 script to configure Secure Store Service.

Upgrade Business Connectivity Service

Save the following PowerShell code in Restore-BusinessConnectivityService.ps1
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Restore Business Connectivity Service

$appPoolName = 'SharePoint Web Services System'
$dbName ='SP2019_BusinessConnectivityService'
$serviceName ='Business Connectivity Service Application'
$serviceProxyName ='Business Connectivity Service Application Proxy'

$applicationPool = Get-SPServiceApplicationPool -Identity $appPoolName

if($applicationPool -ne $null){

    #Create Business Connectivity Service from Restored Database
    $bcs = New-SPBusinessDataCatalogServiceApplication -Name $serviceName -ApplicationPool $applicationPool -DatabaseName $dbName
    Write-Host "Business Connectivity Service Created successfully $bcs ..." -ForegroundColor Green

}
Run Restore-BusinessConnectivityService.ps1 script to configure BCS service.
 

Upgrade Manage Metadata Service

Save the following PowerShell code in Restore-ManagedMetadataService.ps1
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Restore Managed Metadata Service

$appPoolName = 'SharePoint Web Services System'
$dbName ='SP2019_ManagedMetadataService'
$serviceName ='Managed Metadata Service Application'
$serviceProxyName ='Managed Metadata Service Application Proxy'

$applicationPool = Get-SPServiceApplicationPool -Identity $appPoolName

if($applicationPool -ne $null){

    #Create Managed Metadata Service from Restored Database
    Write-Host "Creating Managed Metadata Service" -ForegroundColor Yellow
    $mms = New-SPMetadataServiceApplication -Name $serviceName -ApplicationPool $applicationPool -DatabaseName $dbName
    Write-Host "Managed Metadata Service Created successfully: $mms" -ForegroundColor Green


    Write-Host "Creating Managed Metadata Service Proxy..." -ForegroundColor Yellow
    New-SPMetadataServiceApplicationProxy -Name $serviceProxyName -ServiceApplication $mms -DefaultProxyGroup
    Write-Host "Managed Metadata Service proxy Created successfully" -ForegroundColor Green
}
Run Restore-ManagedMetadataService.ps1 script to configure Managed Metadata service
 

Upgrade User Profile Service

Save the following PowerShell code in Restore-UserProfileService.ps1
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Restore User Profile Service

$appPoolName = 'SharePoint Web Services System'
$serviceName ='User Profile Service Application'
$serviceProxyName ='User Profile Service Application Proxy'

$dbProfile ='SP2019_UPSA_ProfileDB'
$dbSocial ='SP2019_UPSA_SocialDB'
$dbSync ='SP2019_UPSA_SyncDB'


$applicationPool = Get-SPServiceApplicationPool -Identity $appPoolName

if($applicationPool -ne $null){

    #Create User Profile Service from Restored Database
    Write-Host "Creating User Profile Service..." -ForegroundColor Yellow
    $upsa = New-SPProfileServiceApplication -Name $serviceName -ApplicationPool $applicationPool -ProfileDBName $dbProfile -SocialDBName $dbSocial -ProfileSyncDBName $dbSync
    Write-Host "User Profile Service Created successfully: $upsa" -ForegroundColor Green


    Write-Host "Creating User Profile Service Proxy..." -ForegroundColor Yellow
    $proxy = New-SPProfileServiceApplicationProxy -Name $serviceProxyName -ServiceApplication $upsa
    Write-Host "User Profile Service proxy Created successfully" -ForegroundColor Green


    Add-SPServiceApplicationProxyGroupMember -member $proxy -identity ""
    Write-Host "$proxy added to defult group" -ForegroundColor Green
}

Run Restore-UserProfileService.ps1 script to configure User Profile Service.
 

Upgrade Search Service

Save the following PowerShell code in Restore-UserProfileService.ps1
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Restore Search Service Application

$appPoolName = 'SharePoint Web Services System'
$serviceName ='Search Service Application'
$serviceProxyName ='Search Service Application Proxy'

$dbServer = 'SP16SQLAlias'
$searchDB ='SP2019_SearchService_DB'
$analyticsDB ='SP2019_SearchService_AnalyticsReportingDB'

$applicationPool = Get-SPServiceApplicationPool -Identity $appPoolName

if($applicationPool -ne $null){

    #Create Search Service Application from Restored Database
    Write-Host "Creating Search Service Application..." -ForegroundColor Yellow
    $searchInst = Get-SPEnterpriseSearchServiceInstance -local
    # Gets the Search service instance and sets a variable to use in the next command
    Restore-SPEnterpriseSearchServiceApplication -Name $serviceName -applicationpool $applicationPool -databasename $searchDB -databaseserver $dbServer -AdminSearchServiceInstance $searchInst

    Write-Host "Search Service Application Created successfully" -ForegroundColor Green

    $ssa = Get-SPEnterpriseSearchServiceApplication

    Write-Host "Creating Search Service Application Proxy..." -ForegroundColor Yellow
    New-SPEnterpriseSearchServiceApplicationProxy -Name $serviceProxyName -SearchApplication $ssa
    Write-Host "Search Service Application proxy Created successfully" -ForegroundColor Green

    $ssap = Get-SPEnterpriseSearchServiceApplicationProxy
    Add-SPServiceApplicationProxyGroupMember -member $ssap -identity ""
    Write-Host "$ssap added to defult group" -ForegroundColor Green

    ##Add Analytics databases to Search Service Application
    Add-SPServerScaleOutDatabase -ServiceApplication $ssa -DatabaseServer $dbServer -DatabaseName $analyticsDB
    $temp = Get-SPServerScaleOutDatabase -ServiceApplication $ssa
    Remove-SPServerScaleOutDatabase -Database $temp[0] -ServiceApplication $ssa
}

Run Restore-SearchService.ps1 script to configure Search Service Application.





Create State Service

Save the following PowerShell code in Create-StateService.ps1

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

$dbName = "SP2019_StateService"
$serviceName = "State Service Application"

New-SPStateServiceDatabase -Name $dbName | New-SPStateServiceApplication -Name $serviceName | New-SPStateServiceApplicationProxy -DefaultProxyGroup

State Service is required for InfoPath form. Run Create-StateService.ps1 script to configure State Service Application.

Create Subscription Settings Service Application

Save the following PowerShell code in Create-SubscriptionSettingsService.ps1
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue


$dbName = "SP2019_SubscriptionService";
$serviceName ="Subscription Settings Service Application";

$appPoolName = 'SharePoint Web Services System'
$applicationPool = Get-SPServiceApplicationPool -Identity $appPoolName

$sa = New-SPSubscriptionSettingsServiceApplication -ApplicationPool $applicationPool -Name $serviceName -DatabaseName $dbName
New-SPSubscriptionSettingsServiceApplicationProxy -ServiceApplication $sa

Run Create-SubscriptionSettingsService.ps1 script to configure Subscription Settings Service Application.
 

Create App Management Service

Save the following PowerShell code in Create-AppManagementService.ps1
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue


$dbName = "SP2019_AppManagementService";
$dbServer = "SP19SQLAlias"
$serviceName ="App Management Service Application";
$serviceProxy ="App Management Service Application Proxy";

$appPoolName = 'SharePoint Web Services System'
$applicationPool = Get-SPServiceApplicationPool -Identity $appPoolName

$sa = New-SPAppManagementServiceApplication -Name $serviceName -DatabaseServer $dbServer -DatabaseName $dbName -ApplicationPool $applicationPool

New-SPAppManagementServiceApplicationProxy -Name $serviceProxy -UseDefaultProxyGroup -ServiceApplication $sa

Run Create-AppManagementService.ps1 script to configure App Management Service Application.
 

Configure Workflow Manager

Follow the instructions mentioned in Workflow Manager DR document to restore workflow manager and then register workflow manager with SharePoint farm


This is it for this post. We have successfully restored the service applications from SharePoint 2016 database backups and upgraded the service application to run in SharePoint 2019. Now start configuring search and user profile service. Start Full sync in user profile service.

In the next post I will cover, content database upgrade and SharePoint upgrade issues.

Comments

Popular posts from this blog

Installation and Configuration of Office Online Server with SharePoint 2019

Workflow Manager 1.0- Installation, Configuration and Issues

SharePoint 2019 Upgrade Part 6: SharePoint Upgrade Issues