Hey everyone! I'm trying to develop a PowerShell script to fetch the Device IDs connected to non-interactive sign-ins across a large list of accounts, about a thousand in total. I found that this information can be accessed through the Azure Portal by going to Users, selecting a user, navigating to their Sign-in logs, and then checking the Activity Details for Device Info. However, when I run my script, it times out on several records. I'm wondering if there's a better method to fetch this data. Specifically, can I run filters using Get-MgBetaAuditLogSignIn in a way that would avoid using a foreach loop? I'd appreciate any tips or alternative approaches! Thanks a lot!
1 Answer
One approach you might consider is to first query all the sign-in logs and convert that PSObject into a hashtable. Then, instead of looping through each user individually, you can compare user accounts against this hashtable. This way, you can potentially reduce the number of API calls you're making and speed up the process!
Thanks for the suggestion! But would that still lead to timeouts if I'm retrieving logs from every account?