Skip to content

Fix and enhance PowerShell script for howto-authentication-use-email-…#1942

Open
Octavius97 wants to merge 2 commits intoMicrosoftDocs:mainfrom
Octavius97:patch-3
Open

Fix and enhance PowerShell script for howto-authentication-use-email-…#1942
Octavius97 wants to merge 2 commits intoMicrosoftDocs:mainfrom
Octavius97:patch-3

Conversation

@Octavius97
Copy link
Copy Markdown

Refactored and corrected the PowerShell script referenced in howto-authentication-use-email-signin.md to ensure accurate attribute usage, optimized property retrieval, and comprehensive user export coverage.

Fix list:

  • Optimized property retrieval: Added the -Property parameter to the Get-MgUser cmdlet call to explicitly request only the necessary attributes, reducing unnecessary data overhead and improving query efficiency.

  • Corrected sync status evaluation: Updated the filtering logic in the Where-Object sections to properly identify synced vs. cloud-only users by leveraging the OnPremisesSyncEnabled attribute, replacing the previously used ImmutableId attribute which is not correct.

  • Expanded export coverage: Fixed the export query logic to correctly capture both on-premises synced users and cloud-only users, ensuring no affected accounts are excluded from the exported dataset.

  • Improved export property labeling: Enhanced the Select-Object section in the Export block to include the ProxyAddresses property and expose the OnPremisesSyncEnabled attribute, providing clearer and more actionable output for administrators reviewing the exported data.

…signin.md

Refactored and corrected the PowerShell script referenced in howto-authentication-use-email-signin.md to ensure accurate attribute usage, optimized property retrieval, and comprehensive user export coverage.

Fix list:
- **Optimized property retrieval:** Added the `-Property` parameter to the `Get-MgUser` cmdlet call to explicitly request only the necessary attributes, reducing unnecessary data overhead and improving query efficiency.

- **Corrected sync status evaluation:** Updated the filtering logic in the `Where-Object` sections to properly identify synced vs. cloud-only users by leveraging the `OnPremisesSyncEnabled` attribute, replacing the previously used `ImmutableId` attribute which is not correct.

- **Expanded export coverage:** Fixed the export query logic to correctly capture both on-premises synced users and cloud-only users, ensuring no affected accounts are excluded from the exported dataset.

- **Improved export property labeling:** Enhanced the `Select-Object` section in the **Export block** to include the `ProxyAddresses` property and expose the `OnPremisesSyncEnabled` attribute, providing clearer and more actionable output for administrators reviewing the exported data.
@prmerger-automator
Copy link
Copy Markdown
Contributor

@Octavius97 : Thanks for your contribution! The author(s) and reviewer(s) have been notified to review your proposed change.

@learn-build-service-prod
Copy link
Copy Markdown
Contributor

Learn Build status updates of commit 8f405be:

✅ Validation status: passed

File Status Preview URL Details
docs/identity/authentication/howto-authentication-use-email-signin.md ✅Succeeded

For more details, please refer to the build report.

@ttorble ttorble requested a review from Copilot April 7, 2026 14:26
@ttorble
Copy link
Copy Markdown
Contributor

ttorble commented Apr 7, 2026

@Justinha

Can you review the proposed changes?

IMPORTANT: When the changes are ready for publication, adding a #sign-off comment is the best way to signal that the PR is ready for the review team to merge.

#label:"aq-pr-triaged"
@MicrosoftDocs/public-repo-pr-review-team

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the PowerShell example in the email sign-in troubleshooting section to use Microsoft Graph user properties more accurately when detecting UPN/proxyAddress conflicts between synced and cloud-only users.

Changes:

  • Requests a specific set of user attributes via Get-MgUser -Property to limit returned data.
  • Switches synced-vs-cloud-only detection to OnPremisesSyncEnabled instead of ImmutableId.
  • Adjusts the CSV export shape and adds proxy address formatting.

Changed the `ImmutableId` attribute in the `Select-Object` section to use the correct attribute `OnPremisesImmutableId` instead.
@learn-build-service-prod
Copy link
Copy Markdown
Contributor

Learn Build status updates of commit 9af263e:

✅ Validation status: passed

File Status Preview URL Details
docs/identity/authentication/howto-authentication-use-email-signin.md ✅Succeeded

For more details, please refer to the build report.

Copy link
Copy Markdown
Author

@Octavius97 Octavius97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the attributes to use the OnPremisesImmutableId attribute

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants