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
Denying an entity sync during an asynchronous task will have no effect.
To check whether or not the entity is denied during the synchronization process, use the following method:
$targetEntity.IsDenied();WARNING
The usage 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 that require complex filtering, link filters should be used as much as possible.
WARNING
Since only entities in the TargetEntities collection can be denied, the method IsDenied is only available for them. If the method IsDenied is accessed by entities in the SourceEntities Collection, this will cause an error.
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)
}
}