PowerShell Script to display account in AD NOT sync into Azure

Kasumu, Abimbola 26 Reputation points

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

Azure Active Directory
Azure Active Directory
An Azure enterprise identity service that provides single sign-on and multi-factor authentication.
14,894 questions
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
761 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 27,101 Reputation points

    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