DenySync Component

DenySync is a collection to which entities found in the TargetEntities collection can be added.

$denySync.Push($entity);

Adding an entity to denySync will cause the synchronization process to not complete for that entity similar to how DelaySync behaves. For entities added to denySync, however, syncing will not be automatically reattempted until another change is made to that entity. 

This enables a task to prevent the synchronization or provisioning of entities that don't meet a requirement.

WARNING: The useage of denySync should be avoided as a means to simply filter synchronized entities unless absolutely necessary. The links Filters should be employed over filtering via  denySync to avoid unneeded processing. In scenarios which require complex filtering, link filters should be used as much as possible. 

Examples

# Denies sync of all target entities that are not active.
# Note: Used in pre-provisioning task to prevent syncing of already inactive entity but allow active entities to be updated to inactive.
foreach ($targetEntity in $targetEntities)
{
    if ($targetEntity['active'] -eq 'FALSE')
    {
        $denySync.Push($targetEntity);
    }
}
# Denies sync for entities that an external dependency is not met (which should be) and perform an error handling action.
foreach ($targetEntity in $targetEntities)
{
    $dependencyExists = CheckDependencyExists($targetEntity);
    if (-Not $dependencyExists)
    {
        $denySync.Push($targetEntity);
        HandleDependencyNotExisting($targetEntity)
    }
}

Is this article helpful for you?