Set-EntraDirSyncEnabled
Turns directory synchronization on or off for a company.
Syntax
Set-EntraDirSyncEnabled
-EnableDirSync <Boolean>
[-Force]
[-TenantId <String>]
[<CommonParameters>]
Description
The Set-EntraDirSyncEnabled
cmdlet turns directory synchronization on or off for a company.
Important
It may take up to 72 hours to complete deactivation once you have disabled DirSync through this cmdlet. The time depends on the number of objects that are in your cloud service subscription account. You cannot cancel the disable action. It will need to complete before you can take any other action, including re-enabling of DirSync. If you choose to re-enable DirSync, a full synchronization of your synced objects will happen. This may take a considerable time depending on the number of objects in your Microsoft Entra ID.
Note
If you disable DirSync and you decide to re-enable it, and you have enabled the BlockCloudObjectTakeoverThroughHardMatch feature, OnPrem to cloud object takeover/update for all objects mastered in the Microsoft Entra ID will be blocked. If this is the case and you want to resume syncing Microsoft Entra ID mastered objects with Microsoft Entra ID, set BlockCloudObjectTakeoverThroughHardMatch feature to false.
Examples
Example 1: Turn on directory synchronization
Connect-Entra -Scopes 'OnPremDirectorySynchronization.ReadWrite.All', 'Organization.ReadWrite.All'
$params = @{
EnableDirsync = $True
Force = $True
}
Set-EntraDirSyncEnabled @params
This example turns on directory synchronization for a company.
-EnableDirsync
Specifies whether to turn on directory synchronization on for your company.-Force
Forces the command to run without asking for user confirmation.
Example 2: Turn off directory synchronization
Connect-Entra -Scopes 'OnPremDirectorySynchronization.ReadWrite.All', 'Organization.ReadWrite.All'
$params = @{
EnableDirsync = $False
TenantId = 'aaaabbbb-0000-cccc-1111-dddd2222eeee'
Force = $True
}
Set-EntraDirSyncEnabled @params
This example turns off directory synchronization for a company.
-EnableDirsync
Specifies whether to turn on directory synchronization on for your company.-Force
Forces the command to run without asking for user confirmation.-TenantId
Specifies the unique ID of the tenant on which to perform the operation.
Parameters
-EnableDirsync
Specifies whether to turn on directory synchronization on for your company.
Type: | System.Boolean |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Force
Forces the command to run without asking for user confirmation.
Type: | System.Management.Automation.SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-TenantId
Specifies the unique ID of the tenant on which to perform the operation. The default value is the tenant of the current user. This parameter applies only to partner users.
Type: | System.String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |