12Knocksinna / Office365itpros

Office 365 for IT Pros PowerShell examples
MIT License
1.24k stars 559 forks source link

(401) Unauthorized - GetUserSignInDataGraph.PS1 #80

Closed AlanDevOps closed 1 year ago

AlanDevOps commented 1 year ago

I'm looking for help similar to https://github.com/12Knocksinna/Office365itpros/issues/50

This is on a tenant with many users.

I keep getting (401) Unauthorized. around an hour into it running.

12Knocksinna commented 1 year ago

It's likely that the access token is timing out. The default access token lasts an hour and then expires. You can include some code to renew the token after 55 minutes or so and all will be well.