Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect handling of install modules causes PIM to always use DeviceCode for signing in. #57

Open
heinejeppesen opened this issue Feb 19, 2025 · 0 comments

Comments

@heinejeppesen
Copy link

heinejeppesen commented Feb 19, 2025

Hi,

Using 2.1.6, there is an error in function Install-DCMicrosoftGraphPowerShellModule where the currently installed Microsoft.Graph modules are always removed and reimported into the current PowerShell session.

This of course causes any already signed in sessions to be removed and this always forces Enable-DCEntraIDPIMRole to always request signing using Device Code - Line 1180 in the .psm1 file.

The Remove-Module should not be run here and be moved inside the "Upgrade" else if clause.

Removing the module, causes the if (!(Get-MgContext)) check in Enable-DCEntraIDPIMRole to always be true, so forces device code sign in.

With this change, connecting to Graph as a user before running Enable-DCEntraIDPIMRole works again as expected and not using Device Code auth every time.

Answer to issue #52

-Heine Jeppesen
Cloud Architect @ APENTO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant