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

SPOHomeSite: Returns 'Present' although no home site exists #3577

Closed
ghost opened this issue Aug 15, 2023 · 0 comments · Fixed by #3623 or #3624
Closed

SPOHomeSite: Returns 'Present' although no home site exists #3577

ghost opened this issue Aug 15, 2023 · 0 comments · Fixed by #3623 or #3624
Assignees
Labels
Bug Something isn't working SharePoint Online V1.23.809.1 Version 1.23.809.1

Comments

@ghost
Copy link

ghost commented Aug 15, 2023

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

SPOHomeSite returns 'Present' although no home site exists.
Because when no home site exists Get-PnPHomeSite returns an empty string.

PS> $homeSiteUrl = Get-PnPHomeSite
PS> $homeSiteUrl.length
0
PS> $homeSiteUrl.GetType().FullName
System.String

Verbose logs showing the problem

VERBOSE: [WIN]: LCM: [ Start Resource ] [[SPOHomeSite]SPOHomeSite::[SharePointOnline]Configuration]
VERBOSE: [WIN]: LCM: [ Start Test ] [[SPOHomeSite]SPOHomeSite::[SharePointOnline]Configuration]
VERBOSE: [WIN]: [[SPOHomeSite]SPOHomeSite::[SharePointOnline]Configuration] Testing configuration for home site collection
VERBOSE: [WIN]: [[SPOHomeSite]SPOHomeSite::[SharePointOnline]Configuration] Getting configuration for hub site collection
VERBOSE: [WIN]: [[SPOHomeSite]SPOHomeSite::[SharePointOnline]Configuration] Getting current home site collection settings
VERBOSE: [WIN]: [[SPOHomeSite]SPOHomeSite::[SharePointOnline]Configuration] Current Values: ApplicationId=***
ApplicationSecret=$null
CertificatePassword=$null
CertificatePath=***
CertificateThumbprint=***
Credential=$null
Ensure=Present
IsSingleInstance=Yes
Managedidentity=False
TenantId=***
Url=
VERBOSE: [WIN]: [[SPOHomeSite]SPOHomeSite::[SharePointOnline]Configuration] Target Values: ApplicationId=***
CertificateThumbprint=***
Ensure=Absent
IsSingleInstance=Yes
TenantId=***
Verbose=True
VERBOSE: [WIN]: [[SPOHomeSite]SPOHomeSite::[SharePointOnline]Configuration] Test-TargetResource returned False
VERBOSE: [WIN]: LCM: [ End Test ] [[SPOHomeSite]SPOHomeSite::[SharePointOnline]Configuration] in 1.0140 seconds.
VERBOSE: [WIN]: LCM: [ Start Set ] [[SPOHomeSite]SPOHomeSite::[SharePointOnline]Configuration]
VERBOSE: [WIN]: [[SPOHomeSite]SPOHomeSite::[SharePointOnline]Configuration] Setting configuration for home site ''
VERBOSE: [WIN]: [[SPOHomeSite]SPOHomeSite::[SharePointOnline]Configuration] Getting configuration for hub site collection
VERBOSE: [WIN]: [[SPOHomeSite]SPOHomeSite::[SharePointOnline]Configuration] Getting current home site collection settings
WARNING: [WIN]: [[SPOHomeSite]SPOHomeSite::[SharePointOnline]Configuration] There is currently not site collection set as a home site in your tenant.
VERBOSE: [WIN]: LCM: [ End Set ] [[SPOHomeSite]SPOHomeSite::[SharePointOnline]Configuration] in 0.8780 seconds.
VERBOSE: [WIN]: LCM: [ End Resource ] [[SPOHomeSite]SPOHomeSite::[SharePointOnline]Configuration]

Suggested solution to the issue

Change Get-TargetResource from this:

    if ($null -eq $homeSiteUrl)
    {
        ...
    }

to this:

    if ($homeSiteUrl -eq [String]::Empty)
    {
        ...
    }

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

    SPOHomeSite "SPOHomeSite" {
        Ensure                = "Absent"
        IsSingleInstance      = "Yes"
        ApplicationId         = $ApplicationId
        TenantId              = $TenantId
        CertificateThumbprint = $CertificateThumbprint
    }

The operating system the target node is running

OsName : Microsoft Windows 10 Pro
OsOperatingSystemSKU : 48
OsArchitecture : 64-bit
WindowsVersion : 2009
WindowsBuildLabEx : 19041.1.amd64fre.vb_release.191206-1406
OsLanguage : en-US
OsMuiLanguages : {en-US}

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

1.23.809.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working SharePoint Online V1.23.809.1 Version 1.23.809.1
Projects
None yet
2 participants