This blog post is a combination of old and new features of Azure AD Connect Sync and Azure AD Cloud Sync tools. AAD Connect Sync feature was there already and what’s new is the Sync Client’s feature of preventing accidental deletion.

There can be many reasons for this kind of mishap to take place

What will I be Covering? 👇🏽

  1. How to Configure Azure AD Connect Sync
  2. Command to see the current threshold
  3. Change the threshold as required
  4. What will happen?
  5. Check which objects are about to be deleted
  6. How to Configure Azure AD Cloud Sync
  7. Rejecting deletions
  8. Wrapping Up

How to Configure Azure AD Connect Sync

The default value to halt the operation is 500, but this can be changed to a lower number to minimize the risk.

Command to see the current threshold

Run the below command by logging to the Azure AD Connect server

get-ADSyncExportDeletionThreshold

get-ADSyncExportDeletionThreshold

Change the threshold as required

enable-ADSyncExportDeletionThreshold -DeletionThreshold 10

What will happen?

Check which objects are about to be deleted

Search Connector Space

How to Configure Azure AD Cloud Sync

As of September 2022, this is the most recent announcement from Microsoft as they have now enabled the same in the Azure AD Cloud Sync tool as well.

How to Configure Azure AD Cloud Sync

This needs to be managed through the Azure AD portal itself. If you already have the Cloud Sync tool installed and running,

Check the section under Settings. Provide the same info with the notification email address, prevent check mark, and the threshold. By default, it’s 500 but as you can see below I have set it to 3.

edit cloud sync configuration

When the sync runs it will identify the deletion and makes the status as Delete threshold exceeded. You can click the 3 dots next to the status and select View provisioning logs. If you are certain about the deletion, you can select Allow deletions option.

Azure Ad Connect cloud sync

Provisioning Logs will provide you all the details related to the sync, but filter the Actions with StagedDelete

Provisioning Logs

Rejecting deletions

If you do not want to allow the deletions, you need to do the following:

Wrapping Up

While it’s safer to have a smaller number for the threshold, it’s always recommended to enable the AD Recycle Bin and in the case of user deletion, the accounts can be reinstated without much of a hassle.