Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,12 @@ function New-IdleEntraConnectDirectorySyncProvider {
try {
$remoteSession = $this.NewRemoteSession($ComputerName, $AuthSession)

$this.InvokeRemoteCommand($remoteSession, {
$syncScript = {
param([string] $RemotePolicyType)
Import-Module -Name ADSync -ErrorAction Stop
Start-ADSyncSyncCycle -PolicyType $RemotePolicyType -ErrorAction Stop
}, @($PolicyType)) | Out-Null
}
$this.InvokeRemoteCommand($remoteSession, $syncScript, @($PolicyType)) | Out-Null

return [pscustomobject]@{
Started = $true
Expand Down Expand Up @@ -220,10 +221,11 @@ function New-IdleEntraConnectDirectorySyncProvider {
try {
$remoteSession = $this.NewRemoteSession($ComputerName, $AuthSession)

$scheduler = $this.InvokeRemoteCommand($remoteSession, {
$schedulerScript = {
Import-Module -Name ADSync -ErrorAction Stop
Get-ADSyncScheduler -ErrorAction Stop
}, @())
}
$scheduler = $this.InvokeRemoteCommand($remoteSession, $schedulerScript, @())

# Determine if sync is in progress
# Get-ADSyncScheduler returns an object with SyncCycleInProgress property
Expand Down
4 changes: 2 additions & 2 deletions src/IdLE.Provider.EntraID/Private/New-IdleEntraIDAdapter.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ function New-IdleEntraIDAdapter {
# HttpResponseHeaders (PowerShell 7 / HttpClient) does not support
# indexer-style access. Use GetValues() with a safety catch for the
# case where the header is absent (GetValues throws in that case).
try { $requestId = $_.Exception.Response.Headers.GetValues('request-id') | Select-Object -First 1 } catch { }
try { $retryAfter = $_.Exception.Response.Headers.GetValues('Retry-After') | Select-Object -First 1 } catch { }
try { $requestId = $_.Exception.Response.Headers.GetValues('request-id') | Select-Object -First 1 } catch { $requestId = $null }
try { $retryAfter = $_.Exception.Response.Headers.GetValues('Retry-After') | Select-Object -First 1 } catch { $retryAfter = $null }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -841,10 +841,9 @@ function New-IdleEntraIDIdentityProvider {

# When Kind is supplied, only fetch the relevant directory objects.
# When Kind is null/empty, fetch both (backward-compatible, e.g. host-level reports).
$includeGroups = [string]::IsNullOrEmpty($Kind) -or
[string]::Equals($Kind, 'Group', [System.StringComparison]::OrdinalIgnoreCase)
$includeAUs = [string]::IsNullOrEmpty($Kind) -or
[string]::Equals($Kind, 'AdministrativeUnit', [System.StringComparison]::OrdinalIgnoreCase)
$kindIsEmpty = [string]::IsNullOrEmpty($Kind)
$includeGroups = $kindIsEmpty -or [string]::Equals($Kind, 'Group', [System.StringComparison]::OrdinalIgnoreCase)
$includeAUs = $kindIsEmpty -or [string]::Equals($Kind, 'AdministrativeUnit', [System.StringComparison]::OrdinalIgnoreCase)

$result = @()

Expand Down Expand Up @@ -1009,8 +1008,8 @@ function New-IdleEntraIDIdentityProvider {

# Split entitlements by kind: Groups use the Graph $batch path; AUs are processed per-item
# (no Graph batch API exists for Administrative Unit membership changes).
$groupOperations = @()
$administrativeUnitResults = @()
$groupOperations = @()
$administrativeUnitResults = @()

foreach ($ent in $Entitlements) {
$normalized = $this.ConvertToEntitlement($ent)
Expand Down Expand Up @@ -1107,8 +1106,8 @@ function New-IdleEntraIDIdentityProvider {

# Split entitlements by kind: Groups use the Graph $batch path; AUs are processed per-item
# (no Graph batch API exists for Administrative Unit membership changes).
$groupOperations = @()
$administrativeUnitResults = @()
$groupOperations = @()
$administrativeUnitResults = @()

foreach ($ent in $Entitlements) {
$normalized = $this.ConvertToEntitlement($ent)
Expand Down
Loading