Get the Password Hash Sync setting for Entra Cloud Sync using Microsoft Graph and PowerShell

I've recently blogged about how to Get the "Password Hash Sync" setting for Entra Cloud Sync using Microsoft Graph and PowerShell as part of a bigger blog "Get the Cloud Sync configuration for an Entra directory using PowerShell and Microsoft Graph"

The Password Hash Sync setting isn't a boolean value but actually an attribute mapping within the "user" object mapping.

# Determines whether password hash sync is enabled for the job. This only applies to "User and group sync" jobs.

function Get-IsPasswordHashSyncEnabled {

    param (

        $Job

    )

    $schema = Get-MgServicePrincipalSynchronizationJobSchema -ServicePrincipalId $configuration.Id -SynchronizationJobId $Job.Id;

    foreach ($objectMapping in $schema.SynchronizationRules[0].ObjectMappings)

    {

        if ($objectMapping.SourceObjectName -eq "user")

        {

            foreach ($attributeMapping in $objectMapping.AttributeMappings)

            {

                if ($attributeMapping.TargetAttributeName -eq "CredentialData")

                {

                    return $true;

                }

            }

        }

    }

    return $false;

}

Comments

Popular posts from this blog

SOLVED: Exchange Online Management PowerShell Connect-ExchangeOnline bug "A window handle must be configured. See https://aka.ms/msal-net-wam#parent-window-handles"

Windows Server 2016, 2019, 2022, Windows 10 and Windows 11: Date and time "Some settings are managed by your organization".

get-windowsfeature : The given key was not present in the dictionary