From 92cb66ba27173dfd55ae0eaad68a71844f536c4f Mon Sep 17 00:00:00 2001 From: Matthias Fleschuetz <13959569+blindzero@users.noreply.github.com> Date: Sat, 31 Oct 2026 18:21:54 +0100 Subject: [PATCH 1/7] feat(core)!: bundle all first-party modules in the IdLE module IdLE now loads all first-party modules (engine, step packs, providers) as nested modules. The NestedModules list in src/IdLE/IdLE.psd1 is the single source of truth for the bundle content. - Export the provider factory functions from IdLE. - Add a mixed-version guard to IdLE.Init.ps1: importing IdLE fails with an actionable error if a standalone IdLE.* module from another location is already loaded. - Tests for bundled module loading, factory exports, lazy external dependencies and the guard. BREAKING CHANGE: Import-Module IdLE.Provider.* / IdLE.Steps.* is replaced by Import-Module IdLE. Refs #321 Co-Authored-By: Claude Opus 5.5 --- src/IdLE/IdLE.Init.ps1 | 70 +++++++++++++-- src/IdLE/IdLE.psd1 | 38 +++++--- src/IdLE/IdLE.psm1 | 11 ++- tests/Core/ModuleBootstrap.Tests.ps1 | 74 ++++++++++++--- tests/Packaging/ModuleSurface.Tests.ps1 | 115 +++++++++--------------- 5 files changed, 193 insertions(+), 115 deletions(-) diff --git a/src/IdLE/IdLE.Init.ps1 b/src/IdLE/IdLE.Init.ps1 index d536e04b..4545312e 100644 --- a/src/IdLE/IdLE.Init.ps1 +++ b/src/IdLE/IdLE.Init.ps1 @@ -4,26 +4,27 @@ # Set environment variable to suppress internal module warnings during correct nested load $env:IDLE_ALLOW_INTERNAL_IMPORT = '1' -# region PSModulePath Bootstrap for Repo/Zip Layouts +# region PSModulePath Bootstrap for Repo/Zip Layouts # Add src/ directory to PSModulePath to enable name-based imports # This runs BEFORE NestedModules are loaded from relative paths -# Enables subsequent: Import-Module IdLE.Provider.* and Import-Module IdLE.Steps.* by name -# -# Note: This bootstrap is only needed in repo/zip layouts. For PSGallery published modules, -# this script and ScriptsToProcess are removed by the packaging tool. +# Enables name-based resolution of RequiredModules (e.g. IdLE.Core) when single modules +# under src/ are imported directly (development and tests). +# +# Note: This bootstrap is only needed in repo/zip layouts. In the bundled package +# (PSGallery) the parent folder is not named 'src', so nothing is changed. if ($PSScriptRoot) { $parentDir = Split-Path -Path $PSScriptRoot -Parent - + # Check if parent directory is named 'src' (repo/zip layout indicator) if ((Split-Path -Leaf -Path $parentDir) -eq 'src') { $srcPath = $parentDir - + # Check if src is already in PSModulePath (idempotent) $currentPSModulePath = $env:PSModulePath $pathSeparator = [System.IO.Path]::PathSeparator $paths = $currentPSModulePath -split [regex]::Escape($pathSeparator) - + $alreadyInPath = $false foreach ($p in $paths) { if ($p) { @@ -40,7 +41,7 @@ if ($PSScriptRoot) { } } } - + if (-not $alreadyInPath) { # Add src to PSModulePath at process scope (session-only, non-persistent) $env:PSModulePath = $srcPath + $pathSeparator + $currentPSModulePath @@ -48,3 +49,54 @@ if ($PSScriptRoot) { } } # endregion + +# region Mixed-version guard +# The IdLE bundle ships all first-party modules as nested modules. A standalone IdLE.* module +# (e.g. a discontinued IdLE.Provider.AD package from the PowerShell Gallery) that is already +# loaded into the session could shadow the bundled one and mix versions. Fail early instead. +# +# Runs in a child scope because ScriptsToProcess executes in the caller's session state. +& { + if (-not $PSScriptRoot) { + return + } + + $manifestPath = Join-Path -Path $PSScriptRoot -ChildPath 'IdLE.psd1' + $manifest = Import-PowerShellDataFile -LiteralPath $manifestPath + + $comparison = if ($IsWindows) { [System.StringComparison]::OrdinalIgnoreCase } else { [System.StringComparison]::Ordinal } + $separators = [char[]]@([System.IO.Path]::DirectorySeparatorChar, [System.IO.Path]::AltDirectorySeparatorChar) + + # Map bundled module name -> expected module folder (from the NestedModules entries). + $bundled = @{} + foreach ($entry in @($manifest.NestedModules)) { + $relative = ([string]$entry) -replace '[\\/]', [System.IO.Path]::DirectorySeparatorChar + $nestedManifest = [System.IO.Path]::GetFullPath((Join-Path -Path $PSScriptRoot -ChildPath $relative)) + $name = [System.IO.Path]::GetFileNameWithoutExtension($nestedManifest) + $bundled[$name] = (Split-Path -Path $nestedManifest -Parent).TrimEnd($separators) + } + + $foreign = @( + Get-Module -All -Name 'IdLE.*' | Where-Object { + $bundled.ContainsKey($_.Name) -and + -not [string]::Equals($_.ModuleBase.TrimEnd($separators), $bundled[$_.Name], $comparison) + } | Sort-Object -Property Name -Unique + ) + + if ($foreign.Count -gt 0) { + $details = ($foreign | ForEach-Object { " - $($_.Name) $($_.Version) ($($_.ModuleBase))" }) -join [Environment]::NewLine + $names = ($foreign.Name | ForEach-Object { "'$_'" }) -join ', ' + + $message = @( + "IdLE: standalone IdLE modules are already loaded in this session and conflict with the bundled modules of 'IdLE':" + $details + "All first-party modules are part of the 'IdLE' package. Remove the standalone modules from the session and import IdLE again:" + " Remove-Module -Name $names -Force" + "If the standalone packages are installed from the PowerShell Gallery, uninstall them:" + " Uninstall-Module -Name $names -AllVersions" + ) -join [Environment]::NewLine + + throw $message + } +} +# endregion diff --git a/src/IdLE/IdLE.psd1 b/src/IdLE/IdLE.psd1 index 395c70f2..b1de89a7 100644 --- a/src/IdLE/IdLE.psd1 +++ b/src/IdLE/IdLE.psd1 @@ -4,26 +4,31 @@ GUID = 'e2f1c3a4-7b9d-4f2a-8c3e-1d5b6a7c8e9f' Author = 'Matthias Fleschuetz' Copyright = '(c) Matthias Fleschuetz. All rights reserved.' - Description = 'IdentityLifecycleEngine (IdLE) meta-module. Imports IdLE.Core and optional packs.' + Description = 'IdentityLifecycleEngine (IdLE). Bundles the engine, all first-party step packs and providers.' PowerShellVersion = '7.0' HelpInfoUri = 'https://blindzero.github.io/IdentityLifecycleEngine/' - # ScriptsToProcess runs before NestedModules are loaded - # This script bootstraps PSModulePath for repo/zip layouts + # ScriptsToProcess runs before NestedModules are loaded. + # It bootstraps PSModulePath for repo/zip layouts and rejects sessions that already + # contain standalone IdLE.* modules (mixed versions). ScriptsToProcess = @('IdLE.Init.ps1') - # NestedModules: Core and Steps.Common are loaded as nested dependencies - # - # Source manifest strategy (repo/zip): - # - Uses NestedModules with relative paths (enables Import-Module ./src/IdLE/IdLE.psd1) - # - ScriptsToProcess adds src/ to PSModulePath for subsequent name-based imports - # - # Published manifest strategy (PSGallery): - # - Packaging tool converts to: RequiredModules = @('IdLE.Core', 'IdLE.Steps.Common') - # - Removes NestedModules and ScriptsToProcess (standard PowerShell dependency resolution) + # NestedModules: all first-party modules shipped in the IdLE bundle. + # This list is the single source of truth for the bundle content. + # + # Source manifest (repo/zip): relative paths to the sibling module folders under src/. + # Published manifest (PSGallery): the packaging tool (tools/New-IdleModulePackage.ps1) + # copies the modules to 'Modules//' and rewrites these entries accordingly. NestedModules = @( '..\IdLE.Core\IdLE.Core.psd1', - '..\IdLE.Steps.Common\IdLE.Steps.Common.psd1' + '..\IdLE.Steps.Common\IdLE.Steps.Common.psd1', + '..\IdLE.Steps.DirectorySync\IdLE.Steps.DirectorySync.psd1', + '..\IdLE.Steps.Mailbox\IdLE.Steps.Mailbox.psd1', + '..\IdLE.Provider.AD\IdLE.Provider.AD.psd1', + '..\IdLE.Provider.EntraID\IdLE.Provider.EntraID.psd1', + '..\IdLE.Provider.ExchangeOnline\IdLE.Provider.ExchangeOnline.psd1', + '..\IdLE.Provider.DirectorySync.EntraConnect\IdLE.Provider.DirectorySync.EntraConnect.psd1', + '..\IdLE.Provider.Mock\IdLE.Provider.Mock.psd1' ) FunctionsToExport = @( @@ -32,7 +37,12 @@ 'New-IdlePlan', 'Invoke-IdlePlan', 'Export-IdlePlan', - 'New-IdleAuthSession' + 'New-IdleAuthSession', + 'New-IdleADIdentityProvider', + 'New-IdleEntraIDIdentityProvider', + 'New-IdleExchangeOnlineProvider', + 'New-IdleEntraConnectDirectorySyncProvider', + 'New-IdleMockIdentityProvider' ) CmdletsToExport = @() AliasesToExport = @() diff --git a/src/IdLE/IdLE.psm1 b/src/IdLE/IdLE.psm1 index 7f7d8a25..baeb4be3 100644 --- a/src/IdLE/IdLE.psm1 +++ b/src/IdLE/IdLE.psm1 @@ -2,8 +2,8 @@ Set-StrictMode -Version Latest -# NestedModules in the manifest handle loading IdLE.Core and IdLE.Steps.Common -# PSModulePath bootstrap is performed by IdLE.Init.ps1 via ScriptsToProcess (before NestedModules load) +# NestedModules in the manifest load all first-party modules of the bundle. +# The mixed-version guard is performed by IdLE.Init.ps1 via ScriptsToProcess (before NestedModules load). $PublicPath = Join-Path -Path $PSScriptRoot -ChildPath 'Public' if (Test-Path -Path $PublicPath) { @@ -21,6 +21,11 @@ Export-ModuleMember -Function @( 'New-IdlePlan', 'Invoke-IdlePlan', 'Export-IdlePlan', - 'New-IdleAuthSession' + 'New-IdleAuthSession', + 'New-IdleADIdentityProvider', + 'New-IdleEntraIDIdentityProvider', + 'New-IdleExchangeOnlineProvider', + 'New-IdleEntraConnectDirectorySyncProvider', + 'New-IdleMockIdentityProvider' ) diff --git a/tests/Core/ModuleBootstrap.Tests.ps1 b/tests/Core/ModuleBootstrap.Tests.ps1 index 9b51573c..d72984c1 100644 --- a/tests/Core/ModuleBootstrap.Tests.ps1 +++ b/tests/Core/ModuleBootstrap.Tests.ps1 @@ -56,16 +56,6 @@ Describe 'IdLE Module Bootstrap for Repo/Zip Layouts' { $matchingPaths.Count | Should -BeExactly 1 } - It 'Enables name-based import of provider modules after IdLE import' { - Import-Module $script:IdleManifest -Force -ErrorAction Stop - - { Import-Module IdLE.Provider.Mock -ErrorAction Stop } | Should -Not -Throw - - $providerModule = Get-Module IdLE.Provider.Mock - $providerModule | Should -Not -BeNullOrEmpty - $providerModule.Name | Should -Be 'IdLE.Provider.Mock' - } - It 'Enables name-based import of step modules with RequiredModules after IdLE import' { Import-Module $script:IdleManifest -Force -ErrorAction Stop @@ -74,14 +64,16 @@ Describe 'IdLE Module Bootstrap for Repo/Zip Layouts' { $stepsModule = Get-Module IdLE.Steps.Mailbox $stepsModule | Should -Not -BeNullOrEmpty $stepsModule.Name | Should -Be 'IdLE.Steps.Mailbox' - - $commonModule = Get-Module IdLE.Steps.Common - $commonModule | Should -Not -BeNullOrEmpty } It 'Does not modify PSModulePath when IdLE is imported from a non-repo layout' { $moduleRoot = Join-Path -Path $TestDrive -ChildPath 'psmodules' - $layout = New-IdleTestModuleLayout -DestinationRoot $moduleRoot + # IdLE nests all sibling modules, so the layout must contain the complete bundle. + $modules = @('IdLE') + @( + (Import-PowerShellDataFile -Path $script:IdleManifest).NestedModules | + ForEach-Object { [System.IO.Path]::GetFileNameWithoutExtension($_) } + ) + $layout = New-IdleTestModuleLayout -DestinationRoot $moduleRoot -Modules $modules $idleManifest = Join-Path -Path $layout.Root -ChildPath 'IdLE\IdLE.psd1' $originalPSModulePath = $env:PSModulePath @@ -91,6 +83,60 @@ Describe 'IdLE Module Bootstrap for Repo/Zip Layouts' { $env:PSModulePath | Should -Be $originalPSModulePath Remove-Module IdLE -Force -ErrorAction SilentlyContinue } + + It 'Exports the provider factory functions of the bundled providers' { + Import-Module $script:IdleManifest -Force -ErrorAction Stop + + $exported = (Get-Module IdLE).ExportedCommands.Keys + $exported | Should -Contain 'New-IdleMockIdentityProvider' + $exported | Should -Contain 'New-IdleADIdentityProvider' + + (New-IdleMockIdentityProvider) | Should -Not -BeNullOrEmpty + } + } + + Context 'Mixed-version guard' { + It 'Allows importing IdLE when a bundled module was imported from the same location' { + Import-Module (Join-Path -Path $script:SrcPath -ChildPath 'IdLE.Provider.Mock/IdLE.Provider.Mock.psd1') -Force -ErrorAction Stop + + { Import-Module $script:IdleManifest -Force -ErrorAction Stop } | Should -Not -Throw + } + + It 'Allows re-importing IdLE with -Force' { + Import-Module $script:IdleManifest -Force -ErrorAction Stop + + { Import-Module $script:IdleManifest -Force -ErrorAction Stop } | Should -Not -Throw + } + + It 'Fails with an actionable error when a standalone IdLE module is already loaded' { + $standaloneRoot = Join-Path -Path $TestDrive -ChildPath 'standalone' + $null = New-IdleTestModuleLayout -DestinationRoot $standaloneRoot -Modules @('IdLE.Provider.Mock') + $standaloneManifest = Join-Path -Path $standaloneRoot -ChildPath 'IdLE.Provider.Mock/IdLE.Provider.Mock.psd1' + + $standaloneEscaped = $standaloneManifest -replace "'", "''" + $idleEscaped = $script:IdleManifest -replace "'", "''" + $script = @" +Import-Module '$standaloneEscaped' -ErrorAction Stop +try { + Import-Module '$idleEscaped' -ErrorAction Stop + 'IMPORTED' +} +catch { + `$_.Exception.Message +} +'IdLE loaded: ' + [bool](Get-Module -Name IdLE) +"@ + + $result = Invoke-IdleIsolatedPwsh -Script $script -WorkingDirectory $script:RepoRoot + + $result.ExitCode | Should -Be 0 -Because $result.StdErr + $result.StdOut | Should -Not -Match 'IMPORTED' + $result.StdOut | Should -Match 'standalone IdLE modules are already loaded' + $result.StdOut | Should -Match ([regex]::Escape('IdLE.Provider.Mock')) + $result.StdOut | Should -Match ([regex]::Escape("Remove-Module -Name 'IdLE.Provider.Mock' -Force")) + $result.StdOut | Should -Match ([regex]::Escape("Uninstall-Module -Name 'IdLE.Provider.Mock' -AllVersions")) + $result.StdOut | Should -Match 'IdLE loaded: False' + } } Context 'IdLE exports expected public API' { diff --git a/tests/Packaging/ModuleSurface.Tests.ps1 b/tests/Packaging/ModuleSurface.Tests.ps1 index 2a156012..ed37426e 100644 --- a/tests/Packaging/ModuleSurface.Tests.ps1 +++ b/tests/Packaging/ModuleSurface.Tests.ps1 @@ -62,6 +62,11 @@ Describe 'Module manifests and public surface' { 'New-IdlePlan' 'Test-IdleWorkflow' 'Export-IdlePlan' + 'New-IdleADIdentityProvider' + 'New-IdleEntraIDIdentityProvider' + 'New-IdleExchangeOnlineProvider' + 'New-IdleEntraConnectDirectorySyncProvider' + 'New-IdleMockIdentityProvider' ) | Sort-Object $actual = (Get-Command -Module IdLE).Name | Sort-Object @@ -128,13 +133,8 @@ Describe 'Module manifests and public surface' { Import-Module $script:IdlePsd1 -Force -ErrorAction Stop - # NOTE: In repo/zip layouts, PSModulePath bootstrap causes NestedModules to resolve - # via PSModulePath, which exports them globally. This is a known limitation/tradeoff - # to enable name-based imports of providers and optional steps after IdLE import. - # In published PSGallery packages, RequiredModules are used instead, maintaining proper scope. - # # The step registry supports both: - # - Global commands: 'Invoke-IdleStepEmitEvent' (repo/zip with PSModulePath bootstrap) + # - Global commands: 'Invoke-IdleStepEmitEvent' (step pack imported directly, e.g. by tests) # - Module-qualified: 'IdLE.Steps.Common\Invoke-IdleStepEmitEvent' (nested modules without global export) # # Both formats work correctly - the engine can invoke either unqualified or module-qualified handlers. @@ -169,27 +169,18 @@ Describe 'Module manifests and public surface' { Import-Module $script:IdlePsd1 -Force -ErrorAction Stop - # NOTE: In repo/zip layouts, PSModulePath bootstrap causes NestedModules to resolve - # via PSModulePath, which exports them globally. This is a known limitation/tradeoff. - # In published PSGallery packages, RequiredModules maintain proper scope. - # # Verify IdLE.Core is loaded and accessible (use -All to catch nested modules) $coreModule = Get-Module -All IdLE.Core $coreModule | Should -Not -BeNullOrEmpty } - It 'IdLE module imports IdLE.Core and IdLE.Steps.Common via bootstrap' { + It 'IdLE module imports IdLE.Core and IdLE.Steps.Common as nested modules' { Remove-Module IdLE -Force -ErrorAction SilentlyContinue Import-Module $script:IdlePsd1 -Force -ErrorAction Stop $idle = Get-Module IdLE $idle | Should -Not -BeNullOrEmpty - # With the new name-based import approach, IdLE.Core and IdLE.Steps.Common - # are imported by IdLE.psm1 bootstrap logic, not via NestedModules in manifest. - # Verify they are loaded and accessible to the engine. - # Note: They may appear in Get-Module -All depending on import scope. - # The key validation is that IdLE public commands work (which depend on Core) $publicCommands = (Get-Command -Module IdLE).Name $publicCommands | Should -Contain 'New-IdlePlan' @@ -203,73 +194,47 @@ Describe 'Module manifests and public surface' { } } - Context 'Baseline modules' { - It 'IdLE auto-imports only baseline modules (Core and Steps.Common), not optional modules' { - # Clean test state - remove ALL IdLE modules to ensure fresh import - Get-Module -All IdLE* | Remove-Module -Force -ErrorAction SilentlyContinue - - # Import without -Force to avoid re-importing previously loaded optional modules - # (PowerShell module caching can cause previously imported modules to be re-loaded with -Force) - Import-Module $script:IdlePsd1 -ErrorAction Stop + Context 'Bundled modules' { + It 'IdLE imports all bundled first-party modules from the bundle' { + Get-Module -All IdLE* | Remove-Module -Force -ErrorAction SilentlyContinue - $idle = Get-Module IdLE - $idle | Should -Not -BeNullOrEmpty + Import-Module $script:IdlePsd1 -ErrorAction Stop - # Define expected baseline modules in one place - $baselineModules = @('IdLE.Core', 'IdLE.Steps.Common') + $idleBase = (Get-Module IdLE).ModuleBase + $bundled = @((Import-PowerShellDataFile -Path $script:IdlePsd1).NestedModules) + $bundled.Count | Should -Be 9 - # With name-based import, baseline modules are loaded via NestedModules - # Verify public API is available (depends on Core and Steps.Common being loaded) - $publicCommands = (Get-Command -Module IdLE).Name - $publicCommands | Should -Contain 'New-IdlePlan' - $publicCommands | Should -Contain 'Invoke-IdlePlan' - - # Verify built-in steps are available (depends on Steps.Common) - InModuleScope IdLE.Core { - $registry = Get-IdleStepRegistry -Providers $null - $registry.ContainsKey('IdLE.Step.EmitEvent') | Should -BeTrue - } + foreach ($entry in $bundled) { + $name = [System.IO.Path]::GetFileNameWithoutExtension($entry) + $expectedBase = Split-Path -Path ([System.IO.Path]::GetFullPath((Join-Path -Path $idleBase -ChildPath $entry))) -Parent - # Verify baseline modules are loaded - foreach ($moduleName in $baselineModules) { - $module = Get-Module -All -Name $moduleName - $module | Should -Not -BeNullOrEmpty -Because "$moduleName should be loaded as a baseline module" - } + $module = Get-Module -All -Name $name | Select-Object -First 1 + $module | Should -Not -BeNullOrEmpty -Because "$name is part of the IdLE bundle" + $module.ModuleBase | Should -Be $expectedBase + } - # Verify no optional providers or step modules are imported - # NOTE: PowerShell's Import-Module -Force can cause previously imported modules to be re-loaded - # even after Remove-Module. This is a known PowerShell behavior where module dependency resolution - # can trigger re-import of dependent modules. Since we removed -Force above, this should work correctly. - # - # Optional modules should only be imported when explicitly requested by the user - $optionalProviders = @('IdLE.Provider.AD', 'IdLE.Provider.EntraID', 'IdLE.Provider.ExchangeOnline') - $optionalSteps = @('IdLE.Steps.Mailbox') - - # Check providers - foreach ($moduleName in $optionalProviders) { - (Get-Module -All -Name $moduleName) | Should -BeNullOrEmpty -Because "$moduleName should not be auto-imported" - } - - # Check optional steps - foreach ($moduleName in $optionalSteps) { - # Skip IdLE.Steps.Mailbox if it was loaded by ModuleBootstrap test - # Due to PowerShell module caching, it may persist across test cleanup - if ($moduleName -eq 'IdLE.Steps.Mailbox') { - $mailboxModule = Get-Module -All -Name $moduleName - if ($mailboxModule) { - Write-Verbose "IdLE.Steps.Mailbox is loaded (likely from ModuleBootstrap test). In a fresh PowerShell session, it would NOT be auto-imported." - continue - } + # Built-in steps of all bundled step packs are available to the engine. + InModuleScope IdLE.Core { + $registry = Get-IdleStepRegistry -Providers $null + $registry.ContainsKey('IdLE.Step.EmitEvent') | Should -BeTrue + $registry.ContainsKey('IdLE.Step.TriggerDirectorySync') | Should -BeTrue + $registry.ContainsKey('IdLE.Step.Mailbox.GetInfo') | Should -BeTrue } - (Get-Module -All -Name $moduleName) | Should -BeNullOrEmpty -Because "$moduleName should not be auto-imported" } - # NOTE: IdLE.Steps.DirectorySync and IdLE.Provider.DirectorySync.EntraConnect are imported by - # Import-IdleTestModule in BeforeAll. IdLE.Steps.Mailbox may be imported by ModuleBootstrap test. - # Due to PowerShell module caching, they may persist across test cleanup (Remove-Module) and - # re-appear when their dependencies are re-imported. - # This is a known test isolation limitation in PowerShell and doesn't reflect actual module behavior. - # In a fresh PowerShell session, these modules are NOT auto-imported when importing IdLE. + It 'Importing IdLE loads no external (non-IdLE) module' { + $idlePsd1Escaped = $script:IdlePsd1 -replace "'", "''" + $script = @" +`$before = @(Get-Module -All | ForEach-Object Name) +Import-Module '$idlePsd1Escaped' -ErrorAction Stop +`$added = @(Get-Module -All | Where-Object { `$before -notcontains `$_.Name -and `$_.Name -notlike 'IdLE*' -and -not `$_.ModuleBase.StartsWith(`$PSHOME) } | ForEach-Object Name) +`$added -join ',' +"@ + + $result = Invoke-IdleIsolatedPwsh -Script $script -WorkingDirectory $script:RepoRoot + + $result.ExitCode | Should -Be 0 -Because $result.StdErr + $result.StdOut.Trim() | Should -BeNullOrEmpty -Because 'external dependencies (e.g. ActiveDirectory, ADSync, Microsoft.Graph) must be loaded lazily' } } From 197a46a9d66cc0f9ad1b164570d278a0579b21f2 Mon Sep 17 00:00:00 2001 From: Matthias Fleschuetz <13959569+blindzero@users.noreply.github.com> Date: Sat, 31 Oct 2026 18:21:54 +0100 Subject: [PATCH 2/7] build(release)!: publish a single bundled IdLE package - New-IdleModulePackage.ps1 only builds the bundle (IdLE/Modules//) and rewrites the staged NestedModules paths; MultiModule mode and the manifest transformation are removed. - Remove tools/ModulePublishOrder.psd1 (bundle content comes from the IdLE manifest). - Release workflow publishes one package; the local PSRepository test verifies that all bundled modules load from the installed package. BREAKING CHANGE: standalone IdLE.* packages are no longer published. Refs #321 Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release.yml | 125 ++---- .../Packaging/New-IdleModulePackage.Tests.ps1 | 86 ++++ tools/Generate-IdleStepReference.ps1 | 2 +- tools/ModulePublishOrder.psd1 | 26 -- tools/New-IdleModulePackage.ps1 | 366 +++--------------- 5 files changed, 174 insertions(+), 431 deletions(-) create mode 100644 tests/Packaging/New-IdleModulePackage.Tests.ps1 delete mode 100644 tools/ModulePublishOrder.psd1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 699882f7..567a5174 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -266,26 +266,17 @@ jobs: Import-Module PowerShellGet -Force Get-Module PowerShellGet | Select-Object Name, Version, Path | Format-List - - name: Build publishable module packages (multi-module for PSGallery) + - name: Build publishable module package (bundled IdLE) shell: pwsh run: | - ./tools/New-IdleModulePackage.ps1 -Mode MultiModule -Clean | Format-List FullName + ./tools/New-IdleModulePackage.ps1 -Clean | Format-List FullName - - name: Publish modules to local PSRepository and verify install/import + - name: Publish bundle to local PSRepository and verify install/import shell: pwsh run: | - $modulesPath = Join-Path $env:GITHUB_WORKSPACE 'artifacts/modules' - if (-not (Test-Path -LiteralPath $modulesPath)) { - throw "Staged modules path not found: $modulesPath" - } - - # Ensure required modules are discoverable during Test-ModuleManifest/Publish-Module. - # Save original PSModulePath to restore before install/import verification. - $originalPSModulePath = $env:PSModulePath - $pathSeparator = [System.IO.Path]::PathSeparator - $modulePathEntries = $env:PSModulePath -split [regex]::Escape($pathSeparator) - if ($modulePathEntries -notcontains $modulesPath) { - $env:PSModulePath = $modulesPath + $pathSeparator + $env:PSModulePath + $packagePath = Join-Path $env:GITHUB_WORKSPACE 'artifacts/IdLE' + if (-not (Test-Path -LiteralPath $packagePath)) { + throw "Staged package path not found: $packagePath" } $repoPath = Join-Path $env:RUNNER_TEMP 'psrepo' @@ -293,27 +284,9 @@ jobs: Register-PSRepository -Name 'LocalRepo' -SourceLocation $repoPath -PublishLocation $repoPath -InstallationPolicy Trusted - # Load publish order from configuration - $configPath = Join-Path $env:GITHUB_WORKSPACE 'tools/ModulePublishOrder.psd1' - $config = Import-PowerShellDataFile -LiteralPath $configPath - $publishOrder = $config.PublishOrder - - Write-Host "Publishing modules in dependency order from configuration..." - - foreach ($moduleName in $publishOrder) { - $modulePath = Join-Path $modulesPath $moduleName - if (-not (Test-Path -LiteralPath $modulePath)) { - throw "Module listed in ModulePublishOrder.psd1 not found: $moduleName at $modulePath. This indicates an incomplete build and must be fixed before release." - } - - Write-Host "Publishing $moduleName..." - Publish-Module -Path $modulePath -Repository 'LocalRepo' -ErrorAction Stop - Write-Host " ✓ Published $moduleName" - } - - # Restore original PSModulePath before install/import verification - # to ensure Import-Module resolves the installed package, not the staged build. - $env:PSModulePath = $originalPSModulePath + Write-Host "Publishing IdLE..." + Publish-Module -Path $packagePath -Repository 'LocalRepo' -ErrorAction Stop + Write-Host " ✓ Published IdLE" # Test that IdLE can be installed and imports correctly Write-Host "`nInstalling IdLE from LocalRepo..." @@ -322,14 +295,20 @@ jobs: $m = Get-Module IdLE if (-not $m) { throw 'IdLE did not import successfully.' } - Write-Host "Imported IdLE: $($m.Name) $($m.Version)" + Write-Host "Imported IdLE: $($m.Name) $($m.Version) from $($m.ModuleBase)" + + # Verify all bundled modules were loaded from the installed package + $expected = @((Import-PowerShellDataFile -LiteralPath (Join-Path $m.ModuleBase 'IdLE.psd1')).NestedModules | + ForEach-Object { [System.IO.Path]::GetFileNameWithoutExtension($_) }) + foreach ($name in $expected) { + $nested = Get-Module -All -Name $name | Select-Object -First 1 + if (-not $nested) { throw "$name was not loaded as nested module." } + if (-not $nested.ModuleBase.StartsWith($m.ModuleBase)) { throw "$name was loaded from '$($nested.ModuleBase)', not from the bundle." } + Write-Host " ✓ $name $($nested.Version)" + } - # Verify dependencies were installed - $core = Get-Module IdLE.Core - $steps = Get-Module IdLE.Steps.Common - if (-not $core) { throw 'IdLE.Core was not loaded as dependency.' } - if (-not $steps) { throw 'IdLE.Steps.Common was not loaded as dependency.' } - Write-Host "Dependencies loaded: IdLE.Core $($core.Version), IdLE.Steps.Common $($steps.Version)" + $factory = Get-Command -Module IdLE -Name 'New-IdleMockIdentityProvider' -ErrorAction SilentlyContinue + if (-not $factory) { throw 'IdLE does not export the provider factory functions.' } Unregister-PSRepository -Name 'LocalRepo' -ErrorAction SilentlyContinue @@ -369,12 +348,12 @@ jobs: Import-Module PowerShellGet -Force Get-Module PowerShellGet | Select-Object Name, Version, Path | Format-List - - name: Build publishable module packages (multi-module for PSGallery) + - name: Build publishable module package (bundled IdLE) shell: pwsh run: | - ./tools/New-IdleModulePackage.ps1 -Mode MultiModule -Clean | Format-List FullName + ./tools/New-IdleModulePackage.ps1 -Clean | Format-List FullName - - name: Publish modules to PSGallery + - name: Publish IdLE to PSGallery shell: pwsh env: PSGALLERY_API_KEY: ${{ secrets.PSGALLERY_API_KEY }} @@ -383,52 +362,14 @@ jobs: throw "Missing secret PSGALLERY_API_KEY." } - $modulesPath = Join-Path $env:GITHUB_WORKSPACE 'artifacts/modules' - if (-not (Test-Path -LiteralPath $modulesPath)) { - throw "Staged modules path not found: $modulesPath" - } - - # Ensure required modules are discoverable during Test-ModuleManifest/Publish-Module. - $pathSeparator = [System.IO.Path]::PathSeparator - $modulePathEntries = $env:PSModulePath -split [regex]::Escape($pathSeparator) - if ($modulePathEntries -notcontains $modulesPath) { - $env:PSModulePath = $modulesPath + $pathSeparator + $env:PSModulePath + $packagePath = Join-Path $env:GITHUB_WORKSPACE 'artifacts/IdLE' + $manifest = Join-Path $packagePath 'IdLE.psd1' + if (-not (Test-Path -LiteralPath $manifest)) { + throw "Staged package manifest not found: $manifest" } - # Load publish order from configuration - $configPath = Join-Path $env:GITHUB_WORKSPACE 'tools/ModulePublishOrder.psd1' - $config = Import-PowerShellDataFile -LiteralPath $configPath - $publishOrder = $config.PublishOrder - - Write-Host "Publishing modules to PowerShell Gallery in dependency order..." - Write-Host "==================================================================`n" - - foreach ($moduleName in $publishOrder) { - $modulePath = Join-Path $modulesPath $moduleName - if (-not (Test-Path -LiteralPath $modulePath)) { - throw "Module listed in ModulePublishOrder.psd1 not found: $moduleName at $modulePath. This indicates an incomplete build and must be fixed before publishing to PSGallery." - } - - $manifest = Join-Path $modulePath "$moduleName.psd1" - if (-not (Test-Path -LiteralPath $manifest)) { - throw "Module manifest not found: $manifest" - } - - $data = Import-PowerShellDataFile -LiteralPath $manifest - Write-Host "Publishing: $moduleName Version: $($data.ModuleVersion)" - - try { - Publish-Module -Path $modulePath -NuGetApiKey $env:PSGALLERY_API_KEY -Repository PSGallery -ErrorAction Stop - Write-Host " ✓ Successfully published $moduleName`n" - - # Brief delay to allow PSGallery to process the module before publishing dependents - Start-Sleep -Seconds 30 - } - catch { - Write-Error "Failed to publish $moduleName : $_" - throw - } - } + $data = Import-PowerShellDataFile -LiteralPath $manifest + Write-Host "Publishing: IdLE Version: $($data.ModuleVersion)" - Write-Host "==================================================================`n" - Write-Host "All modules published successfully!" + Publish-Module -Path $packagePath -NuGetApiKey $env:PSGALLERY_API_KEY -Repository PSGallery -ErrorAction Stop + Write-Host " ✓ Successfully published IdLE" diff --git a/tests/Packaging/New-IdleModulePackage.Tests.ps1 b/tests/Packaging/New-IdleModulePackage.Tests.ps1 new file mode 100644 index 00000000..305982fb --- /dev/null +++ b/tests/Packaging/New-IdleModulePackage.Tests.ps1 @@ -0,0 +1,86 @@ +Set-StrictMode -Version Latest + +BeforeAll { + . (Join-Path (Split-Path -Path $PSScriptRoot -Parent) '_testHelpers.ps1') + + $script:RepoRoot = Get-RepoRootPath + $script:PackageScript = Join-Path -Path $script:RepoRoot -ChildPath 'tools/New-IdleModulePackage.ps1' + $script:SourceManifest = Join-Path -Path $script:RepoRoot -ChildPath 'src/IdLE/IdLE.psd1' + + $script:BundledNames = @( + (Import-PowerShellDataFile -Path $script:SourceManifest).NestedModules | + ForEach-Object { [System.IO.Path]::GetFileNameWithoutExtension($_) } + ) + + $script:PackageRoot = Join-Path -Path $TestDrive -ChildPath 'IdLE' + $script:Package = & $script:PackageScript -OutputDirectory $script:PackageRoot -Clean + $script:PackageManifest = Join-Path -Path $script:PackageRoot -ChildPath 'IdLE.psd1' +} + +Describe 'New-IdleModulePackage (bundled IdLE package)' { + Context 'Layout' { + It 'Returns the package directory' { + $script:Package.FullName | Should -Be (Get-Item -LiteralPath $script:PackageRoot).FullName + } + + It 'Bundles all first-party modules under Modules/' { + $script:BundledNames | Should -Contain 'IdLE.Core' + $script:BundledNames | Should -Contain 'IdLE.Provider.AD' + + foreach ($name in $script:BundledNames) { + Join-Path -Path $script:PackageRoot -ChildPath "Modules/$name/$name.psd1" | Should -Exist + } + } + + It 'Rewrites NestedModules to the in-package module paths' { + $nested = @((Import-PowerShellDataFile -Path $script:PackageManifest).NestedModules) + + $nested | Should -Be @($script:BundledNames | ForEach-Object { ".\Modules\$_\$_.psd1" }) + } + + It 'Produces a valid module manifest' { + { Test-ModuleManifest -Path $script:PackageManifest -ErrorAction Stop } | Should -Not -Throw + } + } + + Context 'Import' { + It 'Imports all bundled modules from the package and exports the provider factories' { + $manifestEscaped = $script:PackageManifest -replace "'", "''" + $script = @" +`$before = @(Get-Module -All | ForEach-Object Name) +Import-Module '$manifestEscaped' -ErrorAction Stop +`$idle = Get-Module -Name IdLE +[pscustomobject]@{ + ModuleBase = `$idle.ModuleBase + Exported = @(`$idle.ExportedCommands.Keys | Sort-Object) + Nested = @(Get-Module -All -Name 'IdLE.*' | ForEach-Object { [pscustomobject]@{ Name = `$_.Name; ModuleBase = `$_.ModuleBase } }) + # Modules from `$PSHOME (e.g. Microsoft.PowerShell.Utility) are auto-loaded built-ins, not dependencies. + External = @(Get-Module -All | Where-Object { `$before -notcontains `$_.Name -and `$_.Name -notlike 'IdLE*' -and -not `$_.ModuleBase.StartsWith(`$PSHOME) } | ForEach-Object Name) +} | ConvertTo-Json -Depth 4 -Compress +"@ + + $result = Invoke-IdleIsolatedPwsh -Script $script -WorkingDirectory $TestDrive + $result.ExitCode | Should -Be 0 -Because $result.StdErr + + $info = $result.StdOut | ConvertFrom-Json + + foreach ($name in $script:BundledNames) { + $module = @($info.Nested | Where-Object Name -eq $name) | Select-Object -First 1 + $module | Should -Not -BeNullOrEmpty -Because "$name is part of the bundle" + $module.ModuleBase | Should -Be ([System.IO.Path]::Combine($info.ModuleBase, 'Modules', $name)) + } + + foreach ($factory in @( + 'New-IdleADIdentityProvider' + 'New-IdleEntraIDIdentityProvider' + 'New-IdleExchangeOnlineProvider' + 'New-IdleEntraConnectDirectorySyncProvider' + 'New-IdleMockIdentityProvider' + )) { + $info.Exported | Should -Contain $factory + } + + @($info.External) | Should -BeNullOrEmpty -Because 'external dependencies must be loaded lazily' + } + } +} diff --git a/tools/Generate-IdleStepReference.ps1 b/tools/Generate-IdleStepReference.ps1 index 3a1b1b56..766e3ab8 100644 --- a/tools/Generate-IdleStepReference.ps1 +++ b/tools/Generate-IdleStepReference.ps1 @@ -829,7 +829,7 @@ if (-not $StepModules -or $StepModules.Count -eq 0) { } } -# Ensure step modules are loaded (Import-Module IdLE.psd1 does NOT load nested step modules automatically). +# Ensure step modules are loaded globally (IdLE.psd1 loads them as nested modules, which are not visible via Get-Module without -All). # Always prefer repo-local modules to avoid importing different versions from PSModulePath. foreach ($m in $StepModules) { if (Get-Module -Name $m) { diff --git a/tools/ModulePublishOrder.psd1 b/tools/ModulePublishOrder.psd1 deleted file mode 100644 index 229dcc75..00000000 --- a/tools/ModulePublishOrder.psd1 +++ /dev/null @@ -1,26 +0,0 @@ -# Module Publishing Order Configuration -# -# This file defines the order in which IdLE modules should be published to PSGallery. -# The order is critical to ensure dependencies are available before dependent modules. -# -# Dependency order: -# 1. IdLE.Core - Foundation module, no IdLE dependencies -# 2. IdLE.Steps.Common - Requires IdLE.Core -# 3. IdLE - Meta-module, requires Core + Steps.Common -# 4. All other modules - Providers and additional step modules - -@{ - # Modules to publish in dependency order - PublishOrder = @( - 'IdLE.Core' - 'IdLE.Steps.Common' - 'IdLE' - 'IdLE.Steps.DirectorySync' - 'IdLE.Steps.Mailbox' - 'IdLE.Provider.AD' - 'IdLE.Provider.EntraID' - 'IdLE.Provider.ExchangeOnline' - 'IdLE.Provider.DirectorySync.EntraConnect' - 'IdLE.Provider.Mock' - ) -} diff --git a/tools/New-IdleModulePackage.ps1 b/tools/New-IdleModulePackage.ps1 index cb2009f1..4f48439a 100644 --- a/tools/New-IdleModulePackage.ps1 +++ b/tools/New-IdleModulePackage.ps1 @@ -1,62 +1,39 @@ <# .SYNOPSIS -Creates IdLE module package(s) suitable for publishing or distribution. +Creates the bundled IdLE module package suitable for publishing or distribution. .DESCRIPTION -Supports two packaging modes: +Creates a single self-contained 'IdLE' package. All first-party modules are staged as nested +modules under 'Modules//' and are imported together with IdLE. -1. Bundled (default): Creates a single self-contained IdLE package with nested modules under 'Modules/'. - This is the legacy format for backwards compatibility. - -2. MultiModule: Creates separate packages for each module, suitable for publishing each module - independently to PowerShell Gallery. Transforms IdLE manifest (NestedModules → RequiredModules, - removes ScriptsToProcess). - -.PARAMETER Mode -Packaging mode: 'Bundled' (default, legacy single package) or 'MultiModule' (separate packages per module). +The bundle content is defined by the NestedModules entries of 'src/IdLE/IdLE.psd1' +(single source of truth). In the source manifest these entries point to the sibling module +folders under 'src/' ('..\\.psd1'); in the staged manifest they are rewritten to +'.\Modules\\.psd1'. .PARAMETER RepoRootPath Repository root path. Defaults to the parent folder of this script directory. .PARAMETER OutputDirectory -Target folder for package(s). -- Bundled mode: Defaults to '/artifacts/IdLE' -- MultiModule mode: Defaults to '/artifacts/modules' (one subdirectory per module) - -.PARAMETER ModuleNames -(MultiModule mode only) Names of modules to package. Defaults to all IdLE modules under src/. - -.PARAMETER NestedModuleNames -(Bundled mode only) Names of nested modules to auto-import when IdLE is imported. - -.PARAMETER IncludeModuleNames -(Bundled mode only) Names of all modules to include in the package under 'Modules/'. +Target folder for the package. Defaults to '/artifacts/IdLE'. .PARAMETER Clean If set, deletes the OutputDirectory before staging the package. .OUTPUTS -System.IO.DirectoryInfo or System.IO.DirectoryInfo[] +System.IO.DirectoryInfo .EXAMPLE -# Legacy bundled package -pwsh -NoProfile -File ./tools/New-IdleModulePackage.ps1 +# Bundled package for PSGallery publishing +pwsh -NoProfile -File ./tools/New-IdleModulePackage.ps1 -Clean .EXAMPLE -# Multi-module packages for PSGallery -pwsh -NoProfile -File ./tools/New-IdleModulePackage.ps1 -Mode MultiModule -Clean - -.EXAMPLE -# Package specific modules only -pwsh -NoProfile -File ./tools/New-IdleModulePackage.ps1 -Mode MultiModule -ModuleNames 'IdLE','IdLE.Core' +# Stage the package to a custom folder +pwsh -NoProfile -File ./tools/New-IdleModulePackage.ps1 -OutputDirectory ./out/IdLE -Clean #> [CmdletBinding()] param( - [Parameter()] - [ValidateSet('Bundled', 'MultiModule')] - [string] $Mode = 'Bundled', - [Parameter()] [ValidateNotNullOrEmpty()] [string] $RepoRootPath = (Resolve-Path -Path (Join-Path -Path $PSScriptRoot -ChildPath '..')).Path, @@ -65,19 +42,6 @@ param( [ValidateNotNullOrEmpty()] [string] $OutputDirectory, - [Parameter()] - [string[]] $ModuleNames = $null, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [string[]] $NestedModuleNames = @( - 'IdLE.Core', - 'IdLE.Steps.Common' - ), - - [Parameter()] - [string[]] $IncludeModuleNames = $null, - [Parameter()] [switch] $Clean ) @@ -141,310 +105,88 @@ function Copy-IdleModuleFolder { Copy-Item -Path (Join-Path -Path $SourcePath -ChildPath '*') -Destination $DestinationPath -Recurse -Force } -function Get-IdleNestedModuleEntryPaths { - [CmdletBinding()] - param( - [Parameter(Mandatory)] - [string[]] $Names - ) - - $paths = foreach ($n in $Names) { - # NestedModules should reference the nested module manifests relative to the *IdLE* manifest folder. - ".\Modules\$n\$n.psd1" - } - - return , $paths -} - -function Set-IdleNestedModulesInManifest { +function Get-IdleBundledModuleNames { [CmdletBinding()] param( [Parameter(Mandatory)] - [string] $ManifestPath, - - [Parameter(Mandatory)] - [string[]] $NestedModuleEntryPaths + [string] $ManifestPath ) - if (-not (Test-Path -LiteralPath $ManifestPath)) { - throw "Manifest not found: $ManifestPath" - } - - $raw = Get-Content -LiteralPath $ManifestPath -Raw -ErrorAction Stop - - $indent = ' ' - $entries = ($NestedModuleEntryPaths | ForEach-Object { "$indent$indent'$_'" }) -join ",`n" - - $replacement = @" -${indent}NestedModules = @( -$entries -${indent}) -"@ + $manifest = Import-PowerShellDataFile -LiteralPath $ManifestPath - # Replace an existing NestedModules block. - # This intentionally keeps the rest of the manifest formatting intact. - $pattern = '(?ms)^[ \t]*NestedModules[ \t]*=[ \t]*@\((?:.|\n)*?\)[ \t]*\r?\n' - if ($raw -match $pattern) { - $updated = [regex]::Replace($raw, $pattern, "$replacement`r`n", 1) - } - else { - # If NestedModules is missing, insert it after RootModule (or near the top). - $insertAfter = '(?m)^[ \t]*RootModule[ \t]*=.*\r?\n' - if ($raw -match $insertAfter) { - $updated = [regex]::Replace($raw, $insertAfter, '$0' + "$replacement`r`n", 1) - } - else { - $updated = "$replacement`r`n$raw" + $names = foreach ($entry in @($manifest.NestedModules)) { + # Source entries must reference sibling module folders: '..\\.psd1' + if ([string]$entry -notmatch '^\.\.\\(?[^\\]+)\\(?[^\\]+)\.psd1$' -or $Matches.Name -ne $Matches.File) { + throw "Unexpected NestedModules entry in '$ManifestPath': '$entry'. Expected '..\\.psd1'." } - } - - Set-Content -LiteralPath $ManifestPath -Value $updated -Encoding UTF8 -NoNewline -} - -#region MultiModule Mode Functions -function Get-IdleModuleFolders { - [CmdletBinding()] - param( - [Parameter(Mandatory)] - [string] $SrcPath - ) + $Matches.Name + } - $modules = Get-ChildItem -Path $SrcPath -Directory | Where-Object { - $manifestPath = Join-Path -Path $_.FullName -ChildPath "$($_.Name).psd1" - Test-Path -LiteralPath $manifestPath + if (@($names).Count -eq 0) { + throw "No NestedModules found in '$ManifestPath'. The bundle content is defined by this list." } - return $modules + return , @($names) } -function Convert-IdleManifestForPublication { +function Set-IdleBundledNestedModulesInManifest { [CmdletBinding()] param( [Parameter(Mandatory)] [string] $ManifestPath, [Parameter(Mandatory)] - [string] $ModuleName + [string[]] $ModuleNames ) - if (-not (Test-Path -LiteralPath $ManifestPath)) { - throw "Manifest not found: $ManifestPath" - } - - Write-Host " Converting manifest for publication..." - $raw = Get-Content -LiteralPath $ManifestPath -Raw -ErrorAction Stop - # IdLE meta-module transformations - if ($ModuleName -eq 'IdLE') { - # Extract current NestedModules to convert to RequiredModules - # Entries look like: '..\IdLE.Core\IdLE.Core.psd1' - # We want to extract: 'IdLE.Core' - $requiredModules = @() - - # Pattern: match ..\ followed by module name followed by \ again - if ($raw -match '\.\.\\(IdLE\.[^\\]+)\\') { - # Extract all unique module names - $allMatches = [regex]::Matches($raw, '\.\.\\(IdLE\.([^\\]+))\\') - foreach ($match in $allMatches) { - $requiredModuleName = $match.Groups[1].Value # Group 1 is the full IdLE.ModuleName - if ($requiredModules -notcontains $requiredModuleName) { - $requiredModules += $requiredModuleName - } - } - } - - if ($requiredModules.Count -gt 0) { - # Build RequiredModules block - $indent = ' ' - $entries = ($requiredModules | ForEach-Object { "$indent$indent'$_'" }) -join ",`n" - $requiredModulesBlock = @" -${indent}RequiredModules = @( -$entries -${indent}) -"@ - - # Replace NestedModules with RequiredModules - $raw = [regex]::Replace($raw, '(?ms)^[ \t]*NestedModules[ \t]*=[ \t]*@\((?:.|\n)*?\)[ \t]*\r?\n', "$requiredModulesBlock`n", 1) - Write-Host " - Converted NestedModules to RequiredModules: $($requiredModules -join ', ')" - } - - # Remove ScriptsToProcess (not needed when modules are in standard PSModulePath) - $scriptsPattern = '(?ms)^[ \t]*ScriptsToProcess[ \t]*=[ \t]*@\([^\)]*\)[ \t]*\r?\n' - if ($raw -match $scriptsPattern) { - $raw = [regex]::Replace($raw, $scriptsPattern, '', 1) - Write-Host " - Removed ScriptsToProcess" + # Rewrite each entry in place to keep the rest of the manifest formatting intact. + foreach ($name in $ModuleNames) { + $escaped = [regex]::Escape($name) + $pattern = "'\.\.\\$escaped\\$escaped\.psd1'" + if ($raw -notmatch $pattern) { + throw "NestedModules entry for '$name' not found in staged manifest: $ManifestPath" } - # Remove Init.ps1 file from package since it's not needed for published modules - $initPath = Join-Path -Path (Split-Path -Path $ManifestPath -Parent) -ChildPath 'IdLE.Init.ps1' - if (Test-Path -LiteralPath $initPath) { - Remove-Item -LiteralPath $initPath -Force - Write-Host " - Removed IdLE.Init.ps1" - } + $raw = [regex]::Replace($raw, $pattern, "'.\Modules\$name\$name.psd1'") } - # Save modified manifest Set-Content -LiteralPath $ManifestPath -Value $raw -Encoding UTF8 -NoNewline } -function New-IdleMultiModulePackages { - [CmdletBinding()] - param( - [Parameter(Mandatory)] - [string] $RepoRootPath, - - [Parameter(Mandatory)] - [string] $OutputDirectory, - - [Parameter()] - [string[]] $ModuleNames, - - [Parameter()] - [switch] $Clean - ) - - $srcRoot = Join-Path -Path $RepoRootPath -ChildPath 'src' - - Write-Host "Multi-Module Packaging for PSGallery Publication" - Write-Host "==================================================" - Write-Host "Repository Root: $RepoRootPath" - Write-Host "Output Directory: $OutputDirectory" - Write-Host "" - - # Determine modules to package - if ($null -eq $ModuleNames -or $ModuleNames.Count -eq 0) { - $moduleFolders = Get-IdleModuleFolders -SrcPath $srcRoot - $ModuleNames = $moduleFolders.Name - Write-Host "Auto-discovered modules: $($ModuleNames -join ', ')" - } - else { - Write-Host "Packaging specified modules: $($ModuleNames -join ', ')" - } - - Write-Host "" - - # Initialize output directory - Initialize-IdleDirectory -Path $OutputDirectory -ForceClean:$Clean - - # Package each module - $packagedModules = @() - - foreach ($moduleName in $ModuleNames) { - Write-Host "Packaging: $moduleName" - Write-Host "---" - - $moduleSrc = Join-Path -Path $srcRoot -ChildPath $moduleName - $moduleDst = Join-Path -Path $OutputDirectory -ChildPath $moduleName - - if (-not (Test-Path -LiteralPath $moduleSrc)) { - # If ModuleNames was explicitly provided, fail fast (user error / CI validation) - # If auto-discovered, warn and skip (allows partial builds during development) - if ($PSBoundParameters.ContainsKey('ModuleNames')) { - throw "Module source not found: $moduleSrc (explicitly requested via -ModuleNames)" - } - Write-Warning " Module source not found, skipping: $moduleSrc" - continue - } - - # Copy module to output - Write-Host " Copying module content..." - Copy-IdleModuleFolder -SourcePath $moduleSrc -DestinationPath $moduleDst - - # Transform manifest for publication - $manifestPath = Join-Path -Path $moduleDst -ChildPath "$moduleName.psd1" - Convert-IdleManifestForPublication -ManifestPath $manifestPath -ModuleName $moduleName - - Write-Host " ✓ Manifest transformed for publication" - - $packagedModules += Get-Item -LiteralPath $moduleDst - Write-Host "" - } - - Write-Host "==================================================" - Write-Host "Successfully packaged $($packagedModules.Count) module(s)" - Write-Host "Output location: $OutputDirectory" - Write-Host "" - - return $packagedModules -} - -#endregion - -#region Main Execution Logic - # Resolve repository root $RepoRootPath = Resolve-IdleRepoRoot -Path $RepoRootPath -# Set default output directory based on mode if (-not $PSBoundParameters.ContainsKey('OutputDirectory')) { - if ($Mode -eq 'MultiModule') { - $OutputDirectory = Join-Path -Path $RepoRootPath -ChildPath 'artifacts/modules' - } - else { - $OutputDirectory = Join-Path -Path $RepoRootPath -ChildPath 'artifacts/IdLE' - } -} - -# Execute appropriate packaging mode -if ($Mode -eq 'MultiModule') { - # Multi-module packaging for PSGallery - $result = New-IdleMultiModulePackages ` - -RepoRootPath $RepoRootPath ` - -OutputDirectory $OutputDirectory ` - -ModuleNames $ModuleNames ` - -Clean:$Clean - - return $result + $OutputDirectory = Join-Path -Path $RepoRootPath -ChildPath 'artifacts/IdLE' } -else { - # Bundled packaging (legacy) - - # Default IncludeModuleNames to all batteries-included modules if not specified - if ($null -eq $IncludeModuleNames -or $IncludeModuleNames.Count -eq 0) { - # Load module list from publish order configuration (required - single source of truth) - $publishOrderPath = Join-Path -Path $PSScriptRoot -ChildPath 'ModulePublishOrder.psd1' - if (-not (Test-Path $publishOrderPath)) { - throw @" -ModulePublishOrder.psd1 not found at '$publishOrderPath'. -This file is required as the single source of truth for module packaging order. -Expected location: tools/ModulePublishOrder.psd1 (relative to repository root) -See docs/develop/releases.md for more information. -"@ - } - - $publishOrderConfig = Import-PowerShellDataFile -Path $publishOrderPath - # Use all modules except IdLE itself (meta-module is the package root, not nested) - $IncludeModuleNames = $publishOrderConfig.PublishOrder | Where-Object { $_ -ne 'IdLE' } - } - $srcRoot = Join-Path -Path $RepoRootPath -ChildPath 'src' - $idleSrc = Join-Path -Path $srcRoot -ChildPath 'IdLE' - $idleDst = $OutputDirectory - $modulesDst = Join-Path -Path $idleDst -ChildPath 'Modules' +$srcRoot = Join-Path -Path $RepoRootPath -ChildPath 'src' +$idleSrc = Join-Path -Path $srcRoot -ChildPath 'IdLE' +$idleDst = $OutputDirectory +$modulesDst = Join-Path -Path $idleDst -ChildPath 'Modules' - Initialize-IdleDirectory -Path $idleDst -ForceClean:$Clean +$moduleNames = Get-IdleBundledModuleNames -ManifestPath (Join-Path -Path $idleSrc -ChildPath 'IdLE.psd1') - # 1) Stage meta-module IdLE (top-level package root) - Copy-IdleModuleFolder -SourcePath $idleSrc -DestinationPath $idleDst +Initialize-IdleDirectory -Path $idleDst -ForceClean:$Clean - # 2) Stage nested modules into IdLE/Modules// - Initialize-IdleDirectory -Path $modulesDst +# 1) Stage IdLE (package root) +Copy-IdleModuleFolder -SourcePath $idleSrc -DestinationPath $idleDst - foreach ($name in $IncludeModuleNames) { - $nestedSrc = Join-Path -Path $srcRoot -ChildPath $name - $nestedDst = Join-Path -Path $modulesDst -ChildPath $name +# 2) Stage bundled modules into IdLE/Modules// +Initialize-IdleDirectory -Path $modulesDst - Copy-IdleModuleFolder -SourcePath $nestedSrc -DestinationPath $nestedDst - } +foreach ($name in $moduleNames) { + $nestedSrc = Join-Path -Path $srcRoot -ChildPath $name + $nestedDst = Join-Path -Path $modulesDst -ChildPath $name - # 3) Patch staged manifest to reference in-package nested module manifests (auto-imported) - $stagedManifest = Join-Path -Path $idleDst -ChildPath 'IdLE.psd1' - $nestedEntries = Get-IdleNestedModuleEntryPaths -Names $NestedModuleNames - Set-IdleNestedModulesInManifest -ManifestPath $stagedManifest -NestedModuleEntryPaths $nestedEntries - - return Get-Item -LiteralPath $idleDst + Copy-IdleModuleFolder -SourcePath $nestedSrc -DestinationPath $nestedDst } -#endregion +# 3) Patch staged manifest to reference the in-package nested module manifests +$stagedManifest = Join-Path -Path $idleDst -ChildPath 'IdLE.psd1' +Set-IdleBundledNestedModulesInManifest -ManifestPath $stagedManifest -ModuleNames $moduleNames + +return Get-Item -LiteralPath $idleDst From 41d837f05c447bbd7dfd1d233417f2213ff25054 Mon Sep 17 00:00:00 2001 From: Matthias Fleschuetz <13959569+blindzero@users.noreply.github.com> Date: Sat, 31 Oct 2026 18:21:54 +0100 Subject: [PATCH 3/7] docs(reference): fix help examples and regenerate cmdlet reference - Export-IdlePlan examples used non-existing New-IdlePlan parameters (-Workflow, -StepRegistry). - Remove blank lines inside provider factory example code; platyPS treated the rest as remarks and parsed '#' comments as headings. - Regenerate the cmdlet reference, now including the provider factories exported from IdLE. Refs #321 Co-Authored-By: Claude Opus 5.5 --- docs/reference/cmdlets.md | 5 + docs/reference/cmdlets/Export-IdlePlan.md | 6 +- .../cmdlets/New-IdleADIdentityProvider.md | 259 ++++++++++++++++++ ...w-IdleEntraConnectDirectorySyncProvider.md | 74 +++++ .../New-IdleEntraIDIdentityProvider.md | 158 +++++++++++ .../cmdlets/New-IdleExchangeOnlineProvider.md | 124 +++++++++ .../cmdlets/New-IdleMockIdentityProvider.md | 98 +++++++ .../Public/New-IdleADIdentityProvider.ps1 | 4 - .../New-IdleEntraIDIdentityProvider.ps1 | 4 - .../Public/New-IdleExchangeOnlineProvider.ps1 | 2 - src/IdLE/Public/Export-IdlePlan.ps1 | 6 +- 11 files changed, 724 insertions(+), 16 deletions(-) create mode 100644 docs/reference/cmdlets/New-IdleADIdentityProvider.md create mode 100644 docs/reference/cmdlets/New-IdleEntraConnectDirectorySyncProvider.md create mode 100644 docs/reference/cmdlets/New-IdleEntraIDIdentityProvider.md create mode 100644 docs/reference/cmdlets/New-IdleExchangeOnlineProvider.md create mode 100644 docs/reference/cmdlets/New-IdleMockIdentityProvider.md diff --git a/docs/reference/cmdlets.md b/docs/reference/cmdlets.md index c2fe08ba..27f2a09d 100644 --- a/docs/reference/cmdlets.md +++ b/docs/reference/cmdlets.md @@ -9,7 +9,12 @@ This page links the generated per-cmdlet reference pages and includes their syno | --- | --- | | [Export-IdlePlan](cmdlets/Export-IdlePlan.md) | Exports an IdLE LifecyclePlan as a canonical JSON artifact. | | [Invoke-IdlePlan](cmdlets/Invoke-IdlePlan.md) | Executes an IdLE plan. | +| [New-IdleADIdentityProvider](cmdlets/New-IdleADIdentityProvider.md) | Creates an Active Directory identity provider for IdLE. | | [New-IdleAuthSession](cmdlets/New-IdleAuthSession.md) | Creates a simple AuthSessionBroker for use with IdLE providers. | +| [New-IdleEntraConnectDirectorySyncProvider](cmdlets/New-IdleEntraConnectDirectorySyncProvider.md) | Creates an Entra Connect directory sync provider for IdLE. | +| [New-IdleEntraIDIdentityProvider](cmdlets/New-IdleEntraIDIdentityProvider.md) | Creates a Microsoft Entra ID identity provider for IdLE. | +| [New-IdleExchangeOnlineProvider](cmdlets/New-IdleExchangeOnlineProvider.md) | Creates an Exchange Online mailbox provider for IdLE. | +| [New-IdleMockIdentityProvider](cmdlets/New-IdleMockIdentityProvider.md) | Creates an in-memory identity provider for tests and demos. | | [New-IdlePlan](cmdlets/New-IdlePlan.md) | Creates a deterministic plan from a lifecycle request and a workflow definition. | | [New-IdleRequest](cmdlets/New-IdleRequest.md) | Creates a lifecycle request object. | | [Test-IdleWorkflow](cmdlets/Test-IdleWorkflow.md) | Validates an IdLE workflow definition file. | diff --git a/docs/reference/cmdlets/Export-IdlePlan.md b/docs/reference/cmdlets/Export-IdlePlan.md index 66f61d7e..fbcee369 100644 --- a/docs/reference/cmdlets/Export-IdlePlan.md +++ b/docs/reference/cmdlets/Export-IdlePlan.md @@ -33,7 +33,7 @@ string when writing a file. ### EXAMPLE 1 ``` -$plan = New-IdlePlan -Request $request -Workflow $workflow -StepRegistry $registry +$plan = New-IdlePlan -WorkflowPath ./joiner.psd1 -Request $request -Providers $providers $plan | Export-IdlePlan ``` @@ -41,7 +41,7 @@ Exports the plan and returns the JSON string. ### EXAMPLE 2 ``` -New-IdlePlan -Request $request -Workflow $workflow -StepRegistry $registry | +New-IdlePlan -WorkflowPath ./joiner.psd1 -Request $request -Providers $providers | Export-IdlePlan -Path ./artifacts/plan.json ``` @@ -49,7 +49,7 @@ Exports the plan and writes the JSON to a file. ### EXAMPLE 3 ``` -New-IdlePlan -Request $request -Workflow $workflow -StepRegistry $registry | +New-IdlePlan -WorkflowPath ./joiner.psd1 -Request $request -Providers $providers | Export-IdlePlan -Path ./artifacts/plan.json -PassThru ``` diff --git a/docs/reference/cmdlets/New-IdleADIdentityProvider.md b/docs/reference/cmdlets/New-IdleADIdentityProvider.md new file mode 100644 index 00000000..e6bb561c --- /dev/null +++ b/docs/reference/cmdlets/New-IdleADIdentityProvider.md @@ -0,0 +1,259 @@ +--- +external help file: IdLE-help.xml +Module Name: IdLE +online version: +schema: 2.0.0 +--- + +# New-IdleADIdentityProvider + +## SYNOPSIS +Creates an Active Directory identity provider for IdLE. + +## SYNTAX + +``` +New-IdleADIdentityProvider [-AllowDelete] [[-PasswordGenerationFallbackMinLength] <Int32>] + [[-PasswordGenerationRequireUpper] <Boolean>] [[-PasswordGenerationRequireLower] <Boolean>] + [[-PasswordGenerationRequireDigit] <Boolean>] [[-PasswordGenerationRequireSpecial] <Boolean>] + [[-PasswordGenerationSpecialCharSet] <String>] [[-Adapter] <Object>] [-ProgressAction <ActionPreference>] + [<CommonParameters>] +``` + +## DESCRIPTION +This provider integrates with on-premises Active Directory environments. +It requires the ActiveDirectory PowerShell module (RSAT) and runs on Windows only. + +The provider supports common identity operations (Create, Read, Disable, Enable, Move, Delete) +and group entitlement management (List, Grant, Revoke). + +Identity addressing supports: +- GUID (ObjectGuid) - pattern: ^\[0-9a-fA-F-\]{36}$ or N-format +- UPN (UserPrincipalName) - contains @ +- sAMAccountName - default fallback + +Authentication: +Provider methods accept an optional AuthSession parameter for runtime credential +selection via the AuthSessionBroker. +This enables multi-role scenarios (e.g., +Tier0 vs. +Admin) without embedding credentials in the provider or workflow. + +By default, the provider uses integrated authentication (run-as credentials). +For runtime credential selection, configure an AuthSessionBroker and use +With.AuthSessionName and With.AuthSessionOptions in step definitions. + +## EXAMPLES + +### EXAMPLE 1 +``` +# Use integrated authentication (run-as) +$provider = New-IdleADIdentityProvider +$plan = New-IdlePlan -WorkflowPath './workflow.psd1' -Request $request -Providers @{ + Identity = $provider +} +``` + +### EXAMPLE 2 +``` +# Custom password generation fallback configuration +$provider = New-IdleADIdentityProvider -PasswordGenerationFallbackMinLength 32 -PasswordGenerationSpecialCharSet '!@#$%^&*()' +$plan = New-IdlePlan -WorkflowPath './workflow.psd1' -Request $request -Providers @{ + Identity = $provider +} +``` + +### EXAMPLE 3 +``` +# Multi-role scenario with New-IdleAuthSessionBroker (recommended) +$tier0Credential = Get-Credential -Message "Enter Tier0 admin credentials" +$adminCredential = Get-Credential -Message "Enter regular admin credentials" +$authSessionBroker = New-IdleAuthSessionBroker -SessionMap @{ + @{ Role = 'Tier0' } = $tier0Credential + @{ Role = 'Admin' } = $adminCredential +} -DefaultCredential $adminCredential +$provider = New-IdleADIdentityProvider +$plan = New-IdlePlan -WorkflowPath './workflow.psd1' -Request $request -Providers @{ + Identity = $provider + AuthSessionBroker = $authSessionBroker +} +# Workflow steps can specify different auth contexts: +# With.AuthSessionName = 'ActiveDirectory' +# With.AuthSessionOptions = @{ Role = 'Tier0' } +``` + +### EXAMPLE 4 +``` +# Custom broker for advanced scenarios (vault integration, MFA) +$authSessionBroker = [pscustomobject]@{} +$authSessionBroker | Add-Member -MemberType ScriptMethod -Name AcquireAuthSession -Value { + param($Name, $Options) + if ($Options.Role -eq 'Tier0') { + return Get-SecretFromVault -Name 'AD-Tier0' + } + return Get-SecretFromVault -Name 'AD-Admin' +} +$provider = New-IdleADIdentityProvider +$plan = New-IdlePlan -WorkflowPath './workflow.psd1' -Request $request -Providers @{ + Identity = $provider + AuthSessionBroker = $authSessionBroker +} +``` + +## PARAMETERS + +### -AllowDelete +Opt-in flag to enable the IdLE.Identity.Delete capability. +When $true, the provider advertises the Delete capability and allows identity deletion. +Default is $false for safety. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PasswordGenerationFallbackMinLength +Fallback minimum password length when domain policy cannot be read. +Default is 24. + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: 1 +Default value: 24 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PasswordGenerationRequireUpper +Fallback requirement for uppercase characters in generated passwords. +Default is $true. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: True +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PasswordGenerationRequireLower +Fallback requirement for lowercase characters in generated passwords. +Default is $true. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: True +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PasswordGenerationRequireDigit +Fallback requirement for digit characters in generated passwords. +Default is $true. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: 4 +Default value: True +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PasswordGenerationRequireSpecial +Fallback requirement for special characters in generated passwords. +Default is $true. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: 5 +Default value: True +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PasswordGenerationSpecialCharSet +Set of special characters to use in generated passwords. +Default is '!@#$%&*+-_=?'. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 6 +Default value: !@#$%&*+-_=? +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Adapter +Internal parameter for dependency injection during testing. +Allows unit tests to inject +a fake AD adapter without requiring a real Active Directory environment. + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: False +Position: 7 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProgressAction +TODO: ProgressAction Description + +```yaml +Type: ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS diff --git a/docs/reference/cmdlets/New-IdleEntraConnectDirectorySyncProvider.md b/docs/reference/cmdlets/New-IdleEntraConnectDirectorySyncProvider.md new file mode 100644 index 00000000..a808d084 --- /dev/null +++ b/docs/reference/cmdlets/New-IdleEntraConnectDirectorySyncProvider.md @@ -0,0 +1,74 @@ +--- +external help file: IdLE-help.xml +Module Name: IdLE +online version: +schema: 2.0.0 +--- + +# New-IdleEntraConnectDirectorySyncProvider + +## SYNOPSIS +Creates an Entra Connect directory sync provider for IdLE. + +## SYNTAX + +``` +New-IdleEntraConnectDirectorySyncProvider [-ProgressAction <ActionPreference>] [<CommonParameters>] +``` + +## DESCRIPTION +This provider triggers and monitors Entra ID Connect (ADSync) sync cycles on an +on-premises server via remote execution. + +The provider uses a credential AuthSession provided by the host and establishes +a PSRemoting session to the target Entra Connect server internally. + +No interactive prompts are made; elevation and authentication are the host's responsibility +via the AuthSessionBroker. + +## EXAMPLES + +### EXAMPLE 1 +``` +$provider = New-IdleEntraConnectDirectorySyncProvider +$provider.GetCapabilities() +# Returns: @('IdLE.DirectorySync.Trigger', 'IdLE.DirectorySync.Status') +``` + +### EXAMPLE 2 +``` +# With a credential from AuthSessionBroker (AuthSessionType='Credential') +$credential = Get-Credential +$provider = New-IdleEntraConnectDirectorySyncProvider +$result = $provider.StartSyncCycle('Delta', 'ad-sync1.corp.local', $credential) +``` + +## PARAMETERS + +### -ProgressAction +TODO: ProgressAction Description + +```yaml +Type: ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### PSCustomObject +### Provider instance with methods: GetCapabilities(), StartSyncCycle(PolicyType, ComputerName, AuthSession), GetSyncCycleState(ComputerName, AuthSession) +## NOTES + +## RELATED LINKS diff --git a/docs/reference/cmdlets/New-IdleEntraIDIdentityProvider.md b/docs/reference/cmdlets/New-IdleEntraIDIdentityProvider.md new file mode 100644 index 00000000..0e2d7044 --- /dev/null +++ b/docs/reference/cmdlets/New-IdleEntraIDIdentityProvider.md @@ -0,0 +1,158 @@ +--- +external help file: IdLE-help.xml +Module Name: IdLE +online version: +schema: 2.0.0 +--- + +# New-IdleEntraIDIdentityProvider + +## SYNOPSIS +Creates a Microsoft Entra ID identity provider for IdLE. + +## SYNTAX + +``` +New-IdleEntraIDIdentityProvider [-AllowDelete] [[-Adapter] <Object>] [-ProgressAction <ActionPreference>] + [<CommonParameters>] +``` + +## DESCRIPTION +This provider integrates with Microsoft Entra ID (formerly Azure Active Directory) +via the Microsoft Graph API (v1.0). +It supports both delegated and app-only authentication +via the host-provided AuthSessionBroker pattern. + +The provider supports common identity operations (Create, Read, Disable, Enable, Delete) +and entitlement management for groups and Administrative Units (List, Grant, Revoke). + +Identity addressing supports: +- objectId (GUID string) - most deterministic +- UserPrincipalName (UPN) - contains @ +- mail - email address + +The canonical identity key for all outputs is the user objectId (GUID string). + +Authentication: +Provider methods accept an optional AuthSession parameter for runtime credential +selection via the AuthSessionBroker. +The provider supports multiple auth session formats: +- String access token (Bearer token) +- Object with AccessToken property +- Object with GetAccessToken() method +- PSCredential (must contain AccessToken in password field for Graph API) + +By default, steps should use: +- With.AuthSessionName = 'MicrosoftGraph' +- With.AuthSessionOptions = @{ Role = 'Admin' } (or other routing keys) + +## EXAMPLES + +### EXAMPLE 1 +``` +# Basic usage with delegated auth +# Host obtains token via secure method (not shown here - see provider documentation) +$accessToken = Get-SecureGraphToken +$authSessionBroker = New-IdleAuthSessionBroker -SessionMap @{ + @{} = $accessToken +} -DefaultCredential $accessToken +$provider = New-IdleEntraIDIdentityProvider +$plan = New-IdlePlan -WorkflowPath './workflow.psd1' -Request $request -Providers @{ + Identity = $provider + AuthSessionBroker = $authSessionBroker +} +``` + +### EXAMPLE 2 +``` +# Multi-role scenario +$tier0Token = Get-GraphTokenForTier0 # host-managed auth +$adminToken = Get-GraphTokenForAdmin +$authSessionBroker = New-IdleAuthSessionBroker -SessionMap @{ + @{ Role = 'Tier0' } = $tier0Token + @{ Role = 'Admin' } = $adminToken +} -DefaultCredential $adminToken +$provider = New-IdleEntraIDIdentityProvider +$plan = New-IdlePlan -WorkflowPath './workflow.psd1' -Request $request -Providers @{ + Identity = $provider + AuthSessionBroker = $authSessionBroker +} +# Workflow steps specify: With.AuthSessionOptions = @{ Role = 'Tier0' } +``` + +### EXAMPLE 3 +``` +# Enable delete capability (opt-in) +$provider = New-IdleEntraIDIdentityProvider -AllowDelete +``` + +## PARAMETERS + +### -AllowDelete +Opt-in flag to enable the IdLE.Identity.Delete capability. +When $true, the provider advertises the Delete capability and allows identity deletion. +Default is $false for safety. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Adapter +Internal parameter for dependency injection during testing. +Allows unit tests to inject +a mock Graph adapter without requiring a real Entra ID environment. + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: False +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProgressAction +TODO: ProgressAction Description + +```yaml +Type: ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### PSCustomObject with IdLE provider contract methods +## NOTES +Requires Microsoft Graph API permissions (delegated or app-only): +- User.Read.All, User.ReadWrite.All +- Group.Read.All, GroupMember.ReadWrite.All +- AdministrativeUnit.Read.All (for ListEntitlements/GrantEntitlement/RevokeEntitlement with Kind=AdministrativeUnit) +- AdministrativeUnit.ReadWrite.All (for Grant/Revoke with Kind=AdministrativeUnit) +- For delete: User.ReadWrite.All + +See docs/reference/providers/provider-entraID.md for detailed permission requirements. + +## RELATED LINKS diff --git a/docs/reference/cmdlets/New-IdleExchangeOnlineProvider.md b/docs/reference/cmdlets/New-IdleExchangeOnlineProvider.md new file mode 100644 index 00000000..bb7e6690 --- /dev/null +++ b/docs/reference/cmdlets/New-IdleExchangeOnlineProvider.md @@ -0,0 +1,124 @@ +--- +external help file: IdLE-help.xml +Module Name: IdLE +online version: +schema: 2.0.0 +--- + +# New-IdleExchangeOnlineProvider + +## SYNOPSIS +Creates an Exchange Online mailbox provider for IdLE. + +## SYNTAX + +``` +New-IdleExchangeOnlineProvider [[-Adapter] <Object>] [-ProgressAction <ActionPreference>] [<CommonParameters>] +``` + +## DESCRIPTION +This provider integrates with Exchange Online for mailbox lifecycle management operations. +It supports mailbox reporting, type conversions, and Out of Office configuration management. + +The provider implements the mailbox-specific provider contract used by IdLE.Steps.Mailbox. + +Identity addressing: +- UserPrincipalName (UPN) - preferred +- Primary SMTP address (email) +- Mailbox GUID (for deterministic operations) + +The canonical identity key for all outputs is the primary SMTP address. + +Authentication: +Provider methods accept an optional AuthSession parameter for runtime credential +selection via the AuthSessionBroker. +The provider supports multiple auth session formats: +- String access token (for future Graph API integration) +- Object with AccessToken property +- Object with GetAccessToken() method +- PSCredential (for certificate-based auth) + +By default, mailbox steps should use: +- With.AuthSessionName = 'ExchangeOnline' +- With.AuthSessionOptions = @{ Role = 'Admin' } (or other routing keys) + +Prerequisites: +- ExchangeOnlineManagement PowerShell module must be installed +- For app-only (certificate) auth: Windows platform required (MVP limitation) +- Authenticated session must be established before using provider methods + +## EXAMPLES + +### EXAMPLE 1 +``` +# Basic usage with delegated auth +# Host establishes connection first +Connect-ExchangeOnline -UserPrincipalName admin@contoso.com +$provider = New-IdleExchangeOnlineProvider +$plan = New-IdlePlan -WorkflowPath './workflow.psd1' -Request $request -Providers @{ + ExchangeOnline = $provider +} +``` + +### EXAMPLE 2 +``` +# Certificate-based app-only auth (Windows only) +# Host establishes connection first +Connect-ExchangeOnline -CertificateThumbprint $thumbprint -AppId $appId -Organization $tenantId +$provider = New-IdleExchangeOnlineProvider +$plan = New-IdlePlan -WorkflowPath './workflow.psd1' -Request $request -Providers @{ + ExchangeOnline = $provider +} +``` + +## PARAMETERS + +### -Adapter +Internal parameter for dependency injection during testing. +Allows unit tests to inject +a fake adapter without requiring a real Exchange Online environment. + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: False +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProgressAction +TODO: ProgressAction Description + +```yaml +Type: ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### PSCustomObject with IdLE mailbox provider contract methods +## NOTES +Requires Exchange Online Management module and appropriate permissions: +- Exchange.ManageAsApp (app-only) +- Exchange Administrator or Global Administrator role (delegated) +- Required role: Mail Recipients (manage mailboxes) + +See the IdLE provider documentation for detailed setup. + +## RELATED LINKS diff --git a/docs/reference/cmdlets/New-IdleMockIdentityProvider.md b/docs/reference/cmdlets/New-IdleMockIdentityProvider.md new file mode 100644 index 00000000..3fc2091e --- /dev/null +++ b/docs/reference/cmdlets/New-IdleMockIdentityProvider.md @@ -0,0 +1,98 @@ +--- +external help file: IdLE-help.xml +Module Name: IdLE +online version: +schema: 2.0.0 +--- + +# New-IdleMockIdentityProvider + +## SYNOPSIS +Creates an in-memory identity provider for tests and demos. + +## SYNTAX + +``` +New-IdleMockIdentityProvider [[-InitialStore] <Hashtable>] [-ProgressAction <ActionPreference>] + [<CommonParameters>] +``` + +## DESCRIPTION +This provider is deterministic and has no external dependencies. +It is designed to be used in unit tests, contract tests, and example workflows. + +The provider keeps all state in a private in-memory store that is scoped to the +returned provider object instance (no global state). +This makes tests predictable. + +## EXAMPLES + +### EXAMPLE 1 +``` +$provider = New-IdleMockIdentityProvider +$provider.EnsureAttribute('user1', 'Department', 'IT') | Out-Null +$provider.GetIdentity('user1') | Format-List +``` + +### EXAMPLE 2 +``` +$provider = New-IdleMockIdentityProvider -InitialStore @{ + 'user1' = @{ + IdentityKey = 'user1' + Enabled = $true + Attributes = @{ + Department = 'IT' + } + Entitlements = @( + @{ Kind = 'Group'; Id = 'demo-group' } + ) + } +} +``` + +## PARAMETERS + +### -InitialStore +Optional initial store content. +This is useful when a test wants to start with +pre-seeded identities. +The input is shallow-copied to avoid unintended mutations +from the outside. + +```yaml +Type: Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProgressAction +TODO: ProgressAction Description + +```yaml +Type: ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS diff --git a/src/IdLE.Provider.AD/Public/New-IdleADIdentityProvider.ps1 b/src/IdLE.Provider.AD/Public/New-IdleADIdentityProvider.ps1 index 6e0b72a7..967e3d1f 100644 --- a/src/IdLE.Provider.AD/Public/New-IdleADIdentityProvider.ps1 +++ b/src/IdLE.Provider.AD/Public/New-IdleADIdentityProvider.ps1 @@ -69,18 +69,15 @@ function New-IdleADIdentityProvider { # Multi-role scenario with New-IdleAuthSessionBroker (recommended) $tier0Credential = Get-Credential -Message "Enter Tier0 admin credentials" $adminCredential = Get-Credential -Message "Enter regular admin credentials" - $authSessionBroker = New-IdleAuthSessionBroker -SessionMap @{ @{ Role = 'Tier0' } = $tier0Credential @{ Role = 'Admin' } = $adminCredential } -DefaultCredential $adminCredential - $provider = New-IdleADIdentityProvider $plan = New-IdlePlan -WorkflowPath './workflow.psd1' -Request $request -Providers @{ Identity = $provider AuthSessionBroker = $authSessionBroker } - # Workflow steps can specify different auth contexts: # With.AuthSessionName = 'ActiveDirectory' # With.AuthSessionOptions = @{ Role = 'Tier0' } @@ -95,7 +92,6 @@ function New-IdleADIdentityProvider { } return Get-SecretFromVault -Name 'AD-Admin' } - $provider = New-IdleADIdentityProvider $plan = New-IdlePlan -WorkflowPath './workflow.psd1' -Request $request -Providers @{ Identity = $provider diff --git a/src/IdLE.Provider.EntraID/Public/New-IdleEntraIDIdentityProvider.ps1 b/src/IdLE.Provider.EntraID/Public/New-IdleEntraIDIdentityProvider.ps1 index f0e12bc3..10be0bbe 100644 --- a/src/IdLE.Provider.EntraID/Public/New-IdleEntraIDIdentityProvider.ps1 +++ b/src/IdLE.Provider.EntraID/Public/New-IdleEntraIDIdentityProvider.ps1 @@ -46,7 +46,6 @@ function New-IdleEntraIDIdentityProvider { $authSessionBroker = New-IdleAuthSessionBroker -SessionMap @{ @{} = $accessToken } -DefaultCredential $accessToken - $provider = New-IdleEntraIDIdentityProvider $plan = New-IdlePlan -WorkflowPath './workflow.psd1' -Request $request -Providers @{ Identity = $provider @@ -57,18 +56,15 @@ function New-IdleEntraIDIdentityProvider { # Multi-role scenario $tier0Token = Get-GraphTokenForTier0 # host-managed auth $adminToken = Get-GraphTokenForAdmin - $authSessionBroker = New-IdleAuthSessionBroker -SessionMap @{ @{ Role = 'Tier0' } = $tier0Token @{ Role = 'Admin' } = $adminToken } -DefaultCredential $adminToken - $provider = New-IdleEntraIDIdentityProvider $plan = New-IdlePlan -WorkflowPath './workflow.psd1' -Request $request -Providers @{ Identity = $provider AuthSessionBroker = $authSessionBroker } - # Workflow steps specify: With.AuthSessionOptions = @{ Role = 'Tier0' } .EXAMPLE diff --git a/src/IdLE.Provider.ExchangeOnline/Public/New-IdleExchangeOnlineProvider.ps1 b/src/IdLE.Provider.ExchangeOnline/Public/New-IdleExchangeOnlineProvider.ps1 index 2a6fb3cf..2b0d840d 100644 --- a/src/IdLE.Provider.ExchangeOnline/Public/New-IdleExchangeOnlineProvider.ps1 +++ b/src/IdLE.Provider.ExchangeOnline/Public/New-IdleExchangeOnlineProvider.ps1 @@ -41,7 +41,6 @@ function New-IdleExchangeOnlineProvider { # Basic usage with delegated auth # Host establishes connection first Connect-ExchangeOnline -UserPrincipalName admin@contoso.com - $provider = New-IdleExchangeOnlineProvider $plan = New-IdlePlan -WorkflowPath './workflow.psd1' -Request $request -Providers @{ ExchangeOnline = $provider @@ -51,7 +50,6 @@ function New-IdleExchangeOnlineProvider { # Certificate-based app-only auth (Windows only) # Host establishes connection first Connect-ExchangeOnline -CertificateThumbprint $thumbprint -AppId $appId -Organization $tenantId - $provider = New-IdleExchangeOnlineProvider $plan = New-IdlePlan -WorkflowPath './workflow.psd1' -Request $request -Providers @{ ExchangeOnline = $provider diff --git a/src/IdLE/Public/Export-IdlePlan.ps1 b/src/IdLE/Public/Export-IdlePlan.ps1 index 18ae39c2..875870f6 100644 --- a/src/IdLE/Public/Export-IdlePlan.ps1 +++ b/src/IdLE/Public/Export-IdlePlan.ps1 @@ -22,19 +22,19 @@ Optional file path to write the JSON artifact to. When -Path is used, returns the JSON string in addition to writing the file. .EXAMPLE -$plan = New-IdlePlan -Request $request -Workflow $workflow -StepRegistry $registry +$plan = New-IdlePlan -WorkflowPath ./joiner.psd1 -Request $request -Providers $providers $plan | Export-IdlePlan Exports the plan and returns the JSON string. .EXAMPLE -New-IdlePlan -Request $request -Workflow $workflow -StepRegistry $registry | +New-IdlePlan -WorkflowPath ./joiner.psd1 -Request $request -Providers $providers | Export-IdlePlan -Path ./artifacts/plan.json Exports the plan and writes the JSON to a file. .EXAMPLE -New-IdlePlan -Request $request -Workflow $workflow -StepRegistry $registry | +New-IdlePlan -WorkflowPath ./joiner.psd1 -Request $request -Providers $providers | Export-IdlePlan -Path ./artifacts/plan.json -PassThru Writes the file and also returns the JSON string. From 6d67f0734fabdb2c9ed7e6c2cd3028d67c6e6213 Mon Sep 17 00:00:00 2001 From: Matthias Fleschuetz <13959569+blindzero@users.noreply.github.com> Date: Sat, 31 Oct 2026 18:21:54 +0100 Subject: [PATCH 4/7] docs: describe bundled IdLE package and migration from standalone modules Update installation (incl. migration section), release process, provider reference pages, quickstart, walkthrough and examples to use Install-Module/Import-Module IdLE only. Refs #321 Co-Authored-By: Claude Opus 5.5 --- docs/develop/releases.md | 69 +++++++------------ docs/reference/providers/provider-ad.md | 9 +-- .../provider-directorysync-entraconnect.md | 9 +-- docs/reference/providers/provider-entraID.md | 9 +-- .../providers/provider-exchangeonline.md | 14 +--- docs/reference/providers/provider-mock.md | 9 +-- docs/use/installation.md | 64 +++++++---------- docs/use/providers.md | 2 +- docs/use/quickstart.md | 5 +- docs/use/walkthrough/03-plan-creation.md | 1 - .../05-providers-authentication.md | 2 +- examples/Invoke-IdleDemo.ps1 | 5 +- examples/Invoke-LeaverWithManagerOOF.ps1 | 2 - examples/README.md | 2 +- src/IdLE.Provider.ExchangeOnline/README.md | 4 +- 15 files changed, 73 insertions(+), 133 deletions(-) diff --git a/docs/develop/releases.md b/docs/develop/releases.md index c513215f..3bafd598 100644 --- a/docs/develop/releases.md +++ b/docs/develop/releases.md @@ -40,7 +40,8 @@ IdLE follows [Semantic Versioning](https://semver.org/): ### Multi-Module Versioning Strategy -Starting with version 1.0, IdLE uses a **synchronized versioning strategy** across all published modules: +IdLE uses a **synchronized versioning strategy** across all modules. All modules are shipped together in the +bundled `IdLE` package (see [PowerShell Gallery publishing](#powershell-gallery-publishing)): - All modules (`IdLE`, `IdLE.Core`, `IdLE.Steps.Common`, providers, and step modules) share the **same version number** - Version bumps are **synchronized** across all modules in each release @@ -223,64 +224,42 @@ If you need another preview, repeat with `preview.2`, etc. (no version bump requ ### PowerShell Gallery publishing -IdLE is published to the PowerShell Gallery as **multiple separate modules** (multi-module distribution): +IdLE is published to the PowerShell Gallery as **one package**, `IdLE`. It contains all first-party modules +(`IdLE.Core`, the `IdLE.Steps.*` step packs and the `IdLE.Provider.*` providers) as nested modules. -- **IdLE** (meta-module) — Declares `IdLE.Core` and `IdLE.Steps.Common` as `RequiredModules` -- **IdLE.Core** — Workflow engine (no IdLE dependencies) -- **IdLE.Steps.Common** — Built-in steps (requires `IdLE.Core`) -- **IdLE.Provider.\*** — Provider modules (each published separately, typically require `IdLE.Core`) -- **IdLE.Steps.\*** — Optional step modules (published separately, require `IdLE.Core` and/or `IdLE.Steps.Common`) - -**Publishing Order:** - -Modules are published in **dependency order** to ensure dependencies exist before dependent modules: - -1. `IdLE.Core` (no IdLE dependencies) -2. `IdLE.Steps.Common` (depends on Core) -3. `IdLE` (depends on Core + Steps.Common) -4. All providers and optional step modules - -The publish order is defined in `tools/ModulePublishOrder.psd1` and used by the release workflow. +The bundle content is defined by the `NestedModules` list in `src/IdLE/IdLE.psd1` (single source of truth). **Workflow Behavior:** -- On tag pushes matching `v*`, the workflow publishes all modules to PSGallery in dependency order. -- A 30-second delay is added between publishes to allow PSGallery processing time. +- On tag pushes matching `v*`, the workflow publishes the `IdLE` package to PSGallery. - For manual runs (`workflow_dispatch`), publishing is only performed when **publish_psgallery** is set to `true`. +- Before publishing, the `psgallery_local_test` job publishes the package to a local PSRepository, installs and imports it, + and verifies that all bundled modules are loaded from the installed package. -### Package staging - -The workflow does not publish directly from the repository `src/` layout. Instead it stages publishable packages using: +:::note Discontinued standalone packages +Up to v0.9.x, every module was published as a separate package (`IdLE.Core`, `IdLE.Provider.AD`, …). +These packages are discontinued. After the first bundled release, the package owner unlists them manually on the PowerShell Gallery. +::: -- `tools/New-IdleModulePackage.ps1 -Mode MultiModule` +### Package staging -**Packaging modes:** +The workflow does not publish directly from the repository `src/` layout. Instead it stages the publishable package using: -1. **Bundled Mode** (`-Mode Bundled`, default): - - Creates a single package with nested modules under `Modules/` - - Output: `artifacts/IdLE/` - - Used for legacy distribution (GitHub releases, zip archives) +- `tools/New-IdleModulePackage.ps1` -2. **MultiModule Mode** (`-Mode MultiModule`): - - Creates separate packages for each module - - Output: `artifacts/modules//` - - Used for PowerShell Gallery publishing - - **Manifest transformation for IdLE:** - - Converts `NestedModules` with relative paths → `RequiredModules` with module names - - Removes `ScriptsToProcess` entry - - Removes `IdLE.Init.ps1` file (not needed in published packages) +The tool: -**Why transform manifests?** +- copies `src/IdLE/` to `artifacts/IdLE/` (package root), +- copies every module listed in `NestedModules` to `artifacts/IdLE/Modules//`, +- rewrites the staged `NestedModules` entries from `..\\.psd1` to `.\Modules\\.psd1`. -- **Source manifests** use `NestedModules` with relative paths to support direct import from repository/zip: `Import-Module ./src/IdLE/IdLE.psd1` -- **Published manifests** use `RequiredModules` with module names for standard PowerShell dependency resolution when installed via `Install-Module` +The repository layout stays unchanged: every module keeps its own folder and manifest under `src/`, so contributors can +import directly from source with `Import-Module ./src/IdLE/IdLE.psd1`. -This dual-manifest approach ensures: -- ✅ Contributors can work directly from repository source -- ✅ Published modules follow PowerShell best practices -- ✅ No `$env:PSModulePath` configuration required for either scenario +**Mixed-version guard:** `IdLE.Init.ps1` (`ScriptsToProcess`) rejects the import if a standalone `IdLE.*` module that is +not part of the imported bundle is already loaded in the session. -For details on the architecture, see **[Installation Guide](../use/installation.md#multi-module-architecture)**. +For the user-facing view, see **[Installation Guide](../use/installation.md)**. ## Versioning and naming diff --git a/docs/reference/providers/provider-ad.md b/docs/reference/providers/provider-ad.md index b7f68661..c631bd0e 100644 --- a/docs/reference/providers/provider-ad.md +++ b/docs/reference/providers/provider-ad.md @@ -39,14 +39,11 @@ Non-goals: ### Install (PowerShell Gallery) -```powershell -Install-Module IdLE.Provider.AD -Scope CurrentUser -``` - -### Import +The provider is part of the `IdLE` package. ```powershell -Import-Module IdLE.Provider.AD +Install-Module IdLE -Scope CurrentUser +Import-Module IdLE ``` ## Quickstart diff --git a/docs/reference/providers/provider-directorysync-entraconnect.md b/docs/reference/providers/provider-directorysync-entraconnect.md index 568d48f7..90f69ca4 100644 --- a/docs/reference/providers/provider-directorysync-entraconnect.md +++ b/docs/reference/providers/provider-directorysync-entraconnect.md @@ -40,14 +40,11 @@ Non-goals: ### Install (PowerShell Gallery) -```powershell -Install-Module IdLE.Provider.DirectorySync.EntraConnect -Scope CurrentUser -``` - -### Import +The provider is part of the `IdLE` package. ```powershell -Import-Module IdLE.Provider.DirectorySync.EntraConnect +Install-Module IdLE -Scope CurrentUser +Import-Module IdLE ``` ## Quickstart diff --git a/docs/reference/providers/provider-entraID.md b/docs/reference/providers/provider-entraID.md index edfba868..254333c2 100644 --- a/docs/reference/providers/provider-entraID.md +++ b/docs/reference/providers/provider-entraID.md @@ -36,14 +36,11 @@ Non-goals: ### Install (PowerShell Gallery) -```powershell -Install-Module IdLE.Provider.EntraID -Scope CurrentUser -``` - -### Import +The provider is part of the `IdLE` package. ```powershell -Import-Module IdLE.Provider.EntraID +Install-Module IdLE -Scope CurrentUser +Import-Module IdLE ``` ## Quickstart diff --git a/docs/reference/providers/provider-exchangeonline.md b/docs/reference/providers/provider-exchangeonline.md index 064d4790..73dbbf47 100644 --- a/docs/reference/providers/provider-exchangeonline.md +++ b/docs/reference/providers/provider-exchangeonline.md @@ -51,21 +51,13 @@ import ExoLeaverMailboxOffboarding from '@site/../examples/workflows/templates/e ### Install (PowerShell Gallery) -```powershell -Install-Module IdLE.Provider.ExchangeOnline -Scope CurrentUser -``` - -### Import & basic check +The provider is part of the `IdLE` package. ```powershell -Import-Module IdLE.Provider.ExchangeOnline - -# Create provider instance -$provider = New-IdleExchangeOnlineProvider +Install-Module IdLE -Scope CurrentUser +Import-Module IdLE ``` -The provider runs a one-time prerequisites check at construction and emits `Write-Warning` if the Exchange Online session is not established. See [Troubleshooting](#troubleshooting) if this fails. - --- ## Quickstart (minimal runnable) diff --git a/docs/reference/providers/provider-mock.md b/docs/reference/providers/provider-mock.md index 35f518ed..ca1cd9a2 100644 --- a/docs/reference/providers/provider-mock.md +++ b/docs/reference/providers/provider-mock.md @@ -32,14 +32,11 @@ None beyond IdLE itself. The Mock provider stores everything in-memory during th ### Install (PowerShell Gallery) -```powershell -Install-Module IdLE.Provider.Mock -Scope CurrentUser -``` - -### Import +The provider is part of the `IdLE` package. ```powershell -Import-Module IdLE.Provider.Mock +Install-Module IdLE -Scope CurrentUser +Import-Module IdLE ``` ## Quickstart diff --git a/docs/use/installation.md b/docs/use/installation.md index dc983f2e..44e54044 100644 --- a/docs/use/installation.md +++ b/docs/use/installation.md @@ -18,18 +18,35 @@ IdLE can be installed either from the **PowerShell Gallery** (recommended) or di From a PowerShell 7 prompt: ```powershell -# Install the IdLE meta-module (pulls IdLE.Core and IdLE.Steps.Common as dependencies) +# Install IdLE (one package: engine, all built-in steps and all providers) Install-Module -Name IdLE -Scope CurrentUser -# Import the baseline modules +# Import IdLE Import-Module -Name IdLE ``` +The `IdLE` package contains all first-party modules as nested modules, in one synchronized version: + +| Module | Content | +| --- | --- | +| `IdLE.Core` | Workflow engine | +| `IdLE.Steps.Common`, `IdLE.Steps.DirectorySync`, `IdLE.Steps.Mailbox` | Built-in steps | +| `IdLE.Provider.AD`, `IdLE.Provider.EntraID`, `IdLE.Provider.ExchangeOnline`, `IdLE.Provider.DirectorySync.EntraConnect`, `IdLE.Provider.Mock` | Providers | + +`Import-Module IdLE` makes all built-in steps available to the engine and exports the provider factory functions +(e.g. `New-IdleADIdentityProvider`, `New-IdleMockIdentityProvider`). +See the [reference](../reference/intro-reference.md) for further details on [Steps](../reference/steps.md) and [Providers](../reference/providers.md). + +:::info External dependencies are loaded on use +Providers do not import their external modules (e.g. `ActiveDirectory`, `ExchangeOnlineManagement`, `ADSync`) when IdLE is imported. +Install those modules only for the providers you use; they are required when the provider is created or used. +::: + :::info Command collision during install? If PowerShellGet reports that a command is already available, prefer a clean reinstall instead of `-AllowClobber`. ```powershell -Get-InstalledModule IdLE, IdLE.Core, IdLE.Steps.Common -ErrorAction SilentlyContinue | +Get-InstalledModule IdLE -ErrorAction SilentlyContinue | Uninstall-Module -AllVersions -Force Install-Module -Name IdLE -Scope CurrentUser -Force @@ -40,29 +57,6 @@ Import-Module -Name IdLE --- -## Install optional modules - -Providers and additional step modules are published as separate modules and can be installed independently. -See the [reference](../reference/intro-reference.md) for further details on [Steps](../reference/steps.md) and [Providers](../reference/providers.md). - -```powershell -# Provider modules (examples) -Install-Module -Name IdLE.Provider.AD -Scope CurrentUser -Install-Module -Name IdLE.Provider.EntraID -Scope CurrentUser -Install-Module -Name IdLE.Provider.ExchangeOnline -Scope CurrentUser - -# Optional step modules (examples) -Install-Module -Name IdLE.Steps.Mailbox -Scope CurrentUser - -# Mock provider (safe, used for tests and walkthroughs) -Install-Module -Name IdLE.Provider.Mock -Scope CurrentUser -``` - - -:::tip -If a workflow references a StepType from an optional steps module, that steps module must be installed and imported in the host session. -::: - --- ## Install from repository source @@ -77,30 +71,24 @@ This path is intended for development and contribution scenarios. git clone https://github.com/blindzero/IdentityLifecycleEngine cd IdentityLifecycleEngine -# Import meta module +# Import IdLE (imports all modules under src/ as nested modules) Import-Module ./src/IdLE/IdLE.psd1 -Force ``` :::info -The meta module bootstraps module discovery for the repository layout. Avoid using this in parallel with an IdLE installation from the PowerShell Gallery. -After importing from source, you can import additional modules by name. +Importing from source loads the same set of modules as the `IdLE` package. Avoid using this in parallel with an IdLE installation from the PowerShell Gallery. ::: -```powershell -Import-Module IdLE.Provider.Mock -Force -Import-Module IdLE.Steps.Mailbox -Force -``` - --- ## Verify installation ```powershell -Get-Module IdLE* -ListAvailable | Select-Object Name, Version, Path -# Public-facing user commands +Get-Module IdLE -ListAvailable | Select-Object Name, Version, Path +# Public commands (engine cmdlets and provider factories) Get-Command -Module IdLE | Sort-Object Name -# Public interface functions from modules -Get-Command -Module IdLE.* | Sort-Object Name +# Bundled modules loaded with IdLE +Get-Module -All -Name 'IdLE.*' | Select-Object Name, Version, ModuleBase ``` --- diff --git a/docs/use/providers.md b/docs/use/providers.md index 86dc1a27..1297d8e8 100644 --- a/docs/use/providers.md +++ b/docs/use/providers.md @@ -34,7 +34,7 @@ IdLE expects a hashtable of providers keyed by **alias**. The alias is what workflow steps reference via `With.Provider`. ```powershell -Import-Module -Name IdLE.Provider.Mock +Import-Module -Name IdLE $providers = @{ Identity = New-IdleMockIdentityProvider diff --git a/docs/use/quickstart.md b/docs/use/quickstart.md index 228afc43..0fe4a6f6 100644 --- a/docs/use/quickstart.md +++ b/docs/use/quickstart.md @@ -27,11 +27,8 @@ IdLE does not ship a “live system host”. ## 1) Install and import modules ```powershell -# IdLE meta module (incl. IdLE.Core + IdLE.Steps.Common) +# IdLE (engine, built-in steps and providers, incl. the safe Mock provider) Import-Module -Name IdLE - -# Mock provider (safe, no real systems touched) -Import-Module -Name IdLE.Provider.Mock ``` :::tip diff --git a/docs/use/walkthrough/03-plan-creation.md b/docs/use/walkthrough/03-plan-creation.md index bc9a8214..32b3dfa8 100644 --- a/docs/use/walkthrough/03-plan-creation.md +++ b/docs/use/walkthrough/03-plan-creation.md @@ -34,7 +34,6 @@ For this walkthrough we use the mock provider: ```powershell Import-Module -Name IdLE -Import-Module -Name IdLE.Provider.Mock $providers = @{ Identity = New-IdleMockIdentityProvider diff --git a/docs/use/walkthrough/05-providers-authentication.md b/docs/use/walkthrough/05-providers-authentication.md index a297a203..d3effc1e 100644 --- a/docs/use/walkthrough/05-providers-authentication.md +++ b/docs/use/walkthrough/05-providers-authentication.md @@ -34,7 +34,7 @@ IdLE expects a hashtable of providers keyed by **alias**. Steps reference the al Example host mapping (mock provider): ```powershell -Import-Module -Name IdLE.Provider.Mock +Import-Module -Name IdLE $providers = @{ Identity = New-IdleMockIdentityProvider diff --git a/examples/Invoke-IdleDemo.ps1 b/examples/Invoke-IdleDemo.ps1 index 4ac20bb7..d69e9246 100644 --- a/examples/Invoke-IdleDemo.ps1 +++ b/examples/Invoke-IdleDemo.ps1 @@ -224,10 +224,9 @@ function Select-DemoWorkflows { return @($AvailableWorkflows[0]) } -# Import modules from the repo (path-based import, no global installation required). +# Import IdLE from the repo (path-based import, no global installation required). +# IdLE includes all built-in steps and providers (incl. the Mock provider). Import-Module (Join-Path $PSScriptRoot '..\src\IdLE\IdLE.psd1') -Force -ErrorAction Stop -# Mock provider is optional and must be imported explicitly (not auto-imported by IdLE) -Import-Module (Join-Path $PSScriptRoot '..\src\IdLE.Provider.Mock\IdLE.Provider.Mock.psd1') -Force -ErrorAction Stop $available = @(Get-DemoWorkflows -Category $Category) diff --git a/examples/Invoke-LeaverWithManagerOOF.ps1 b/examples/Invoke-LeaverWithManagerOOF.ps1 index fb6225d4..20433526 100644 --- a/examples/Invoke-LeaverWithManagerOOF.ps1 +++ b/examples/Invoke-LeaverWithManagerOOF.ps1 @@ -142,8 +142,6 @@ Write-Host " Request CorrelationId: $($request.CorrelationId)" -ForegroundColor Write-Host "==> Setting up providers..." -ForegroundColor Cyan # For this example, we'll use mock providers (replace with real providers in production) -Import-Module ./src/IdLE.Steps.Mailbox/IdLE.Steps.Mailbox.psd1 -Force -Import-Module ./src/IdLE.Provider.Mock/IdLE.Provider.Mock.psd1 -Force $exoProvider = New-IdleMockProvider -Name 'ExchangeOnline' -Capabilities @( 'IdLE.Mailbox.Info.Read' diff --git a/examples/README.md b/examples/README.md index 3229a582..4bce53ff 100644 --- a/examples/README.md +++ b/examples/README.md @@ -23,7 +23,7 @@ Example workflows that require real providers and external systems (Active Direc **Prerequisites:** - Real AD/Entra ID environment -- Provider modules: `IdLE.Provider.ActiveDirectory`, `IdLE.Provider.EntraID`, `IdLE.Provider.DirectorySync.EntraConnect` +- The providers (`IdLE.Provider.AD`, `IdLE.Provider.EntraID`, `IdLE.Provider.DirectorySync.EntraConnect`) are part of the `IdLE` package; their external modules (e.g. `ActiveDirectory`, `ADSync`) must be installed - Appropriate authentication/credentials **Workflows:** diff --git a/src/IdLE.Provider.ExchangeOnline/README.md b/src/IdLE.Provider.ExchangeOnline/README.md index 51b1d485..d7d00481 100644 --- a/src/IdLE.Provider.ExchangeOnline/README.md +++ b/src/IdLE.Provider.ExchangeOnline/README.md @@ -5,8 +5,8 @@ Exchange Online mailbox provider for IdLE. ## Quick Start ```powershell -# Import the provider -Import-Module IdLE.Provider.ExchangeOnline +# Import IdLE (includes the Exchange Online provider) +Import-Module IdLE # Host establishes Exchange Online session (delegated or app-only) Connect-ExchangeOnline -UserPrincipalName admin@contoso.com From 4b59c7562760269987b2c18a417ebbbe2511b032 Mon Sep 17 00:00:00 2001 From: Matthias Fleschuetz <13959569+blindzero@users.noreply.github.com> Date: Sat, 31 Oct 2026 18:33:53 +0100 Subject: [PATCH 5/7] fix(tests): normalize manifest path separators on Linux NestedModules entries use '\' ('..\IdLE.Core\IdLE.Core.psd1'), which is not a path separator on Linux/macOS, so [IO.Path]::GetFileNameWithoutExtension returned the whole entry. Normalize to '/' before extracting module names in the tests and in the release workflow's local publish verification (runs on ubuntu-latest). Refs #321 Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release.yml | 2 +- tests/Core/ModuleBootstrap.Tests.ps1 | 2 +- tests/Packaging/ModuleSurface.Tests.ps1 | 6 ++++-- tests/Packaging/New-IdleModulePackage.Tests.ps1 | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 567a5174..326e87f6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -299,7 +299,7 @@ jobs: # Verify all bundled modules were loaded from the installed package $expected = @((Import-PowerShellDataFile -LiteralPath (Join-Path $m.ModuleBase 'IdLE.psd1')).NestedModules | - ForEach-Object { [System.IO.Path]::GetFileNameWithoutExtension($_) }) + ForEach-Object { [System.IO.Path]::GetFileNameWithoutExtension(($_ -replace '\\', '/')) }) foreach ($name in $expected) { $nested = Get-Module -All -Name $name | Select-Object -First 1 if (-not $nested) { throw "$name was not loaded as nested module." } diff --git a/tests/Core/ModuleBootstrap.Tests.ps1 b/tests/Core/ModuleBootstrap.Tests.ps1 index d72984c1..cecf172c 100644 --- a/tests/Core/ModuleBootstrap.Tests.ps1 +++ b/tests/Core/ModuleBootstrap.Tests.ps1 @@ -71,7 +71,7 @@ Describe 'IdLE Module Bootstrap for Repo/Zip Layouts' { # IdLE nests all sibling modules, so the layout must contain the complete bundle. $modules = @('IdLE') + @( (Import-PowerShellDataFile -Path $script:IdleManifest).NestedModules | - ForEach-Object { [System.IO.Path]::GetFileNameWithoutExtension($_) } + ForEach-Object { [System.IO.Path]::GetFileNameWithoutExtension(($_ -replace '\\', '/')) } ) $layout = New-IdleTestModuleLayout -DestinationRoot $moduleRoot -Modules $modules diff --git a/tests/Packaging/ModuleSurface.Tests.ps1 b/tests/Packaging/ModuleSurface.Tests.ps1 index ed37426e..00d731b4 100644 --- a/tests/Packaging/ModuleSurface.Tests.ps1 +++ b/tests/Packaging/ModuleSurface.Tests.ps1 @@ -205,8 +205,10 @@ Describe 'Module manifests and public surface' { $bundled.Count | Should -Be 9 foreach ($entry in $bundled) { - $name = [System.IO.Path]::GetFileNameWithoutExtension($entry) - $expectedBase = Split-Path -Path ([System.IO.Path]::GetFullPath((Join-Path -Path $idleBase -ChildPath $entry))) -Parent + # Manifest entries use '\'; normalize so the path also resolves on Linux/macOS. + $relative = $entry -replace '\\', '/' + $name = [System.IO.Path]::GetFileNameWithoutExtension($relative) + $expectedBase = Split-Path -Path ([System.IO.Path]::GetFullPath((Join-Path -Path $idleBase -ChildPath $relative))) -Parent $module = Get-Module -All -Name $name | Select-Object -First 1 $module | Should -Not -BeNullOrEmpty -Because "$name is part of the IdLE bundle" diff --git a/tests/Packaging/New-IdleModulePackage.Tests.ps1 b/tests/Packaging/New-IdleModulePackage.Tests.ps1 index 305982fb..923edf97 100644 --- a/tests/Packaging/New-IdleModulePackage.Tests.ps1 +++ b/tests/Packaging/New-IdleModulePackage.Tests.ps1 @@ -9,7 +9,7 @@ BeforeAll { $script:BundledNames = @( (Import-PowerShellDataFile -Path $script:SourceManifest).NestedModules | - ForEach-Object { [System.IO.Path]::GetFileNameWithoutExtension($_) } + ForEach-Object { [System.IO.Path]::GetFileNameWithoutExtension(($_ -replace '\\', '/')) } ) $script:PackageRoot = Join-Path -Path $TestDrive -ChildPath 'IdLE' From b178a0c2557bb5d53e174d581d668bceec867aa5 Mon Sep 17 00:00:00 2001 From: Matthias Fleschuetz <13959569+blindzero@users.noreply.github.com> Date: Sat, 31 Oct 2026 18:33:53 +0100 Subject: [PATCH 6/7] docs(reference): add provider factory pages to sidebar and fix MDX risks - Add the five provider factory cmdlet pages to website/sidebars.js (docs consistency audit: orphan docs). - Wrap regex/hashtable snippets in the provider help in inline code so the generated pages contain no bare braces; regenerate the cmdlet reference. Refs #321 Co-Authored-By: Claude Opus 5.5 --- docs/reference/cmdlets/New-IdleADIdentityProvider.md | 2 +- docs/reference/cmdlets/New-IdleEntraIDIdentityProvider.md | 2 +- docs/reference/cmdlets/New-IdleExchangeOnlineProvider.md | 2 +- src/IdLE.Provider.AD/Public/New-IdleADIdentityProvider.ps1 | 2 +- .../Public/New-IdleEntraIDIdentityProvider.ps1 | 2 +- .../Public/New-IdleExchangeOnlineProvider.ps1 | 2 +- website/sidebars.js | 5 +++++ 7 files changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/reference/cmdlets/New-IdleADIdentityProvider.md b/docs/reference/cmdlets/New-IdleADIdentityProvider.md index e6bb561c..a4bcf1e6 100644 --- a/docs/reference/cmdlets/New-IdleADIdentityProvider.md +++ b/docs/reference/cmdlets/New-IdleADIdentityProvider.md @@ -28,7 +28,7 @@ The provider supports common identity operations (Create, Read, Disable, Enable, and group entitlement management (List, Grant, Revoke). Identity addressing supports: -- GUID (ObjectGuid) - pattern: ^\[0-9a-fA-F-\]{36}$ or N-format +- GUID (ObjectGuid) - pattern: \`^\[0-9a-fA-F-\]{36}$\` or N-format - UPN (UserPrincipalName) - contains @ - sAMAccountName - default fallback diff --git a/docs/reference/cmdlets/New-IdleEntraIDIdentityProvider.md b/docs/reference/cmdlets/New-IdleEntraIDIdentityProvider.md index 0e2d7044..3b2f798c 100644 --- a/docs/reference/cmdlets/New-IdleEntraIDIdentityProvider.md +++ b/docs/reference/cmdlets/New-IdleEntraIDIdentityProvider.md @@ -44,7 +44,7 @@ The provider supports multiple auth session formats: By default, steps should use: - With.AuthSessionName = 'MicrosoftGraph' -- With.AuthSessionOptions = @{ Role = 'Admin' } (or other routing keys) +- \`With.AuthSessionOptions = @{ Role = 'Admin' }\` (or other routing keys) ## EXAMPLES diff --git a/docs/reference/cmdlets/New-IdleExchangeOnlineProvider.md b/docs/reference/cmdlets/New-IdleExchangeOnlineProvider.md index bb7e6690..2dee8d5c 100644 --- a/docs/reference/cmdlets/New-IdleExchangeOnlineProvider.md +++ b/docs/reference/cmdlets/New-IdleExchangeOnlineProvider.md @@ -40,7 +40,7 @@ The provider supports multiple auth session formats: By default, mailbox steps should use: - With.AuthSessionName = 'ExchangeOnline' -- With.AuthSessionOptions = @{ Role = 'Admin' } (or other routing keys) +- \`With.AuthSessionOptions = @{ Role = 'Admin' }\` (or other routing keys) Prerequisites: - ExchangeOnlineManagement PowerShell module must be installed diff --git a/src/IdLE.Provider.AD/Public/New-IdleADIdentityProvider.ps1 b/src/IdLE.Provider.AD/Public/New-IdleADIdentityProvider.ps1 index 967e3d1f..8fe2edac 100644 --- a/src/IdLE.Provider.AD/Public/New-IdleADIdentityProvider.ps1 +++ b/src/IdLE.Provider.AD/Public/New-IdleADIdentityProvider.ps1 @@ -11,7 +11,7 @@ function New-IdleADIdentityProvider { and group entitlement management (List, Grant, Revoke). Identity addressing supports: - - GUID (ObjectGuid) - pattern: ^[0-9a-fA-F-]{36}$ or N-format + - GUID (ObjectGuid) - pattern: `^[0-9a-fA-F-]{36}$` or N-format - UPN (UserPrincipalName) - contains @ - sAMAccountName - default fallback diff --git a/src/IdLE.Provider.EntraID/Public/New-IdleEntraIDIdentityProvider.ps1 b/src/IdLE.Provider.EntraID/Public/New-IdleEntraIDIdentityProvider.ps1 index 10be0bbe..8d4e6995 100644 --- a/src/IdLE.Provider.EntraID/Public/New-IdleEntraIDIdentityProvider.ps1 +++ b/src/IdLE.Provider.EntraID/Public/New-IdleEntraIDIdentityProvider.ps1 @@ -28,7 +28,7 @@ function New-IdleEntraIDIdentityProvider { By default, steps should use: - With.AuthSessionName = 'MicrosoftGraph' - - With.AuthSessionOptions = @{ Role = 'Admin' } (or other routing keys) + - `With.AuthSessionOptions = @{ Role = 'Admin' }` (or other routing keys) .PARAMETER AllowDelete Opt-in flag to enable the IdLE.Identity.Delete capability. diff --git a/src/IdLE.Provider.ExchangeOnline/Public/New-IdleExchangeOnlineProvider.ps1 b/src/IdLE.Provider.ExchangeOnline/Public/New-IdleExchangeOnlineProvider.ps1 index 2b0d840d..7a7e1305 100644 --- a/src/IdLE.Provider.ExchangeOnline/Public/New-IdleExchangeOnlineProvider.ps1 +++ b/src/IdLE.Provider.ExchangeOnline/Public/New-IdleExchangeOnlineProvider.ps1 @@ -26,7 +26,7 @@ function New-IdleExchangeOnlineProvider { By default, mailbox steps should use: - With.AuthSessionName = 'ExchangeOnline' - - With.AuthSessionOptions = @{ Role = 'Admin' } (or other routing keys) + - `With.AuthSessionOptions = @{ Role = 'Admin' }` (or other routing keys) Prerequisites: - ExchangeOnlineManagement PowerShell module must be installed diff --git a/website/sidebars.js b/website/sidebars.js index d4b7d5e1..096c9885 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -95,6 +95,11 @@ const sidebars = { 'reference/cmdlets/New-IdleRequest', 'reference/cmdlets/New-IdlePlan', 'reference/cmdlets/Test-IdleWorkflow', + 'reference/cmdlets/New-IdleADIdentityProvider', + 'reference/cmdlets/New-IdleEntraIDIdentityProvider', + 'reference/cmdlets/New-IdleExchangeOnlineProvider', + 'reference/cmdlets/New-IdleEntraConnectDirectorySyncProvider', + 'reference/cmdlets/New-IdleMockIdentityProvider', ], }, 'reference/steps', From 053d345cfbef235b4e54cb48f69be5b31688fce8 Mon Sep 17 00:00:00 2001 From: Matthias Fleschuetz <13959569+blindzero@users.noreply.github.com> Date: Sat, 31 Oct 2026 18:37:57 +0100 Subject: [PATCH 7/7] docs(reference): avoid braces in provider help descriptions platyPS escapes backticks in description text (\`), so inline code is not recognized and MDX evaluates '{ ... }' as a JavaScript expression. This broke the Docusaurus build ("Role is not defined") and would have rendered '{36}' as '36'. Rephrase the three lines without braces and regenerate the cmdlet reference. Refs #321 Co-Authored-By: Claude Opus 5.5 --- docs/reference/cmdlets/New-IdleADIdentityProvider.md | 2 +- docs/reference/cmdlets/New-IdleEntraIDIdentityProvider.md | 3 ++- docs/reference/cmdlets/New-IdleExchangeOnlineProvider.md | 3 ++- src/IdLE.Provider.AD/Public/New-IdleADIdentityProvider.ps1 | 2 +- .../Public/New-IdleEntraIDIdentityProvider.ps1 | 2 +- .../Public/New-IdleExchangeOnlineProvider.ps1 | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/reference/cmdlets/New-IdleADIdentityProvider.md b/docs/reference/cmdlets/New-IdleADIdentityProvider.md index a4bcf1e6..0f876d2e 100644 --- a/docs/reference/cmdlets/New-IdleADIdentityProvider.md +++ b/docs/reference/cmdlets/New-IdleADIdentityProvider.md @@ -28,7 +28,7 @@ The provider supports common identity operations (Create, Read, Disable, Enable, and group entitlement management (List, Grant, Revoke). Identity addressing supports: -- GUID (ObjectGuid) - pattern: \`^\[0-9a-fA-F-\]{36}$\` or N-format +- GUID (ObjectGuid) - 36 hex characters with hyphens (D-format) or 32 hex characters (N-format) - UPN (UserPrincipalName) - contains @ - sAMAccountName - default fallback diff --git a/docs/reference/cmdlets/New-IdleEntraIDIdentityProvider.md b/docs/reference/cmdlets/New-IdleEntraIDIdentityProvider.md index 3b2f798c..457a8703 100644 --- a/docs/reference/cmdlets/New-IdleEntraIDIdentityProvider.md +++ b/docs/reference/cmdlets/New-IdleEntraIDIdentityProvider.md @@ -44,7 +44,8 @@ The provider supports multiple auth session formats: By default, steps should use: - With.AuthSessionName = 'MicrosoftGraph' -- \`With.AuthSessionOptions = @{ Role = 'Admin' }\` (or other routing keys) +- With.AuthSessionOptions with routing keys, e.g. +Role = 'Admin' ## EXAMPLES diff --git a/docs/reference/cmdlets/New-IdleExchangeOnlineProvider.md b/docs/reference/cmdlets/New-IdleExchangeOnlineProvider.md index 2dee8d5c..821d9a4c 100644 --- a/docs/reference/cmdlets/New-IdleExchangeOnlineProvider.md +++ b/docs/reference/cmdlets/New-IdleExchangeOnlineProvider.md @@ -40,7 +40,8 @@ The provider supports multiple auth session formats: By default, mailbox steps should use: - With.AuthSessionName = 'ExchangeOnline' -- \`With.AuthSessionOptions = @{ Role = 'Admin' }\` (or other routing keys) +- With.AuthSessionOptions with routing keys, e.g. +Role = 'Admin' Prerequisites: - ExchangeOnlineManagement PowerShell module must be installed diff --git a/src/IdLE.Provider.AD/Public/New-IdleADIdentityProvider.ps1 b/src/IdLE.Provider.AD/Public/New-IdleADIdentityProvider.ps1 index 8fe2edac..ddc84cb1 100644 --- a/src/IdLE.Provider.AD/Public/New-IdleADIdentityProvider.ps1 +++ b/src/IdLE.Provider.AD/Public/New-IdleADIdentityProvider.ps1 @@ -11,7 +11,7 @@ function New-IdleADIdentityProvider { and group entitlement management (List, Grant, Revoke). Identity addressing supports: - - GUID (ObjectGuid) - pattern: `^[0-9a-fA-F-]{36}$` or N-format + - GUID (ObjectGuid) - 36 hex characters with hyphens (D-format) or 32 hex characters (N-format) - UPN (UserPrincipalName) - contains @ - sAMAccountName - default fallback diff --git a/src/IdLE.Provider.EntraID/Public/New-IdleEntraIDIdentityProvider.ps1 b/src/IdLE.Provider.EntraID/Public/New-IdleEntraIDIdentityProvider.ps1 index 8d4e6995..e201ce85 100644 --- a/src/IdLE.Provider.EntraID/Public/New-IdleEntraIDIdentityProvider.ps1 +++ b/src/IdLE.Provider.EntraID/Public/New-IdleEntraIDIdentityProvider.ps1 @@ -28,7 +28,7 @@ function New-IdleEntraIDIdentityProvider { By default, steps should use: - With.AuthSessionName = 'MicrosoftGraph' - - `With.AuthSessionOptions = @{ Role = 'Admin' }` (or other routing keys) + - With.AuthSessionOptions with routing keys, e.g. Role = 'Admin' .PARAMETER AllowDelete Opt-in flag to enable the IdLE.Identity.Delete capability. diff --git a/src/IdLE.Provider.ExchangeOnline/Public/New-IdleExchangeOnlineProvider.ps1 b/src/IdLE.Provider.ExchangeOnline/Public/New-IdleExchangeOnlineProvider.ps1 index 7a7e1305..c733bef5 100644 --- a/src/IdLE.Provider.ExchangeOnline/Public/New-IdleExchangeOnlineProvider.ps1 +++ b/src/IdLE.Provider.ExchangeOnline/Public/New-IdleExchangeOnlineProvider.ps1 @@ -26,7 +26,7 @@ function New-IdleExchangeOnlineProvider { By default, mailbox steps should use: - With.AuthSessionName = 'ExchangeOnline' - - `With.AuthSessionOptions = @{ Role = 'Admin' }` (or other routing keys) + - With.AuthSessionOptions with routing keys, e.g. Role = 'Admin' Prerequisites: - ExchangeOnlineManagement PowerShell module must be installed