Conversation
Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
…t context Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
…est expectations Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
blindzero
left a comment
There was a problem hiding this comment.
@copilot I am missing changed / enhanced / improved docs and examples;
do we also need to enhance steps? or is that fully included in existing identity steps?
…ensive password generation docs and examples Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Added comprehensive documentation and examples: Documentation (provider-ad.md):
Examples:
Steps: No changes needed - existing |
blindzero
left a comment
There was a problem hiding this comment.
@copilot please check and make sure it is also available to entra id identitycreation, not only ad
…nd remove separate file Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Entra ID provider already includes automatic password generation - it generates a random GUID as the initial password (line 478 in
The AD provider's policy-aware generation is specific to on-premises AD where policy can be queried. Entra ID doesn't expose tenant password policy via Graph API, so the GUID approach is the standard pattern for Entra ID provisioning. |
blindzero
left a comment
There was a problem hiding this comment.
@copilot regarding EntraID Provider we need some generation with output as well. Otherwise even with change on first login, the user cant login as we dont know the initial password.
Can you also explain in detailed how the policy awareness in AD provider is realized? I couldn't find a specific function for this.
…plaintext option Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Entra ID Password Output: Added password generation output for Entra ID provider. Now returns:
This enables administrators to communicate the initial password to users. (0fa017a) AD Policy Awareness Implementation: The policy awareness is in
Called from AD adapter The |
blindzero
left a comment
There was a problem hiding this comment.
@copilot please also update entra id docs + add tests for the behavior
Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Entra ID Documentation: Updated
Entra ID Tests: Added 8 new password generation tests covering:
All 52 Entra ID provider tests passing. (81c0f80) |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Pull request overview
This PR adds automatic initial password generation to the AD and Entra ID identity providers, with “controlled output” so callers can retrieve a protected form by default and opt into plaintext only when explicitly requested.
Changes:
- AD: Introduces
New-IdleADPassword(policy-aware with fallback) and wires auto-generation into the AD adapter/provider when creating enabled accounts without a provided password. - Entra ID: Adds GUID-based password generation when
PasswordProfileis omitted, plus controlled output andForceChangePasswordNextSignInhandling. - Core/Docs/Examples/Tests: Expands redaction keys for generated password fields, updates provider docs and workflow template, and adds provider-level Pester tests.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Providers/EntraIDIdentityProvider.Tests.ps1 | Adds Pester coverage for Entra ID password generation and controlled output. |
| tests/Providers/ADIdentityProvider.Tests.ps1 | Adds Pester coverage for AD password generation trigger + controlled output behavior in provider tests. |
| src/IdLE.Provider.EntraID/Public/New-IdleEntraIDIdentityProvider.ps1 | Implements GUID password generation + result output controls + metadata. |
| src/IdLE.Provider.AD/Public/New-IdleADIdentityProvider.ps1 | Plumbs password generation config into adapter creation and surfaces generated password output + metadata. |
| src/IdLE.Provider.AD/Private/New-IdleADPassword.ps1 | New AD password generator that attempts domain policy read with configurable fallback rules. |
| src/IdLE.Provider.AD/Private/New-IdleADAdapter.ps1 | Adds auto-generation path when enabled and no password is provided; supports ResetOnFirstLogin. |
| src/IdLE.Provider.AD/Private/Get-IdleADAttributeContract.ps1 | Extends AD CreateIdentity attribute contract for ResetOnFirstLogin and AllowPlainTextPasswordOutput. |
| src/IdLE.Core/Private/Copy-IdleRedactedObject.ps1 | Adds redaction keys for generated password fields to reduce accidental leakage in logs/exports/events. |
| examples/workflows/templates/ad-joiner-complete.psd1 | Documents/illustrates password auto-generation and reveal path in the AD joiner workflow template. |
| docs/reference/providers/provider-entraID.md | Documents Entra ID GUID password generation, output controls, reveal path, and reset behavior. |
| docs/reference/providers/provider-ad.md | Documents AD policy-aware generation, fallback configuration, output controls, reveal path, and reset behavior. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…al character set Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
AD user creation fails in domains with password policies when no password is provided. Onboarding workflows need initial passwords but unconditional plaintext output risks leaking secrets into logs/artifacts.
Changes
Password Generation (
New-IdleADPassword- AD Provider)Get-ADDefaultDomainPasswordPolicyfor domain requirementsPassword Generation (Entra ID Provider)
ForceChangePasswordNextSignInattribute (default:$true)Adapter Integration
Enabled = $trueand noAccountPassword/AccountPasswordAsPlainTextprovidedResetOnFirstLogin(AD) /ForceChangePasswordNextSignIn(Entra ID) attributes (defaults$true, overridable to$false)Controlled Output (Both Providers)
GeneratedAccountPasswordProtected(DPAPI-scoped ProtectedString) + metadataAllowPlainTextPasswordOutput = $trueaddsGeneratedAccountPasswordPlainTextPasswordGenerated,PasswordGenerationPolicyUsed(AD) orPasswordGenerationMethod(Entra ID)Configuration (AD Provider)
Provider accepts fallback parameters:
PasswordGenerationFallbackMinLength,PasswordGenerationRequire{Upper,Lower,Digit,Special},PasswordGenerationSpecialCharSetDocumentation & Examples
docs/reference/providers/provider-ad.md:docs/reference/providers/provider-entraID.md:ForceChangePasswordNextSignIn)ad-joiner-complete.psd1with inline comments showing:AllowPlainTextPasswordOutput,ResetOnFirstLogin)Example (works for both AD and Entra ID providers)
Testing
New-IdleADPasswordfunction intests/Providers/New-IdleADPassword.Tests.ps1covering:tests/Core/Copy-IdleRedactedObject.Tests.ps1to ensureGeneratedAccountPasswordPlainTextandGeneratedAccountPasswordProtectedare properly redacted in nested structures. All 12 redaction tests passing.Original prompt
This section details on the original issue you should resolve
<issue_title>AD Provider: Generate initial policy-aware password and support controlled output</issue_title>
<issue_description>## Problem Statement
For AD joiner workflows, IdLE must be able to create and enable accounts in domains with password policies (length/complexity/history). If no password is supplied, user creation/enabling may fail with domain policy errors.
Additionally, onboarding often requires a human-readable initial password. Returning plaintext unconditionally is dangerous because results/events may be persisted, exported, or logged.
Goal:
Proposed Solution
1) Policy-aware password generation (with fallback)
When creating an AD user and no password input is provided (see Issue #1), and the account is requested to be enabled:
Get-ADDefaultDomainPasswordPolicy.SecureStringand set viaNew-ADUser -AccountPassword(or set password immediately after creation, depending on existing adapter behavior).2) Enable handling when password is missing
If no password input is provided and generation is disabled/unavailable:
Enabledis not explicitly$true, ensure the account is created disabled (Enabled = $falseor do not pass Enabled).Enabled = $trueis explicitly requested and no password can be set/generated: fail fast with a clear error.3) Reset on first login (must be overridable)
Introduce/standardize
With.ResetOnFirstLogin:$true(when a password is set or generated)$false(e.g., hybrid remote login scenarios)Map this to AD semantics (e.g., “User must change password at next logon”).
4) Controlled password output and reveal path
4.1 Default output (no plaintext)
By default, do not return plaintext in results/events.
Instead, always include a ProtectedString representation for reveal use:
GeneratedAccountPasswordProtected= output ofConvertFrom-SecureString(created in the execution context)This is a secret and must be redacted from logs/exports.
4.2 Explicit plaintext output (opt-in)
If and only if
With.AllowPlainTextPasswordOutput = $true:GeneratedAccountPasswordPlainTextin the result for that step.Guardrails:
4.3 Reveal path (when plaintext output is not enabled)
Document a supported reveal workflow:
5) Documentation (mandatory)
Update AD Provider documentation and examples:
Alternatives Considered
Always return plaintext.
Require a secret store capability first.
Impact
Does this affect existing workflows?
Any backward compatibility concerns?
With.*knobs, and improved defaults.Additional Context
Acceptance Criteria
Get-ADDefaultDomainPasswordPolicy; fallback used if unavailable.With.ResetOnFirstLogin:$truewhen password is set/generated$falseoverrideWith.AllowPlainTextPasswordOutput = $true.Configuration (fallback)
Provider config supports fallback generation rules, e.g.:
PasswordGenerationFallbackMinLength = 24PasswordGenerationRequireUpper = truePasswordGenerationRequireLower = true💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.