microsoftgraph / microsoftgraph/msgraph-sdk-powershell

Get-MgUserAuthenticationMethodCount does not exists

Open
#2,834 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

dependency:metadata
Dominant language
C#
Stars
898
Forks
230
Avg merge
2d 5h
Merged PRs (30d)
31

Description

Describe the bug

Get-MgUserAuthenticationMethodCount throws 400 bad request error.
image

Is this cmdlet available? It is listed in the Microsoft Graph PowerShell documentation, which you can find here

Expected behavior

Get the current count of authentication methods registered to a user using this cmdlet Get-MgUserAuthenticationMethodCount

How to reproduce

Call Get-MgUserAuthenticationMethodCount cmdlet and it will throw 400 bad request error.

SDK Version

2.18.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output
Click to expand log ```

DEBUG: [CmdletBeginProcessing]: - Get-MgUserAuthenticationMethodCount begin processing with parameterSet 'Get'.

Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"):
DEBUG: [Authentication]: - AuthType: 'Delegated', TokenCredentialType: 'InteractiveBrowser', ContextScope: 'CurrentUser', AppName: 'Microsoft Graph Command Line Tools'.

Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"):
DEBUG: [Authentication]: - Scopes: [Application.Read.All, Application.ReadWrite.All, AppRoleAssignment.ReadWrite.All, AuditLog.Read.All, Directory.Read.All, Directory.ReadWrite.All, Domain.ReadWrite.All,
openid, Policy.Read.All, Policy.ReadWrite.ApplicationConfiguration, profile, User.Read, User.Read.All, User.ReadWrite, User.ReadWrite.All, email].

Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"):
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://graph.microsoft.com/v1.0/users/*******/authentication/methods/$count

Headers:
FeatureFlag : 00000043
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.22631; en-US),PowerShell/5.1.22621.3810
Accept-Encoding : gzip
SdkVersion : graph-powershell/2.18.0
client-request-id : 0b8ddab4-ad17-443f-a75d-03608c282faa

Body:

Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"):
DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
BadRequest

Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : decbd03a-5100-4c4f-adc8-655b87c9cc91
client-request-id : 0b8ddab4-ad17-443f-a75d-03608c282faa
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"UAE North","Slice":"E","Ring":"2","ScaleUnit":"002","RoleInstance":"DX3PEPF000000B5"}}
Date : Mon, 08 Jul 2024 11:43:57 GMT

Body:
{
"error": {
"code": "UnknownError",
"message": "{"ErrorCode":"badRequest","Message":"Resource not found for segment
'users('*********')/authentication/methods/$count'.","Target":null,"Details":null,"InnerError":null,"InstanceAnnotations":[],"TypeAnnotation":null}",
"innerError": {
"date": "2024-07-08T11:43:57",
"request-id": "decbd03a-5100-4c4f-adc8-655b87c9cc91",
"client-request-id": "0b8ddab4-ad17-443f-a75d-03608c282faa"
}
}
}

Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"):

Confirm
{"ErrorCode":"badRequest","Message":"Resource not found for segment
'users('**********')/authentication/methods/$count'.","Target":null,"Details":null,"InnerError":null,"InstanceAnnotations":[],"TypeAnnotation":null}

Status: 400 (BadRequest)
ErrorCode: UnknownError
Date: 2024-07-08T11:43:57

Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : decbd03a-5100-4c4f-adc8-655b87c9cc91
client-request-id : 0b8ddab4-ad17-443f-a75d-03608c282faa
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"UAE North","Slice":"E","Ring":"2","ScaleUnit":"002","RoleInstance":"DX3PEPF000000B5"}}
Date : Mon, 08 Jul 2024 11:43:57 GMT

[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"):
Get-MgUserAuthenticationMethodCount : {"ErrorCode":"badRequest","Message":"Resource not found for segment
'users('***********')/authentication/methods/$count'.","Target":null,"Details":null,"InnerError":null,"InstanceAnnotations":[],"TypeAnnotation":null}
Status: 400 (BadRequest)
ErrorCode: UnknownError
Date: 2024-07-08T11:43:57
Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : decbd03a-5100-4c4f-adc8-655b87c9cc91
client-request-id : 0b8ddab4-ad17-443f-a75d-03608c282faa
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"UAE North","Slice":"E","Ring":"2","ScaleUnit":"002","RoleInstance":"DX3PEPF000000B5"}}
Date : Mon, 08 Jul 2024 11:43:57 GMT
At line:1 char:1

  • Get-MgUserAuthenticationMethodCount -UserId "*********** ...
  •   + CategoryInfo          : InvalidOperation: ({ UserId = ******... , Headers =  }:<>f__AnonymousType94`4) [Get-MgUserAuthenticationMethodCount_Get], Exception
      + FullyQualifiedErrorId : UnknownError,Microsoft.Graph.PowerShell.Cmdlets.GetMgUserAuthenticationMethodCount_Get
    

DEBUG: [CmdletEndProcessing]: - Get-MgUserAuthenticationMethodCount end processing.

Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"):

</details>


### Configuration

$ $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.22621.3810
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.22621.3810
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

### Other information

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the documented Get-MgUserAuthenticationMethodCount cmdlet and reproduce the GET request to /users/{id}/authentication/methods/$count using the supplied Microsoft Graph PowerShell SDK version. Compare the documented operation with the reported 400 response and determine whether the cmdlet or its documentation needs correction; done means the documented behavior and endpoint response agree.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
api, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.