Get-MgUserAuthenticationMethod fails when AuthenticationMethodId is provided

Rafael Varela Pet 20 Reputation points
2023-01-25T11:59:01.36+00:00

Get-MgUserAuthenticationMethod fails when parameter AuthenticationMethodId is included. Works fine if only UserId is used:

Get-MgUserAuthenticationMethod -AuthenticationMethodId ******** -UserId *********

Get-MgUserAuthenticationMethod : {"Message":"No HTTP resource was found that matches the request URI 'https://mface.windowsazure.com/odata/users('****** c8f336@***********')/authentication/methods('**********')'.","MessageDetail":"No type was found that matches the controller named 'users'."}

The same happens when using de Graph Beta API Explorer:

Works fine: https://graph.microsoft.com/beta/users/{user-id]/authentication/methods

Fails: https://graph.microsoft.com/beta/users/{user-id}/authentication/methods/{authenticationMethod-id}

{
"error": {
    "code": "UnknownError",
    "message": "{\"Message\":\"No HTTP resource was found that matches the request URI 'https://mface.windowsazure.com/odata/users('**********')/authentication/methods('***********')'.\",\"MessageDetail\":\"No type was found that matches the controller named 'users'.\"}",
    "innerError": {
        "date": "2023-01-25T11:55:19",
        "request-id": "ab9c0f96-8781-4997-9e63-1296dbb4c199",
        "client-request-id": "f982707f-7cdc-db49-edfe-41bb94f556d3"
    }
}
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,273 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,595 questions
0 comments No comments
{count} votes

Accepted answer
  1. Vasil Michev 108.1K Reputation points MVP
    2023-01-25T12:19:57.3466667+00:00

    I believe this is by design. There is no Get method supported on the generic /authentication/methods point, only List: https://learn.microsoft.com/en-us/graph/api/authentication-list-methods?view=graph-rest-beta&tabs=http

    To get the details on specific method only, you need to know its type. Try for example these:

    GET https://graph.microsoft.com/v1.0/users/user@domain.com/authentication/methods

    GET https://graph.microsoft.com/v1.0/users/user@domain.com/authentication/windowsHelloForBusinessMethods

    GET https://graph.microsoft.com/v1.0/users/user@domain.com/authentication/windowsHelloForBusinessMethods/vQ-DtT1Xr4t3RVg29vrhN59PkoV93XB7Hob4cytC2tU1


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.