SharePointDsc: Can't create Site Collection in SharePoint 2019

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

When using SharePointDSC to create a Custom minrole server using the Azure SharePoint 2019 image it throws an error for every Site Collection I try to create. New-SPSite works normally outside of DSC. Site Collections with the same settings can be built using New-SPSite in PowerShell or Central Admin

Verbose logs showing the problem

VERBOSE: [2018-11-29 14:11:35Z] [VERBOSE] [SPT019]:
[[SPSite]TeamSite] Performing the operation “New-SPSite” on target “http://Portal2019.Actualdomainname.com”. VERBOSE: [2018-11-29 14:11:58Z] [ERROR] Invalid field name. {cbb92da4-fd46-4c7d-af6c-3128c2a5576e} http://portal2019.Actualdomainname.com

Suggested solution to the issue

This works fine in SharePoint 2013 and 2016. It only happens in 2019

The DSC configuration that is used to reproduce the issue (as detailed as possible)

           SPWebApplication SharePointSites
            {
                Name = "SharePoint Sites"
                ApplicationPool = $WebAppPoolName
                ApplicationPoolAccount = $WebPoolManagedAccountCreds.UserName
                AllowAnonymous = $false
                DatabaseName = "SP$($ReleaseYear)_Sites_Content"
                WebAppUrl = $PortalUrl
                Port = 80
                PsDscRunAsCredential = $SharePointSetupUserAccountcreds
                DependsOn = "[SPFarm]CreateSPFarm"
            }
        
            SPWebApplication OneDriveSites
            {
                Name = "OneDrive"
                ApplicationPool = $webAppPoolName
                ApplicationPoolAccount = $WebPoolManagedAccountCreds.UserName
                AllowAnonymous = $false
                DatabaseName = "SP$($ReleaseYear)_Sites_OneDrive" 
                HostHeader = "OneDrive$($ReleaseYear).$($AdDomainName)"
                WebAppUrl = $OneDriveUrl
                Port = 80
                PsDscRunAsCredential = $SharePointSetupUserAccountcreds
                DependsOn = "[SPFarm]CreateSPFarm"
            }

            SPCacheAccounts WebAppCacheAccounts
            {
                WebAppUrl = "http://Portal$($ReleaseYear).$($AdDomainName)"
                SuperUserAlias = "$DomainNetbiosName\$SuperUserAlias"
                SuperReaderAlias = "$DomainNetbiosName\$SuperReaderAlias"
                PsDscRunAsCredential = $SharePointSetupUserAccountcreds
                DependsOn = "[SPWebApplication]SharePointSites"
            }

            SPCacheAccounts OneDriveCacheAccounts
            {
                WebAppUrl = "http://oneDrive$($ReleaseYear).$($AdDomainName)"
                SuperUserAlias = "$DomainNetbiosName\$SuperUserAlias"
                SuperReaderAlias = "$DomainNetbiosName\$SuperReaderAlias"
                PsDscRunAsCredential = $SharePointSetupUserAccountcreds
                DependsOn = "[SPWebApplication]OneDriveSites"
            }

            SPSite TeamSite
            {
                Url = $PortalUrl
                OwnerAlias = "$($DomainNetbiosName)\$($SharePointSetupUserName)"
                Name = "Root Demo Site"
                Template = "STS#0"
                PsDscRunAsCredential = $SharePointSetupUserAccountcreds
                DependsOn = "[SPCacheAccounts]WebAppCacheAccounts"
            }

            SPSite MySiteHost
            {                             
                Url = $OneDriveUrl
                OwnerAlias = "$($DomainNetbiosName)\$($SharePointSetupUserName)"
                Name = "OneDrive"
                Template = "SPSMSITEHOST#0"
                PsDscRunAsCredential = $SharePointSetupUserAccountcreds
                DependsOn = "[SPCacheAccounts]OneDriveCacheAccounts"
            }
        }

The operating system the target node is running

Version of SharePoint that is used (e.g. SharePoint 2016)

SharePoint 2019

Version and build of PowerShell the target node is running

Version of the DSC module that was used (‘dev’ if using current dev branch)

SharePoint DSC 3.0.0.0

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 43 (26 by maintainers)

Commits related to this issue

Most upvoted comments

i’m not aware of any work to fix it - it may have already been done - it’s not something I’ve looked at in a while, but was pointed to this page when it came up related to something else. the bottom line - the problem is/was SharePoint, not anyone else’s tool/automation choice or implementation

Hi folks,

It’s worth noting this isn’t a specific issue with DSC or any other approach. It impacts every use of New-SPSite within a PoSh automation approach, and was a bug during pre-release and RTM builds. on any farm type. in some cases, reloading the snapin will allow the site creation. other times the entire process needs to be reloaded

@NikCharlebois - I just finished running the test you provided and I also get the same error message that you get.

New-SPWebApplication : An update conflict has occurred, and you must re-try this action. The object SPWebApplication Name=SharePoint - 90 was updated by acmeman\SP_Farm, in the OWSTIMER (4988) process, on machine SPT01. View the tracing log for more information about the conflict. At C:\DSC\NickTest.ps1:43 char:1

  • New-SPWebApplication @newWebAppParams | Out-Null
  •   + CategoryInfo          : InvalidData: (Microsoft.Share...PWebApplication:SPCmdletNewSPWebApplication) [New-SPWebApplication], SPUpdatedConcurrencyException
      + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletNewSPWebApplication

Issue will be fixed in v4.8, which will be released later today.

@ykuijs let me know if you want additional testers, I’ll be happy to do that

FYI: We found a workaround for this issue, which I am in the process of testing.

So I’ve found a workaround that seems to fix the problem for DSC. I’m using xPendingReboot to insert a Reboot between creating the Web Applications and creating new site collections. That either helps get the files registered that creating sites needs or simply the delay involved is enough to fix the timing problem. Either way it works. Here’s the code I used.

        Script ForceReboot
        {
            TestScript = {
                return (Test-Path HKLM:\SOFTWARE\MyMainKey\RebootKey)
            }
            SetScript = {
                New-Item -Path HKLM:\SOFTWARE\MyMainKey\RebootKey -Force
                 $global:DSCMachineStatus = 1 

            }
            GetScript = { return @{result = 'result'}}
            DependsOn = @('[SPWebApplication]SharePointSites', '[SPWebApplication]OneDriveSites')
        }    

        xPendingReboot Reboot2
        {
            Name = 'AfterWebApps'
            SkipCcmClientSDK = $true
            DependsOn = "[Script]ForceReboot"
        }