Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPOSiteScript: Duplication creation. #5701

Closed
pmatthews05 opened this issue Jan 31, 2025 · 1 comment · Fixed by #5895 or #5911
Closed

SPOSiteScript: Duplication creation. #5701

pmatthews05 opened this issue Jan 31, 2025 · 1 comment · Fixed by #5895 or #5911

Comments

@pmatthews05
Copy link

Description of the issue

Using M365DSC to deploy A SPO Site Design and Site Script.

When deployed once, it seems to look OK.

Image

Although note that the Id of the SiteScript ff26c796-b4dd-4748-86ff-dad011e5eb4f doesn't match the Identity in the M365TenantConfig.ps1
a6a9f6ee-02c8-47b4-9d03-901c1a79dd33

When you deploy the second time, you can see that the the Site Script is deployed again with a different ID.

Image

Microsoft 365 DSC Version

v1.25.122.2

Which workloads are affected

SharePoint Online

The DSC configuration

# Please note I have removed the URL GUID, and Signiture Key.

param (
)

Configuration M365TenantConfig
{
    param (
    )

    $OrganizationName = $ConfigurationData.NonNodeData.OrganizationName

    Import-DscResource -ModuleName 'Microsoft365DSC' -ModuleVersion '1.25.122.2'

    Node localhost
    {
        SPOSiteScript "SPOSiteScript-Apply company customisations"
        {
            ApplicationId         = $ConfigurationData.NonNodeData.ApplicationId;
            CertificateThumbprint = $ConfigurationData.NonNodeData.CertificateThumbprint;
            Content               = "{     `"$schema`": `"schema.json`",     `"actions`": [         {             `"verb`": `"setRegionalSettings`",             `"locale`": 2057,             `"sortOrder`": 25,             `"hourFormat`": `"24`"         },         {             `"verb`": `"triggerFlow`",             `"url`": `"https://prod-21.uksouth.logic.azure.com:443/workflows/[GUID-REMOVED]
/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=[key-removed]`",             `"name`": `"Apply company customisations`",             `"parameters`": {                 `"event`": `"Microsoft Event`",                 `"product`": `"SharePoint`"             }         }     ],     `"bindata`": {},     `"version`": 1 }";
            Ensure                = "Present";
            Identity              = "a6a9f6ee-02c8-47b4-9d03-901c1a79dd33";
            TenantId              = $OrganizationName;
            Title                 = "Apply company customisations";
        }
        SPOSiteDesign "SPOSiteDesign-Apply company customisations"
        {
            ApplicationId         = $ConfigurationData.NonNodeData.ApplicationId;
            CertificateThumbprint = $ConfigurationData.NonNodeData.CertificateThumbprint;
            Description           = "Default team site template, ensures company customisations are applied when the site is created via the request portal, otherwise a standard site";
            Ensure                = "Present";
            IsDefault             = $False;
            SiteScriptNames       = @("Apply company customisations");
            TenantId              = $OrganizationName;
            Title                 = "Apply company customisations";
            Version               = 1;
            WebTemplate           = "TeamSite";
        }
    }
}

M365TenantConfig -ConfigurationData .\ConfigurationData.psd1

Verbose logs showing the problem

Run 1:

VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer mycomputer with user sid S-1-12-1-3691799957-1270395199-3808479900-2109869863.
VERBOSE: [mycomputer]: LCM:  [ Start  Set      ]
VERBOSE: [mycomputer]: LCM:  [ Start  Resource ]  [[SPOSiteScript]SPOSiteScript-Apply company customisations]
VERBOSE: [mycomputer]: LCM:  [ Start  Test     ]  [[SPOSiteScript]SPOSiteScript-Apply company customisations]
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Testing configuration for Site Script Apply company customisations
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Getting Site Script: Apply company customisations
WARNING: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] 
A newer version of PnP PowerShell is available: 2.12.0.

Use 'Update-Module -Name PnP.PowerShell' to update.
Use 'Get-PnPChangeLog -Release 2.12.0' to list changes.

You can turn this check off by setting the 'PNPPOWERSHELL_UPDATECHECK' environment variable to 'Off'.
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Getting the SPO Site Script: Apply company customisations
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Connecting to the SharePoint Online Admin Center at 'https://mysp-admin.sharepoint.com' to run this cmdlet
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Connected to the SharePoint Online Admin Center at 'https://mysp-admin.sharepoint.com' to run this cmdlet
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Current Values: ApplicationId=***
CertificateThumbprint=***
Content={     "": "schema.json",     "actions": [         {             "verb": "setRegionalSettings",             "locale": 2057,             "sortOrder": 25,             "hourFormat": "24"         },         {             "verb": "triggerFlow",             "url": "https://prod-21.uksouth.logic.azure.com:443/workflows/[GUID-REMOVED]
/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=[key-removed]",             "name": "Apply company customisations",             "parameters": {                 "event": "Microsoft Event",                 "product": "SharePoint"             }         }     ],     "b
indata": {},     "version": 1 }
Ensure=Absent
Identity=a6a9f6ee-02c8-47b4-9d03-901c1a79dd33
TenantId=***
Title=Apply company customisations
Verbose=True
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Target Values: ApplicationId=***
CertificateThumbprint=***
Content={     "": "schema.json",     "actions": [         {             "verb": "setRegionalSettings",             "locale": 2057,             "sortOrder": 25,             "hourFormat": "24"         },         {             "verb": "triggerFlow",             "url": "https://prod-21.uksouth.logic.azure.com:443/workflows/[GUID-REMOVED]
/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=[key-removed]",             "name": "Apply company customisations",             "parameters": {                 "event": "Microsoft Event",                 "product": "SharePoint"             }         }     ],     "b
indata": {},     "version": 1 }
Ensure=Present
Identity=a6a9f6ee-02c8-47b4-9d03-901c1a79dd33
TenantId=***
Title=Apply company customisations
Verbose=True
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Test-TargetResource returned False
VERBOSE: [mycomputer]: LCM:  [ End    Test     ]  [[SPOSiteScript]SPOSiteScript-Apply company customisations]  in 29.7470 seconds.
VERBOSE: [mycomputer]: LCM:  [ Start  Set      ]  [[SPOSiteScript]SPOSiteScript-Apply company customisations]
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Setting Site Script: Apply company customisations
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Getting Site Script: Apply company customisations
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Getting the SPO Site Script: Apply company customisations
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Site Script, {Apply company customisations}, doesn't exist. Creating it.
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Waiting for another 3 seconds for Site Script to be ready.
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Site Script, {Apply company customisations}, has been successfully created.
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Site Script, {Apply company customisations} already exists, updating its settings
VERBOSE: [mycomputer]: LCM:  [ End    Set      ]  [[SPOSiteScript]SPOSiteScript-Apply company customisations]  in 8.6300 seconds.
VERBOSE: [mycomputer]: LCM:  [ End    Resource ]  [[SPOSiteScript]SPOSiteScript-Apply company customisations]
VERBOSE: [mycomputer]: LCM:  [ Start  Resource ]  [[SPOSiteDesign]SPOSiteDesign-Apply company customisations]
VERBOSE: [mycomputer]: LCM:  [ Start  Test     ]  [[SPOSiteDesign]SPOSiteDesign-Apply company customisations]
VERBOSE: [mycomputer]:                            [[SPOSiteDesign]SPOSiteDesign-Apply company customisations] Testing configuration for SPO SiteDesign for Apply company customisations
VERBOSE: [mycomputer]:                            [[SPOSiteDesign]SPOSiteDesign-Apply company customisations] Getting configuration for SPO SiteDesign for Apply company customisations
VERBOSE: [mycomputer]:                            [[SPOSiteDesign]SPOSiteDesign-Apply company customisations] Getting Site Design for Apply company customisations
VERBOSE: [mycomputer]:                            [[SPOSiteDesign]SPOSiteDesign-Apply company customisations] No site designs with the identity provided through Identity have been found
VERBOSE: [mycomputer]:                            [[SPOSiteDesign]SPOSiteDesign-Apply company customisations] No Site Design found for Apply company customisations
VERBOSE: [mycomputer]:                            [[SPOSiteDesign]SPOSiteDesign-Apply company customisations] Current Values: ApplicationId=***
CertificateThumbprint=***
Description=Default team site template, ensures company customisations are applied when the site is created via the request portal, otherwise a standard site
Ensure=Absent
IsDefault=False
SiteScriptNames=(Apply company customisations)
TenantId=***
Title=Apply company customisations
Verbose=True
Version=1
WebTemplate=TeamSite
VERBOSE: [mycomputer]:                            [[SPOSiteDesign]SPOSiteDesign-Apply company customisations] Target Values: ApplicationId=***
CertificateThumbprint=***
Description=Default team site template, ensures company customisations are applied when the site is created via the request portal, otherwise a standard site
Ensure=Present
isDefault=False
SiteScriptNames=(Apply company customisations)
TenantId=***
Title=Apply company customisations
Verbose=True
Version=1
WebTemplate=TeamSite
VERBOSE: [mycomputer]:                            [[SPOSiteDesign]SPOSiteDesign-Apply company customisations] Test-TargetResource returned False
VERBOSE: [mycomputer]: LCM:  [ End    Test     ]  [[SPOSiteDesign]SPOSiteDesign-Apply company customisations]  in 0.4370 seconds.
VERBOSE: [mycomputer]: LCM:  [ Start  Set      ]  [[SPOSiteDesign]SPOSiteDesign-Apply company customisations]
VERBOSE: [mycomputer]:                            [[SPOSiteDesign]SPOSiteDesign-Apply company customisations] Setting configuration for SPO SiteDesign for Apply company customisations
VERBOSE: [mycomputer]:                            [[SPOSiteDesign]SPOSiteDesign-Apply company customisations] Getting configuration for SPO SiteDesign for Apply company customisations
VERBOSE: [mycomputer]:                            [[SPOSiteDesign]SPOSiteDesign-Apply company customisations] Getting Site Design for Apply company customisations
VERBOSE: [mycomputer]:                            [[SPOSiteDesign]SPOSiteDesign-Apply company customisations] No site designs with the identity provided through Identity have been found
VERBOSE: [mycomputer]:                            [[SPOSiteDesign]SPOSiteDesign-Apply company customisations] No Site Design found for Apply company customisations
VERBOSE: [mycomputer]:                            [[SPOSiteDesign]SPOSiteDesign-Apply company customisations] Adding new site design Apply company customisations
VERBOSE: [mycomputer]: LCM:  [ End    Set      ]  [[SPOSiteDesign]SPOSiteDesign-Apply company customisations]  in 3.6670 seconds.
VERBOSE: [mycomputer]: LCM:  [ End    Resource ]  [[SPOSiteDesign]SPOSiteDesign-Apply company customisations]
WARNING: Falling back to the previous MOF file or system defaults because the meta configuration mof does not exist or has either been corrupted or an invalid mof property has been set.
VERBOSE: [mycomputer]: LCM:  [ End    Set      ]
VERBOSE: [mycomputer]: LCM:  [ End    Set      ]    in  46.2460 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 46.406 seconds


Run 2

VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer mycomputer with user sid S-1-12-1-3691799957-1270395199-3808479900-2109869863.
VERBOSE: [mycomputer]: LCM:  [ Start  Set      ]
VERBOSE: [mycomputer]: LCM:  [ Start  Resource ]  [[SPOSiteScript]SPOSiteScript-Apply company customisations]
VERBOSE: [mycomputer]: LCM:  [ Start  Test     ]  [[SPOSiteScript]SPOSiteScript-Apply company customisations]
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Testing configuration for Site Script Apply company customisations
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Getting Site Script: Apply company customisations
WARNING: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] 
A newer version of PnP PowerShell is available: 2.12.0.

Use 'Update-Module -Name PnP.PowerShell' to update.
Use 'Get-PnPChangeLog -Release 2.12.0' to list changes.

You can turn this check off by setting the 'PNPPOWERSHELL_UPDATECHECK' environment variable to 'Off'.
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Getting the SPO Site Script: Apply company customisations
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Connecting to the SharePoint Online Admin Center at 'https://mysp-admin.sharepoint.com' to run this cmdlet
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Connected to the SharePoint Online Admin Center at 'https://mysp-admin.sharepoint.com' to run this cmdlet
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Current Values: ApplicationId=***
CertificateThumbprint=***
Content={     "": "schema.json",     "actions": [         {             "verb": "setRegionalSettings",             "locale": 2057,             "sortOrder": 25,             "hourFormat": "24"         },         {             "verb": "triggerFlow",             "url": "https://prod-21.uksouth.logic.azure.com:443/workflows/[GUID-REMOVED]
/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=[key-removed]",             "name": "Apply company customisations",             "parameters": {                 "event": "Microsoft Event",                 "product": "SharePoint"             }         }     ],     "b
indata": {},     "version": 1 }
Ensure=Absent
Identity=a6a9f6ee-02c8-47b4-9d03-901c1a79dd33
TenantId=***
Title=Apply company customisations
Verbose=True
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Target Values: ApplicationId=***
CertificateThumbprint=***
Content={     "": "schema.json",     "actions": [         {             "verb": "setRegionalSettings",             "locale": 2057,             "sortOrder": 25,             "hourFormat": "24"         },         {             "verb": "triggerFlow",             "url": "https://prod-21.uksouth.logic.azure.com:443/workflows/[GUID-REMOVED]
/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=[key-removed]",             "name": "Apply company customisations",             "parameters": {                 "event": "Microsoft Event",                 "product": "SharePoint"             }         }     ],     "b
indata": {},     "version": 1 }
Ensure=Present
Identity=a6a9f6ee-02c8-47b4-9d03-901c1a79dd33
TenantId=***
Title=Apply company customisations
Verbose=True
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Test-TargetResource returned False
VERBOSE: [mycomputer]: LCM:  [ End    Test     ]  [[SPOSiteScript]SPOSiteScript-Apply company customisations]  in 17.6200 seconds.
VERBOSE: [mycomputer]: LCM:  [ Start  Set      ]  [[SPOSiteScript]SPOSiteScript-Apply company customisations]
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Setting Site Script: Apply company customisations
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Getting Site Script: Apply company customisations
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Getting the SPO Site Script: Apply company customisations
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Site Script, {Apply company customisations}, doesn't exist. Creating it.
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Waiting for another 3 seconds for Site Script to be ready.
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Site Script, {Apply company customisations}, has been successfully created.
VERBOSE: [mycomputer]:                            [[SPOSiteScript]SPOSiteScript-Apply company customisations] Site Script, {Apply company customisations} already exists, updating its settings
VERBOSE: [mycomputer]: LCM:  [ End    Set      ]  [[SPOSiteScript]SPOSiteScript-Apply company customisations]  in 12.7910 seconds.
VERBOSE: [mycomputer]: LCM:  [ End    Resource ]  [[SPOSiteScript]SPOSiteScript-Apply company customisations]
VERBOSE: [mycomputer]: LCM:  [ Start  Resource ]  [[SPOSiteDesign]SPOSiteDesign-Apply company customisations]
VERBOSE: [mycomputer]: LCM:  [ Start  Test     ]  [[SPOSiteDesign]SPOSiteDesign-Apply company customisations]
VERBOSE: [mycomputer]:                            [[SPOSiteDesign]SPOSiteDesign-Apply company customisations] Testing configuration for SPO SiteDesign for Apply company customisations
VERBOSE: [mycomputer]:                            [[SPOSiteDesign]SPOSiteDesign-Apply company customisations] Getting configuration for SPO SiteDesign for Apply company customisations
VERBOSE: [mycomputer]:                            [[SPOSiteDesign]SPOSiteDesign-Apply company customisations] Getting Site Design for Apply company customisations
VERBOSE: [mycomputer]:                            [[SPOSiteDesign]SPOSiteDesign-Apply company customisations] Current Values: AccessTokens=$null
ApplicationId=***
ApplicationSecret=$null
CertificatePassword=$null
CertificatePath=***
CertificateThumbprint=***
Credential=$null
Description=Default team site template, ensures company customisations are applied when the site is created via the request portal, otherwise a standard site
Ensure=Present
IsDefault=False
Managedidentity=False
PreviewImageAltText=$null
PreviewImageUrl=$null
SiteScriptNames=(Apply company customisations)
TenantId=***
Title=Apply company customisations
Version=1
WebTemplate=TeamSite
VERBOSE: [mycomputer]:                            [[SPOSiteDesign]SPOSiteDesign-Apply company customisations] Target Values: ApplicationId=***
CertificateThumbprint=***
Description=Default team site template, ensures company customisations are applied when the site is created via the request portal, otherwise a standard site
Ensure=Present
isDefault=False
SiteScriptNames=(Apply company customisations)
TenantId=***
Title=Apply company customisations
Verbose=True
Version=1
WebTemplate=TeamSite
VERBOSE: [mycomputer]:                            [[SPOSiteDesign]SPOSiteDesign-Apply company customisations] Test-TargetResource returned True
VERBOSE: [mycomputer]: LCM:  [ End    Test     ]  [[SPOSiteDesign]SPOSiteDesign-Apply company customisations]  in 1.6230 seconds.
VERBOSE: [mycomputer]: LCM:  [ Skip   Set      ]  [[SPOSiteDesign]SPOSiteDesign-Apply company customisations]
VERBOSE: [mycomputer]: LCM:  [ End    Resource ]  [[SPOSiteDesign]SPOSiteDesign-Apply company customisations]
WARNING: Falling back to the previous MOF file or system defaults because the meta configuration mof does not exist or has either been corrupted or an invalid mof property has been set.
VERBOSE: [mycomputer]: LCM:  [ End    Set      ]
VERBOSE: [mycomputer]: LCM:  [ End    Set      ]    in  35.6810 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 35.824 seconds

Environment Information + PowerShell Version

OsName               : Microsoft Windows 11 Enterprise
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 22621.1.amd64fre.ni_release.220506-1250
OsLanguage           : en-US
OsMuiLanguages       : {en-US, en-GB}

Key   : PSVersion
Value : 5.1.22621.4391
Name  : PSVersion

Key   : PSEdition
Value : Desktop
Name  : PSEdition

Key   : PSCompatibleVersions
Value : {1.0, 2.0, 3.0, 4.0...}
Name  : PSCompatibleVersions

Key   : BuildVersion
Value : 10.0.22621.4391
Name  : BuildVersion

Key   : CLRVersion
Value : 4.0.30319.42000
Name  : CLRVersion

Key   : WSManStackVersion
Value : 3.0
Name  : WSManStackVersion

Key   : PSRemotingProtocolVersion
Value : 2.3
Name  : PSRemotingProtocolVersion

Key   : SerializationVersion
Value : 1.1.0.1
Name  : SerializationVersion
@FabienTschanz
Copy link
Collaborator

FabienTschanz commented Mar 7, 2025

@pmatthews05 PR open to fix it. The issue is because there is an Identity property specified that most likely refers to a non-existing one. This will be fixed, just checked it on my machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants