dsccommunity / dsccommunity/SharePointDsc

SPSearchServiceApp is Creating a New SA Even with Existing DB

Open
#1,233 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
C#
Stars
246
Forks
106
PR merge metrics
No merged PRs in 30d

Description

Details of the scenario you tried and the problem that is occurring

Trying to restore the search service application from existing database. For example, in DR recovery scenario or blue-green deployments or stage infrastructure or for v2v upgrade scenarios.

Verbose logs showing the problem

Current version of the SharePointDsc module is using New-SPEnterpriseSearchServiceApplication, whereas when we need to restore a search service application from existing administration database, we need to use Restore-SPEnterpriseSearchServiceApplication commandlet.

Suggested solution to the issue

Check if the administration database already exists in the SQL instance and run either New-SPEnterpriseSearchServiceApplication or Restore-SPEnterpriseSearchServiceApplication depending on the condition.

The DSC configuration that is used to reproduce the issue (as detailed as possible)
# just an example,
        SPSearchServiceApp SearchServiceApp
        {
            DatabaseName                = "Search_Service_Application_DB_b183238874e14d7dad0aed1941f80308"
            ApplicationPool             = "SharePoint Search App Pool"
            ProxyName                   = "Search Service Application"
            Name                        = "Search Service Application"
            DefaultContentAccessAccount = $SPSearchCrawlAccountCredential
            Ensure                      = "Present"
            PsDscRunAsCredential        = $SPInstallAccountCredential
            DependsOn                   = "[Script]SearchServiceApp"
        }
The operating system the target node is running
Version of SharePoint that is used (e.g. SharePoint 2016)
Version and build of PowerShell the target node is running
Version of the DSC module that was used

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the SPSearchServiceApp resource entry point and trace how DatabaseName is handled when ensuring the service application. Compare the existing-database scenario with the New-SPEnterpriseSearchServiceApplication and Restore-SPEnterpriseSearchServiceApplication cmdlets. Done means the resource selects the appropriate cmdlet based on whether the administration database already exists.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, sql
Domain
databases, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.