microsoftgraph / msgraph-sdk-powershell

Powershell SDK for Microsoft Graph
https://www.powershellgallery.com/packages/Microsoft.Graph
Other
691 stars 165 forks source link

Too many retries performed when using cmdlets #2534

Closed nickp85 closed 7 months ago

nickp85 commented 8 months ago

Thanks for reporting the bug. Please ensure you've gone through the following checklist before opening an issue:

Describe the bug Using Invoke-MgGraphRequest to make custom Graph requests to query devices in Intune. Has been working for years and within the last week, the requests are returning "Too many retries performed". I have tried to change the retry count or retry delay but nothing has helped. Eventually I started getting "task has been canceled" instead of "too many retries performed". The issue occurs the same with v1.0 or beta API. I use the beta API since that matches what Microsoft uses for the production Intune console (why I don't know).

The API chunks the response into 1000 at a time so the error is random. Sometimes it's immediate, other times it takes 3-4 runs of the while loop for it to fail

To Reproduce Steps to reproduce the behavior:

  1. Connect to MgGraph
  2. Execute this code to grab all of our devices
    
    # Graph API version and call to make
    $graphApiVersion = "beta"
    $Resource = "deviceManagement/managedDevices"
    $filter = "`?`$filter=managementAgent eq 'mdm' or managementAgent eq 'easmdm'"

API call URI

$uri = "https://graph.microsoft.com/$graphApiVersion/$Resource$filter"

Make the API call using HTTP GET with the token in the header

$DevicesResponse = (Invoke-MgGraphRequest Get -Uri $uri -OutputType PSObject)

Store the response

$devices = $DevicesResponse.value

Get all the devices over 1000

$DevicesNextLink = $DevicesResponse."@odata.nextLink" While ($null -ne $DevicesNextLink) {
$DevicesResponse = (Invoke-MgGraphRequest Get -Uri $DevicesNextLink -OutputType PSObject) $DevicesNextLink = $DevicesResponse."@odata.nextLink" $devices += $DevicesResponse.value }


4. See error returned
Invoke-MgGraphRequest : Too many retries performed

**Expected behavior**
The device data is put into the $devices variable

**Debug Output**
> Run the problematic command with `-Debug` and paste the resulting debug stream below.
> ⚠ ATTENTION: Be sure to remove any sensitive information that may be in the logs.

DEBUG: GET 
/beta/deviceManagement/managedDevices?$filter=managementAgent+eq+%27mdm%27+or+managementAgent+eq+%27easmdm%27&$skiptoken=LastDeviceName%3d%27Ben%25e2%2580%2599s%2520iPhone%27%2cLast 
DeviceId%3d%27e230406f-f8ef-4dac-8eb1-f352c2b7ec63%27 HTTP/1.1
HTTP: graph.microsoft.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Microsoft Windows 10.0.19045; en-US) PowerShell/2024.0.0 Invoke-MgGraphRequest

Confirm
Continue with this operation?
[Y] Yes  [A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help (default is "Y"): y
Invoke-MgGraphRequest : Too many retries performed
At line:4 char:25
+ ... Response = (Invoke-MgGraphRequest Get -Uri $DevicesNextLink -OutputTy ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Invoke-MgGraphRequest], InvalidOperationException
    + FullyQualifiedErrorId : NotSpecified,Microsoft.Graph.PowerShell.Authentication.Cmdlets.InvokeMgGraphRequest

**Module Version**
> Please run `Get-Module Microsoft.Graph*` after cmdlet execution and paste the output below.
> If a module cannot be installed or imported, please run `Get-Module -ListAvailable` and paste the output.
ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     2.11.1     Microsoft.Graph.Authentication      {Add-MgEnvironment, Connect-MgGraph, Disconnect-MgGraph, Get-MgContext...}

**Environment Data**
> Please run `$PSVersionTable` and paste the output below. If running the Docker container image, indicate the tag of the image used and the version of Docker engine.

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

**Screenshots**
> If applicable, add screenshots to help explain your problem.

**Additional context**
> Add any other context about the problem here.
SeniorConsulting commented 8 months ago

Hi Nickp85,

If I may ask a simple question: Is there a reason you aren't using something like: $Devices = Get-MgBetaDeviceManagementManagedDevice -filter "managementAgent eq 'mdm' or managementAgent eq 'easmdm'" -all

nickp85 commented 8 months ago

Hi Nickp85,

If I may ask a simple question:

Is there a reason you aren't using something like:

$Devices = Get-MgBetaDeviceManagementManagedDevice -filter "managementAgent eq 'mdm' or managementAgent eq 'easmdm' -all"

The script is years old and it was easier to change from Invoke-RestMethod to Invoke-MgGraphRequest since I already had all the other code laid out to make the requests

SeniorConsulting commented 8 months ago

Fair enough. I agree that there was a time before the SDK came into existence. It wasn't terribly fun managing access tokens, REST requests and such.

However, I would try to steer you toward using the cmdlet above, as it'll take care of the (1000) chunking for you, step off when it comes to the HTTP 429 responses for as long as it takes etc. Hopefully that single string should be able to replace all of the code you've posted above, which should make support/maintenance a little easier too.

nickp85 commented 8 months ago

Fair enough. I agree that there was a time before the SDK came into existence. It wasn't terribly fun managing access tokens, REST requests and such.

However, I would try to steer you toward using the cmdlet above, as it'll take care of the (1000) chunking for you, step off when it comes to the HTTP 429 responses for as long as it takes etc. Hopefully that single string should be able to replace all of the code you've posted above, which should make support/maintenance a little easier too.

Is the output identical to what I'm getting today? A JSON output?

SeniorConsulting commented 8 months ago

It'll be in a PSObject form (System.Array).

image

From the text you posted above, it looked as though you were interested in returning PSObjects too.

$DevicesResponse = (Invoke-MgGraphRequest Get -Uri $uri -OutputType PSObject)

However, if you must return this in JSON, you could do something like:

$Devices = Get-MgBetaDeviceManagementManagedDevice -filter "managementAgent eq 'mdm' or managementAgent eq 'easmdm'" -all
$JSON = $Devices | ConvertTo-JSON -Depth 5

However, I am only able to see the information you've supplied, and I lack the full context of what you're doing. I can only recommend that you give the read-only cmdlets a whirl to experiment with.

nickp85 commented 8 months ago

You're right, I have PSObject and convert to JSON later

It's also been said I should try the "export APIs"?

nickp85 commented 8 months ago

It'll be in a PSObject form (System.Array).

image

From the text you posted above, it looked as though you were interested in returning PSObjects too.

$DevicesResponse = (Invoke-MgGraphRequest Get -Uri $uri -OutputType PSObject)

However, if you must return this in JSON, you could do something like:

$Devices = Get-MgBetaDeviceManagementManagedDevice -filter "managementAgent eq 'mdm' or managementAgent eq 'easmdm'" -all
$JSON = $Devices | ConvertTo-JSON -Depth 5

However, I am only able to see the information you've supplied, and I lack the full context of what you're doing. I can only recommend that you give the read-only cmdlets a whirl to experiment with.

unfortunately the different cmdlet did not work either.

$devices = Get-MgBetaDeviceManagementManagedDevice -filter "managementAgent eq 'mdm' or managementAgent eq 'easmdm'" -all -debug

Get-MgBetaDeviceManagementManagedDevice : One or more errors occurred. At line:1 char:1

nickp85 commented 8 months ago

Running again I again get the retries error

Get-MgBetaDeviceManagementManagedDevice : Too many retries performed At line:1 char:1

SeniorConsulting commented 8 months ago

Wow, that's a little surprising. I'm not sure I've got the right questions to ask to continue this. It does sound like a Graph API based problem, rather than the SDK - but I can't be certain. I'm not convinced whether running your cmdlet with a debug command would be of use either, because it sounds like it collects several iterations (pages of 1000), before failing.

I'll leave this for someone else to pick up and point you in the right direction, but I'll keep tabs on this just in case. A piece of advice I have here is to jump on over to the Graph API support location and raise the same over there. If the SDK devs determine that it's an API service issue, you'll have a head start on that ticket. The API support links can be found here: https://developer.microsoft.com/en-us/graph/support

Nohvah22 commented 7 months ago

I opened a case yesterday for the same exact issue and I am leveraging 'Get-MgBetaDeviceManagementManagedDevice'. I have operational scripts that rely on it that have been working for a year and this week they are all failing consistently. This occurs with Graph Powershell v1.0 and beta. Also, I have no issues pulling back user and device objects with 'get-MgUser' and 'get-mgdevice'... this seems to be only affecting the managed device space (Intune devices). You're not alone in this and I have heard nothing from Microsoft yet. I provided them my debug output as well.

Underdoge commented 7 months ago

Having the same issue but with the non-Beta cmdlet Get-MgDeviceManagementManagedDevice.

gmenziesint commented 7 months ago

Similar issue - Started happening around the 21st / 22nd of Jan, we've had this runbooks for well over six months with no issues until this.

$devices=Get-MgBetaDeviceManagementManagedDevice -Filter "(OperatingSystem eq 'Android' and OperatingSystem eq 'iOS')" -All
Get-MgBetaDeviceManagementManagedDevice_List: Too many retries performed
Nohvah22 commented 7 months ago

That is the exact behavior I get and my case is ongoing with no further details unfortunately.

CBSDNetworkTeam commented 7 months ago

I also have the exact same issue i have operation scripts that run the Get-MgDeviceManagementManagedDevice -All command. they worked fine upto 1/17/24 on 1/18/24 this command started only pulling 2000 results. when it used to pull 19000+ results.

Get-MgDeviceManagementManagedDevice : Too many retries performed At line:1 char:1

using the old intune powershell module i get this error when i run Get-IntuneManagedDevice | Get-MSGraphAllPages command:

Get-MSGraphNextPage : 504 Gateway Timeout

My Code has not changed. this has worked fine for many months.

I put in a ticket with Microsoft and it hasnt received much response.

Clawz2k commented 7 months ago

Getting the same issue.

Tried the following with Graph Explorer: https://graph.microsoft.com/v1.0/deviceManagement/managedDevices responds fine.

https://graph.microsoft.com/v1.0/deviceManagement/managedDevices?$filter=operatingSystem eq 'iOS' fails with the following error: { "error": { "code": "UnknownError", "message": "{\"Message\":\"{\ \\"_version\\": 3,\ \\"Message\\": \\"An error has occurred - Operation ID (for customer support): 00000000-0000-0000-0000-000000000000 - Activity ID: ee4e1210-b639-2562-b4b7-73b928aba827 - Url: https://fef.msua01.manage.microsoft.com/TrafficGateway/TrafficRoutingService/DeviceFE/StatelessDeviceFEService/deviceManagement/managedDevices?api-version=2023-07-04&$filter=operatingSystem+eq+%27iOS%27\\",\ \\"CustomApiErrorPhrase\\": \\"\\",\ \\"RetryAfter\\": null,\ \\"ErrorSourceService\\": \\"\\",\ \\"HttpHeaders\\": \\"{}\\"\}\"}", "innerError": { "date": "2024-01-26T17:40:50", "request-id": "8b54afd8-d0bf-49b7-8766-93c2edd00af3", "client-request-id": "ee4e1210-b639-2562-b4b7-73b928aba827" } } }

Microsoft has given us an workaround of using the export API to get the data, but would want to know when this issue has been resolved. https://learn.microsoft.com/en-us/mem/intune/fundamentals/reports-export-graph-apis

Sample of the code I'm using for the time being.

$Body = @"
{
    "reportName": "Devices",
    "filter":"(CategoryName eq 'UK' or CategoryName eq 'Ireland')",
    "localizationType": "LocalizedValuesAsAdditionalColumn",
    "format": "json",
    "select": [
        "DeviceId",
        "ReferenceId",
        "DeviceName",
        "OSVersion",
        "LastContact",
        "CompliantState",
        "UPN",
        "SerialNumber",
        "UserName",
        "UserEmail",
        "Model",
        "OS"
    ]
}
"@
$ID = (Invoke-MSGraphRequest -Url "/deviceManagement/reports/exportJobs" -HttpMethod POST -Content $Body).id
Sleep 15
$Status = Invoke-MSGraphRequest -Url "/deviceManagement/reports/exportJobs/$ID" -HttpMethod GET
While ($Status.status -ne "completed") {
    Sleep 30
    $Status = Invoke-MSGraphRequest -Url "/deviceManagement/reports/exportJobs/$ID" -HttpMethod GET
}
Invoke-WebRequest $Status.url -OutFile Temp.zip
Sleep 15
Expand-Archive Temp.zip -DestinationPath .
Sleep 15
$Devices = (Get-Content "$($ID).json" | ConvertFrom-Json).values | Where-Object {$_.OS -like "iOS*"} | Select-Object @{N='id';E={$_.DeviceId}},@{N='azureADDeviceId';E={$_.ReferenceId}},DeviceName,OSVersion,@{N='lastSyncDateTime';E={[datetime]$_.LastContact}},@{N='complianceState';E={$_.CompliantState}},@{N='userPrincipalName';E={$_.UPN}},SerialNumber,@{N='userDisplayName';E={$_.UserName}},Model,@{N='emailAddress';E={$_.UserEmail}} | Where-Object {$_.azureADDeviceID -ne "00000000-0000-0000-0000-000000000000"}
Remove-Item Temp.zip
Remove-Item "$($ID).json"
tkalligo commented 7 months ago

I am having the same problem with Get-MgDeviceManagementDeviceCompliancePolicyDeviceStatus. I've tried various maxretry values and various pagesizes between 100 and 999 but it did not make a difference. This code has been running since May of 2023 and started having this problem on 1/26. If I try the same query in graph explorer, it errors as well with a generic error.

{ "error": { "code": "UnknownError", "message": "", "innerError": {

jcahudson commented 7 months ago

Just tossing another hat in the ring here. I am having the same issue with a script that deletes a list of mobile devices from a CSV in Intune. This script was updated for the new MSGraph module syntax last year, and I noticed it had stopped working on 1/25.

In said script, I pull a list of devices from Intune by running Get-MgDeviceManagementManagedDevice -All then piping that output into a CSV. When that code is run, the following error is shown: Get-MgDeviceManagementManagedDevice : Too many retries performed

I have tried running the above command with a -Debug added to see what it is doing. I can see it querying devices, but after going through a number of them it stops and errors out. I also tried setting the maximum retries to 10 using Set-MgRequestContext -MaxRetry 10 but no change.

Briggidy commented 7 months ago

I'm also hitting this, but found there is a service advisory

Some admins are unable to utilize the Graph API to fetch Microsoft Intune user devices. IT711139, Last updated: Jan 31, 2024, 8:03 AM EST Estimated start time: Jan 18, 2024, 5:58 AM EST

CBSDNetworkTeam commented 7 months ago

I'm also hitting this, but found there is a service advisory

Some admins are unable to utilize the Graph API to fetch Microsoft Intune user devices. IT711139, Last updated: Jan 31, 2024, 8:03 AM EST Estimated start time: Jan 18, 2024, 5:58 AM EST

can you link directly to the service advisory? i cannot find it anywhere.

Underdoge commented 7 months ago

I'm also hitting this, but found there is a service advisory Some admins are unable to utilize the Graph API to fetch Microsoft Intune user devices. IT711139, Last updated: Jan 31, 2024, 8:03 AM EST Estimated start time: Jan 18, 2024, 5:58 AM EST

can you link directly to the service advisory? i cannot find it anywhere.

https://admin.microsoft.com/AdminPortal/home#/servicehealth/:/alerts/IT711139/undefined

timayabi2020 commented 7 months ago

Hi @nickp85, after doing some investigations, It would be best to log this issue with the service owner. For API related issues/questions we are not best placed to give an answer. Kindly raise an issue here https://developer.microsoft.com/en-us/graph/support so that the API owner can respond to it.

Nohvah22 commented 7 months ago

As of today, my case has been open for two weeks, been escalated to the Intune product group and no details have been provided on the status on their end. Thank goodness our users can still enroll and check in, but our operational automation has been busted since 1/14.

Briggidy commented 7 months ago

@Underdoge https://admin.microsoft.com/Adminportal/Home?#/servicehealth/:/alerts/IT711139

the latest status:

Current status: We're continuing to observe and check our applied scale optimizations and monitoring telemetry enhancements, however, due to the complexity of the issue, this is taking longer than expected to produce a timeline for mitigation.

Start time: Monday, January 15, 2024 at 10:00 AM EST

Root cause: The Microsoft Graph API is experiencing timeout issues, which is causing affected admins to see failed queries that indicate too many retries have been performed.

Next update by: Friday, February 2, 2024 at 1:00 PM EST

nkasco commented 7 months ago

@Underdoge https://admin.microsoft.com/Adminportal/Home?#/servicehealth/:/alerts/IT711139

the latest status:

Current status: We're continuing to observe and check our applied scale optimizations and monitoring telemetry enhancements, however, due to the complexity of the issue, this is taking longer than expected to produce a timeline for mitigation.

Start time: Monday, January 15, 2024 at 10:00 AM EST

Root cause: The Microsoft Graph API is experiencing timeout issues, which is causing affected admins to see failed queries that indicate too many retries have been performed.

Next update by: Friday, February 2, 2024 at 1:00 PM EST

It seems this might be affecting some WUfB DS Driver related queries too, that then also manifest themselves as never ending syncs in Intune.

It is related to this resource in my case: https://learn.microsoft.com/en-us/graph/api/resources/windowsupdates-applicablecontent?view=graph-rest-beta

Which is called via: https://learn.microsoft.com/en-us/graph/api/windowsupdates-deploymentaudience-get?view=graph-rest-beta&tabs=http

Perhaps on the backend the APIs are using the get devices queries, but regardless this too manifests itself with the "Invoke-MgGraphRequest : Too many retries performed" error

It does seem to have to do with some level of record count, as this happens in multiple tenants, but only with policies with around 25+ devices in them. The policies with only a few devices seem to work as expected.

Nohvah22 commented 7 months ago

As of two hours ago, service has been restored if you want to test.

nkasco commented 7 months ago

As of two hours ago, service has been restored if you want to test.

Thanks for the info, just retried and still seems to be an issue for me. Retries are set to 5.

CBSDNetworkTeam commented 7 months ago

As of two hours ago, service has been restored if you want to test.

Thanks for the info, just retried and still seems to be an issue for me. Retries are set to 5.

i just tested Get-MgDeviceManagementManagedDevice -all. It initially stalled. then i opened a new powershell console window, authenticated and ran the command again and its pulling 20k+ records without issues now. its very slow though.

nickp85 commented 7 months ago

It appears Microsoft made some adjustments to the API and it is now pulling back all records without error.

ericohlin commented 7 months ago

Observation... they changed the pagination limit from 1,000 results to 500 per page.

CBSDNetworkTeam commented 7 months ago

Observation... they changed the pagination limit from 1,000 results to 500 per page.

Well that explains why this happened. why would they put this limit in? it makes this command run crazy slow now. So before if I had 20k Intune devices I could complete it iterating through 20 pages of 1000 results. Now it has to run iterating through 40 pages. running the "get next page" command every time and waiting for a response. it also ignores the "-PageSize 999" and only gives you 500 results.

tkalligo commented 5 months ago

Did anyone see this problem start happening again? It started again on my side two days ago without any changes. It's been fine since it "disappeared" early Feb.

Nohvah22 commented 5 months ago

Did anyone see this problem start happening again? It started again on my side two days ago without any changes. It's been fine since it "disappeared" early Feb.

I'm so sorry, I am not seeing it right now. Just ran my scripts successfully. I saw it ONE time last Wednesday... just one time and ran fine a second time. If it's consistent for you, definitely open a case.

ericohlin commented 5 months ago

Did anyone see this problem start happening again? It started again on my side two days ago without any changes. It's been fine since it "disappeared" early Feb.

Same as @Nohvah22. I saw it a few times last week, "504 Gateway Timeout", but it went away and hasn't returned.

TheKrisSodroski commented 3 months ago

Received this today with a rather innocuous command. I assume the service is just down temporarily?

Get-MgIdentityGovernancePrivilegedAccessGroupEligibilityScheduleRequest -Filter "status eq 'Provisioned'" -Debug
DEBUG: [CmdletBeginProcessing]: - Get-MgIdentityGovernancePrivilegedAccessGroupEligibilityScheduleRequest begin       
processing with parameterSet 'List'.

Confirm
Continue with this operation?
[Y] Yes  [A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help (default is "Y"): a
DEBUG: [Authentication]: - AuthType: 'Delegated', TokenCredentialType: 'InteractiveBrowser', ContextScope:
'CurrentUser', AppName: 'Microsoft Graph Command Line Tools'.
DEBUG: [Authentication]: - Scopes: [Application.ReadWrite.All, Directory.AccessAsUser.All, Directory.ReadWrite.All,   
Group.Read.All, Group.ReadWrite.All, GroupMember.Read.All, GroupMember.ReadWrite.All, Mail.Send, Mail.Send.Shared,    
openid, PrivilegedAccess.Read.AzureADGroup, PrivilegedAccess.ReadWrite.AzureADGroup,
PrivilegedEligibilitySchedule.Read.AzureADGroup, PrivilegedEligibilitySchedule.ReadWrite.AzureADGroup, profile,       
RoleManagement.ReadWrite.Directory, RoleManagementPolicy.Read.AzureADGroup,
RoleManagementPolicy.ReadWrite.AzureADGroup, User.Read, User.Read.All, User.ReadWrite.All, email].
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://graph.microsoft.com/v1.0/identityGovernance/privilegedAccess/group/eligibilityScheduleRequests?$filter=status 
 eq 'Provisioned'

Headers:
FeatureFlag                   : 00000043
Cache-Control                 : no-store, no-cache
User-Agent                    : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.22621;
en-US),PowerShell/5.1.22621.2506
Accept-Encoding               : gzip
SdkVersion                    : graph-powershell/2.12.0
client-request-id             : 8bb86b2a-135c-4d84-980e-f4b7091403d2

Body:

DEBUG: [CmdletException]: Received exception with message 'InvalidOperationException - Too many retries performed :  
  at Microsoft.Kiota.Http.HttpClientLibrary.Middleware.RetryHandler.<SendRetryAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Kiota.Http.HttpClientLibrary.Middleware.RetryHandler.<SendAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Kiota.Http.HttpClientLibrary.Middleware.CompressionHandler.<SendAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Graph.PowerShell.Authentication.Handlers.AuthenticationHandler.<SendAsync>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at
Microsoft.Graph.PowerShell.IdentityGovernance.<IdentityGovernancePrivilegedAccessGroupListEligibilityScheduleRequest_ 
Call>d__3865.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at
Microsoft.Graph.PowerShell.IdentityGovernance.<IdentityGovernancePrivilegedAccessGroupListEligibilityScheduleRequest_ 
Call>d__3865.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at
Microsoft.Graph.PowerShell.IdentityGovernance.<IdentityGovernancePrivilegedAccessGroupListEligibilityScheduleRequest> 
d__3863.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at
Microsoft.Graph.PowerShell.Cmdlets.GetMgIdentityGovernancePrivilegedAccessGroupEligibilityScheduleRequest_List.<Proce 
ssRecordAsync>d__80.MoveNext()'

Confirm
Too many retries performed
[Y] Yes  [A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help (default is "Y"): a
EmilienCourt commented 3 months ago

Hi,

I'm getting this exact issue when calling New-MgBetaSecurityAuditLogQuery.

New-MgBetaSecurityAuditLogQuery -FilterStartDateTime $startDate -FilterEndDateTime $endDate -DisplayName "test" -ErrorAction Stop -Verbose -Debug
DEBUG: [CmdletBeginProcessing]: - New-MgBetaSecurityAuditLogQuery begin processing with parameterSet 'CreateExpanded'.
DEBUG: [Authentication]: - AuthType: 'AppOnly', TokenCredentialType: 'ClientCertificate', ContextScope: 'Process', AppName: '<REDACTED>'.
DEBUG: [Authentication]: - Scopes: [AuditLogsQuery.Read.All, AuditLog.Read.All].

Confirm
Are you sure you want to perform this action?
Performing the operation "New-MgBetaSecurityAuditLogQuery_CreateExpanded" on target "Call remote 'POST /security/auditLog/queries' operation".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): Y
DEBUG: [CmdletException]: Received exception with message 'InvalidOperationException - Too many retries performed :    at Microsoft.Kiota.Http.HttpClientLibrary.Middleware.RetryHandler.SendRetryAsync(HttpResponseMessage response, RetryHandlerOption retryOption, CancellationToken cancellationToken, ActivitySource activitySource)
   at Microsoft.Kiota.Http.HttpClientLibrary.Middleware.RetryHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at Microsoft.Kiota.Http.HttpClientLibrary.Middleware.CompressionHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at Microsoft.Graph.PowerShell.Authentication.Handlers.AuthenticationHandler.SendAsync(HttpRequestMessage httpRequestMessage, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at Microsoft.Graph.Beta.PowerShell.Security.SecurityAuditLogCreateQuery_Call(HttpRequestMessage request, Func`3 on2Xx, Func`3 onDefault, IEventListener eventListener, ISendAsync sender)
   at Microsoft.Graph.Beta.PowerShell.Security.SecurityAuditLogCreateQuery_Call(HttpRequestMessage request, Func`3 on2Xx, Func`3 onDefault, IEventListener eventListener, ISendAsync sender)
   at Microsoft.Graph.Beta.PowerShell.Security.SecurityAuditLogCreateQuery(IDictionary headers, IMicrosoftGraphSecurityAuditLogQuery body, Func`3 on2Xx, Func`3 onDefault, IEventListener eventListener, ISendAsync sender)
   at Microsoft.Graph.Beta.PowerShell.Cmdlets.NewMgBetaSecurityAuditLogQuery_CreateExpanded.ProcessRecordAsync()'
New-MgBetaSecurityAuditLogQuery_CreateExpanded: Too many retries performed

Might be worth re-opening this issue.

(ping @petrhollayms @nickp85)