Obtain a list of all devices connected to Office 365. We will find The username and mail, deviceID, Model, Operating system...
In order to run it, first you need to connect to Office 365 tenat. Check this link for more info https://learn.microsoft.com/en-us/microsoft-365/enterprise/connect-to-microsoft-365-powershell?view=o365-worldwide