Skip to content

WAM authentication issues with non-signed in windows account #3617

@insertacoolnamehere

Description

@insertacoolnamehere

Describe the bug

When running an iterative script, that runs cmdlets repeatedly against a large array of users/groups, I am repeatedly prompted to re-auth. The WAM window keeps appearing and asking which account I'm trying to sign in as.

Example Script:
Users = @(Array of 50 users)
ForEach (User in Users)
(
Get-MgUser -UserId $member -Property Id,UserPrincipalName,Department
)

Observations:

  • repeat auth windows every 3/4 users iterated
  • commands is noticeably slower to complete (3 seconds compared to .1 seconds in non-WAM authenticated session)
  • I am signed into windows with a productivity account and authenticating to Graph with a separate administrative account

If I downgrade to Graph 2.33, it reverts back to Browser Signin and scripts run fine/normally with no re-auth/slowness

Expected behavior

Authenticate one time when connecting to Graph. Graph cmdlets run at normal, non-WAM authentication speed.

How to reproduce

update to 2.34+ Graph versions that enforce WAM authentication.

SDK Version

2.34+

Latest version known to work for scenario above?

2.33

Known Workarounds

No response

Debug output

Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions