Coder Social home page Coder Social logo

Comments (3)

12Knocksinna avatar 12Knocksinna commented on July 17, 2024 1

This is an old script (3 years) and I wouldn't use this approach to get sign in data for users anymore.

https://office365itpros.com/2022/09/29/underused-accounts-report/ explains how to use the Microsoft Graph PowerShell SDK cmdlet Get-MgUser to fetch information about users (including signins) with a command like:

[Array]$Users = Get-MgUser -Filter "assignedLicenses/`$count ne 0 and userType eq 'Member'" -ConsistencyLevel eventual -CountVariable Records -All -Property signInActivity | Sort-Object DisplayName

I think that's a better approach.

Anyway, the reason why the call is failing is that the Azure AD team has limited fetches to 120 objects at a time. That's a recent change:

{"error":{"code":"UnknownError","message":"{"@odata.context":"http://reportingservice.act
ivedirectory.windowsazure.com/auditLogs/$metadata#Edm.String","value":"Cannot query
data for more than 120 users at a time."}","innerError":{"date":"2023-04-01T09:43:21","requ
est-id":"c51d7e23-0469-405d-9170-4206e25af69d","client-request-id":"c51d7e23-0469-405d-9170-
4206e25af69d"}}}

Change the $top=999 to $top=100 and the command will run. The backtick is necessary to escape the $ character in PowerShell.

from office365itpros.

replyonly avatar replyonly commented on July 17, 2024

The script contained an ‘ before $top=999 on line 30. I removed this ' and the script ran successfully.

from office365itpros.

apgoncalves avatar apgoncalves commented on July 17, 2024

I´m getting the same error. The problem is, if I remove de backtick, $select and $top is ignored.

from office365itpros.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.