Skip to content

Invoke-MgGraphRequest can't handle URI with # #1947

@julmsy

Description

@julmsy

Hello,

I would like to use the Invoke-MgGraphRequest cmdlet to request Guest users. Guest users' UPN contains '#' characters.
Example: first.last_foo.com#EXT#@contoso.onmicrosoft.com

$upn = first.last_foo.com#EXT#@contoso.onmicrosoft.com
Invoke-MgGraphRequest -Method GET -Uri https://graph.microsoft.com/beta/users/$upn
Invoke-MgGraphRequest : GET https://graph.microsoft.com/beta/users/first.last_foo.com
HTTP/1.1 404 Not Found

If I request the same URI on MS Graph Explorer, it works well.
It seems that Invoke-MgGraphRequest cut the URI at the first '#' character.

I've tried different variations, but issue persists:

Invoke-MgGraphRequest -Method GET -Uri "https://graph.microsoft.com/beta/users/$upn"
$uri = 'https://graph.microsoft.com/beta/users/first.last_foo.com#EXT#@contoso.onmicrosoft.com'
Invoke-MgGraphRequest -Method GET -Uri $uri

Could you please have a check and fix it?

Module version tested: 1.20.0 and 1.25.0.

Best,
julmsy

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions