Skip to content

AuthSession cannot be found also initiated #199

@blindzero

Description

@blindzero

Description

An AuthSessionName in Plan invocation cannot be found, although it is clearly initiated.

Name     : Entra - Block account 
Type     : IdLE.Step.DisableIdentity
Status   : Failed
Error    : Exception calling "AcquireAuthSession" with "2" argument(s): "Exception calling "AcquireAuthSession" with "2" argument(s): "No matching auth session found for     
           Name='Entra', Options={ CorrelationId=a9a7d5d0-d40f-4a97-9b5d-48e5b42546b6, Actor=adm-mafl-server } and no default auth session configured.""
Attempts : 1

Steps to Reproduce

  1. You need some entraAccess token and AD Credentials first (adCred because for next steps not mentioned below).
  2. Workflow definition
@{
    Name           = 'Offboarding Stage 1'
    LifecycleEvent = 'Leaver'

    Steps          = @(
        @{
            Name = 'Entra - Block account'
            Type = 'IdLE.Step.DisableIdentity'
            With = @{
                AuthSessionName = 'Entra'
                IdentityKey = '{{Request.IdentityKeys.sAMAccountName}}@nanotempertech.com'
                Provider = 'Entra'
            }
        }
    )
}
  1. Request is
$request = New-IdleRequest -LifecycleEvent 'Leaver' -IdentityKeys @{
    sAMAccountName = 'max.power'
} -DesiredState @{
    OffboardingDate = '2026-02-30'
} -Actor $env:USERNAME 
  1. Setting up provider and auth Sessions
$authSessions = New-IdleAuthSession -SessionMap @{
    @{ AuthSessionName = 'AD' }  = @{ AuthSessionType = 'Credential'; Credential = $adCred }
    @{ AuthSessionName = 'Entra' } = @{ AuthSessionType = 'OAuth'; Credential = $entraAccessToken }
    @{ AuthSessionName = 'EXO' } = @{ AuthSessionType = 'OAuth'; Credential = $entraAccessToken }
}

# Creating Providers
$providerAD = New-IdleADIdentityProvider
$providerEntra = New-IdleEntraIDIdentityProvider
$providerEXO = New-IdleExchangeOnlineProvider
$providers = @{
    AD = $providerAD
    Entra = $providerEntra
    EXO = $providerEXO
    AuthSessionBroker = $authSessions
}
  1. Plan and Execution
$plan = New-IdlePlan -WorkflowPath $leaverWorkflow -Request $request -Providers $providers
$result = Invoke-IdlePlan -Plan $plan
$result.Status
$result.Steps | Select-Object Name, Status, StartedUtc, FinishedUtc

Expected Behavior

Invoke-IdlePlan should find defined AuthSessions.

Actual Behavior

AuthSession cant be found.
This behavior also remains if only one element is within SessionMap.

Environment

  • PowerShell version: 7.5.4
  • OS: Windows Server 2019
  • IdLE version / commit: 0.9.5

Additional Context

Add any other context, logs, or screenshots here.

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions