Skip to content

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

@heinejeppesen

Description

@heinejeppesen

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions