PowerShell Script to display account in AD NOT sync into Azure

Kasumu, Abimbola 26 Reputation points
2023-05-10T14:46:19.8+00:00

Need a script that displays all users account that are not sync into Azure. And also, a script to syncs these account.

PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,219 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,093 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 44,046 Reputation points
    2023-05-18T09:53:22.71+00:00

    Hello Kasumu,

    Thank you for your question and for reaching out with your question today.

    To find a list of unsynced users, please use the following command:

    PS C:> Get-AzureADUser | Where {$_.DirSyncEnabled -eq $null}

    Now lets sync the accounts using PowerShell. In order to synchronise Azure AD with PowerShell, please use the following command:

    Start-ADSyncSyncCycle -PolicyType Delta

    This command will perform a delta synchronisation which is usually enough.

    To trigger a full synchronisation of Azure AD with PowerShell, use the following command:

    Start-ADSyncSyncCycle -PolicyType Initial

    If the synchronisation is successful, you’ll see output similar to the following:

    PS C:> Start-ADSyncSyncCycle -PolicyType Delta Result ------ Success

    If the reply was helpful, please don’t forget to upvote or accept as answer.

    0 comments No comments