🎉 Our Microsoft 365 Reporting & Management Tool is now available in Azure Marketplace 🚀
This website uses cookies to improve your experience. We'll assume you're ok with this. Know more.
Microsoft Entra ID

How to List All Devices in Microsoft 365

Unmanaged or personal devices accessing Microsoft 365 can lead to data leaks and unauthorized access. Identifying such devices is essential to revoke stale access and ensure only compliant devices connect to your organization. This guide shows you how to list all Entra ID devices in Microsoft 365 for better visibility and control.

Find Device Details Via Microsoft Entra

Microsoft 365 Permission Required
Security Reader Least Privilege
Global Administrator Most Privilege
  • Sign in to the Microsoft Entra admin center and navigate to Entra ID»Devices»All devices.
  • On the All devices page, you will see all Microsoft 365 devices along with details like name, version, OS, join type, owner, and MDM.
  • Additionally, you can export the report by clicking 'Download devices' from the top menu.
  • Click 'Start download' to export the complete list of devices in CSV format.
Find Device Details Via Microsoft Entra

Get Entra ID Devices Report Using PowerShell

Microsoft 365 Permission Required
Device.Read.All Least Privilege
Device.ReadWrite.All Most Privilege
  • Use the cmdlet below to connect to the Microsoft Graph PowerShell module.
  • Windows PowerShell Windows PowerShell
     Connect-MgGraph -Scopes "Device.Read.All"
  • Run the following cmdlet to get all Entra devices using PowerShell.
  • Windows PowerShell Windows PowerShell
     Get-MgDevice | Select-Object DisplayName, Id, OperatingSystem, TrustType
Get Entra ID Devices Report Using PowerShell

The execution of the cmdlet displays all the Microsoft Entra devices with names, device id, operating system and its trust type.

Export Devices Report to CSV Using PowerShell Script

Microsoft 365 Permission Required
Security Reader Least Privilege
Global Administrator Most Privilege
  • Retrieving all required Entra ID device properties using PowerShell often involves multiple filters and property selections.
  • To simplify this task, we've developed a PowerShell script that exports all Entra ID devices into a CSV file.
  • Simply download the script below and run it in PowerShell. This script retrieves device details, such as name, OS version, join type, inactive days and much more.
Export Devices Report to CSV Using PowerShell Script
GetAzureADDevicesReport.ps1

Gain Full Visibility into Microsoft 365 Devices to Strengthen Endpoint Oversight

AdminDroid’s Entra ID reporting tool allows you to effortlessly view all devices, track their activity and identify non-compliant endpoints. With granular device reports, you can enforce device policies, clean up inactive records, etc. This reduces security risks to ensure only trusted devices access your Microsoft 365 environment.

Analyze Device Users Report with Advanced Filters to Spot Risky Device Usage

View device users report to easily map users to devices and use AI-powered filters to review properties, spot anomalies, and strengthen access control.

Monitor Unmanaged Device Sign-ins with Detailed Analytics Reports

Keep track of unmanaged device sign-ins report to identify suspicious Entra ID device sign-in risks or other sign-ins from unusual locations.

Track Microsoft 365 Device Additions to Avoid Unauthorized Access

Audit newly added devices with detailed insights, such as the added user, timestamp, and more to quickly identify and remove unauthorized personal device enrollments.

Find Inactive Devices in Microsoft 365 for Deep Cleanup

Remove devices that are inactive by analyzing M365 stale devices report to minimize risk, improve compliance, and maintain an accurate device record.

Deploy Pre-Built Reminder Agents to Detect Mailbox Device Access State

The mailbox device access state detector reminder notifies about the mobile devices that are blocked or quarantined in Exchange Online to quickly address potential security issues.

Analyze Conditional Access Device Conditions Report to Ensure Secure Access

Evaluate device conditions in Entra Conditional Access policies to ensure there are no misconfigurations leading to the blocks of trusted devices in your organization.

Overall, AdminDroid’s Microsoft 365 management tool provides full visibility into devices, which helps to identify inactive, unmanaged, and risky endpoints. Customizable reports enable informed actions, simplify audits, and support strong governance and compliance.

Explore a full range of reporting options

Important tips

Regularly manage device identity settings like limiting the number of devices users can join to ensure better control and strengthen network security.

Block unmanaged devices from accessing SharePoint and OneDrive using Conditional Access policy to prevent data loss.

Monitor MFA device details to control which devices are used for authentication and ensure only trusted endpoints access sensitive data.

Common Errors and Resolution Steps

The following are the possible errors and troubleshooting hints while getting the list of all devices in Microsoft Entra ID.

Error Interactive Browser Credential authentication failed: The application 'Microsoft Graph Command Line Tools' asked for scope 'Devices.Read.All' that doesn't exist on the resource .

This error occurs when using a personal Microsoft account or lacking proper directory permissions like Devices.Read.All, which are intended for Entra ID work accounts only.

Fix Sign in with a work account that has the necessary permissions, such as Global Administrator or Security Reader, and connect to Microsoft Graph PowerShell using the required ‘Devices.Read.All’ scope.
Connect-MgGraph -Scopes "Device.Read.All"

Error Invoke-MgGraphRequest: Missing an argument for parameter 'ContentType'. Specify a parameter of type 'System.String' and try again.

This error is faced while executing -ContentType parameter in Microsoft Graph PowerShell because it is provided without a value.

Fix Provide a valid string value by using -ContentType "application/json" to correctly pass the ContentType parameter to Invoke-MgGraphRequest.
Invoke-MgGraphRequest -Method POST -Uri "https://graph.microsoft.com/beta/deviceManagement/deviceConfigurations" -Body ($windowsConfig | ConvertTo-Json -Depth 3) -ContentType "application/json"

Error The term '$.DeviceDetail.DeviceId' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

This error occurs because PowerShell misinterprets the expression as a string or command due to the context within the Where-Object filter block.

Fix Use $_ (underscore), i.e) { $_.DeviceDetail.DeviceId } inside Where-Object to correctly reference properties from each sign-in record in the pipeline.
Get-MgAuditLogSignIn -All | Where-Object {$_.DeviceDetail.DeviceId}

Error Get-MgBetaDevice : The 'Get-MgBetaDevice' command was found in the module 'Microsoft.Graph.Beta.Identity.DirectoryManagement', but the module could not be loaded.

This issue occurs when executing Get-MgBetaDevice cmdlet and module cannot be loaded due to corruption, missing dependencies, or version conflicts.

Fix Execute the following cmdlet in PowerShell to install the Microsoft Graph Beta PowerShell module to avoid this issue.
Install-Module Microsoft.Graph.Beta.DeviceManagement -Scope CurrentUser

Error User is not in the allowed roles. Status: 403 (Forbidden).

This error occurs because your account lacks the required Azure AD role to access sign-in logs using the Microsoft Graph API.

Fix Ensure you have the required roles like Global Administrator or Security Reader role while executing the Get-MgAuditLogSignIn cmdlet.
Get-MgAuditLogSignIn -All

1. How to correlate Entra ID device records and compliance details?

Correlating device last sign-in activity with compliance status involves comparing the most recent access to Microsoft 365 services with the device’s current compliance state (e.g., compliant, noncompliant, or unknown). 

This helps admins identify users accessing Microsoft 365 from non-compliant devices and access device activity and security posture. They can take action to reduce risk, clean up inactive licenses, and enforce Zero Trust policies.

Correlate device last sign-in activity with compliance status using Entra admin center

  • Log in to the Microsoft Entra admin center.
  • Navigate to Entra ID»Devices»All devices.
  • Now, you can check the compliance status & last sign-in activity of every user's device along with the details like join type, owner, MDM, security settings management and more.
compliance-with-activity-status-via-ui

Correlate user device sign-in activity with compliance using PowerShell

Connect to the Microsoft Graph PowerShell module with required permissions and run the script below.

$devices = Get-MgDeviceManagementManagedDevice -All
$signIns = Get-MgAuditLogSignIn -All | Where-Object { $_.DeviceDetail.DeviceId }
$latest = $signIns | Sort-Object CreatedDateTime -Descending | Group-Object { $_.DeviceDetail.DeviceId } | ForEach-Object { $_.Group[0] }
$report = foreach ($s in $latest) { $d = $devices | Where-Object { $_.AzureADDeviceId -eq $s.DeviceDetail.DeviceId }
 [PSCustomObject]@{ DeviceName = $s.DeviceDetail.DisplayName 
   LastSignIn = $s.CreatedDateTime
   User       = $s.UserPrincipalName
   Compliance = if ($d) { $d.ComplianceState } else { "Unknown" } }} 
$report | Format-Table -AutoSize

This script obtains device name, user name and device’s last sign-in activity with compliance details. It helps you spot risky devices, compliant devices, etc. Also identify who used which device, when, and whether it met your organization’s security standards.

compliance-with-last-signin-via-powershell

Associate user sign-ins with compliance status using AdminDroid to avoid security risks!

AdminDroid reports unify device compliance, user details, and sign-in activities into a single view that eliminates the need to manually correlate data from multiple sources. This saves time, reduces errors, and provides actionable insights without complex scripting.

  • AdminDroid’s compliant devices report allows you to easily map user login activity with the compliance status of their devices.
  • With advanced filters, you can quickly spot high-risk scenarios like users signing in from non-compliant or personal devices.
  • You can also use advanced customization to group compliant devices by last sign-in date and spot recent activity easily.
compliance-with-last-signin-via-admindroid

2. How to auto-lock Microsoft 365 devices after a period of inactivity?

Imagine a scenario where an employee steps away from their workstation to attend a quick discussion and unintentionally leaves their laptop unlocked in a shared space. During this time, the unattended device could be unintentionally accessed, potentially exposing confidential client data or internal systems. Automatically locking the device after a few minutes of inactivity ensures the session is secured. This helps to protect sensitive information even when users forget to manually lock their screen.

Auto-lock devices by setting-up device configurations in Intune admin center

  • Log in to the Intune admin center and navigate to Devices»Manage devices»Configuration.
  • Then, click the “Create” dropdown and select “New Policy”.
  • Under “Platform” dropdown, select the required device platform and choose ‘Templates’ as the profile type. Then select the ‘Device restrictions’ and click Create.
  • On the ‘Basics’ tab, give the policy a name and description, then click Next.
  • Under Configuration settings, expand the Password section.
  • Toggle ‘Require Password’ to ‘Yes’.
  • Now configure the following settings as per Microsoft recommendation:
    • For iOS/Mac: Set “Maximum minutes after screen lock before password is required” to Immediately.
    • For other devices: Set “Maximum minutes of inactivity until screen locks” to 5 minutes.
  • Click Next, proceed with other required configurations, and then create the policy.
auto-lock-device-configuration-in-ui

Configure auto-lock device settings using PowerShell

Using the Intune portal, an admin would need to manually create and assign this policy for each group or tenant. With PowerShell, the same policy can be scripted, reused, and applied across hundreds of devices or multiple tenants in seconds. So, here is how to configure auto-lock device property using PowerShell.

Connect to the Microsoft Graph PowerShell module with required permissions and run the below script to configure auto-lock device settings.

$windowsConfig = @{ "@odata.type" = "#microsoft.graph.windows10GeneralConfiguration"
  displayName = "<displayname>"
  inactivityTimeoutInSeconds = 300
  requirePasswordWhenResumeFromIdle = $true }
$windowsPolicy = Invoke-MgGraphRequest -Method POST -Uri "https://graph.microsoft.com/beta/deviceManagement/deviceConfigurations" -Body ($windowsConfig | ConvertTo-Json -Depth 3) -ContentType "application/json"
$assignment = @{ target = @{  "@odata.type" = "#microsoft.graph.groupAssignmentTarget"
    groupId = "<groupId>" }}
Invoke-MgGraphRequest -Method POST -Uri "https://graph.microsoft.com/beta/deviceManagement/deviceConfigurations/$($windowsPolicy.id)/assignments" -Body ($assignment | ConvertTo-Json -Depth 3) -ContentType "application/json"
auto-lock-devices-using-powershell

Note: During execution, you must assign a group ID to configure the rule. Get group ID by using Get- MgGroup. Replace <displayName> and <groupID> with a suitable policy name and specific group ID. Set “inactivityTimeoutInSeconds” with any desired duration for inactivity locking (i.e., 300=5 minutes). 

3. How to block jailbroken or rooted devices in Microsoft 365?

Jailbroken or rooted devices are mobile devices that have been modified to bypass the built-in security controls of their operating systems like iOS or Android. Blocking these devices is important because they can compromise the security of your organization by exposing sensitive apps and data to high risk.

Restrict rooted devices using device compliance policies via Intune

You can block such devices using Intune compliance policies or Conditional Access rules to ensure that only trusted devices can access your Microsoft 365 organization.

  • Open Compliance page and select “Create policy”.
  • Select the Platform as ‘Android (AOSP)’ or ‘iOS/iPadOS’ and click Create.
  • In the Basics tab, provide a relevant name and description, then proceed by clicking Next.
  • Navigate to the Compliance settings»Device Health and set “Jailbroken (iOS) or Rooted (Android)” devices toggle to ‘Block’.
  • Specify if any other required settings like ‘Actions for non-compliance’ and ‘Assignments’ are needed, and complete the process by creating the policy.
block-rooted-devices-in-ui

Tip: Blocking jailbroken or rooted devices protects your organization from major security breaches and unauthorized access. It’s one of the Microsoft recommended practices which increases the secure score for devices.

Block rooted or jailbroken devices using PowerShell

Using Microsoft Graph PowerShell, you can block rooted devices in Microsoft 365 by creating a compliance policy with the appropriate settings.

Use the PowerShell cmdlet below to define the policy and set the rule to block jailbroken or rooted devices.

Connect-MgGraph -Scopes DeviceManagementConfiguration.ReadWrite.All
$androidPolicy = @{ "@odata.type" = "#microsoft.graph.androidCompliancePolicy"
displayName = "<Android Block Rooted Devices>"
securityThreatProtectionRequired = $true
deviceThreatProtectionEnabled = $true
deviceThreatProtectionRequiredSecurityLevel = "secured"
rootedDeviceBlocked = $true 
scheduledActionsForRule = @( @{ ruleName = "BlockRooted"
scheduledActionConfigurations = @( @{ actionType = "block"
gracePeriodHours = 0 } ) } ) }
New-MgDeviceManagementDeviceCompliancePolicy -BodyParameter $androidPolicy
block-rooted-devices-using-powershell

4. How to block unmanaged and non-compliant devices in Microsoft 365?

Unmanaged devices are devices that are not enrolled in your organization’s management system, such as Microsoft Intune or another MDM (Mobile Device Management) solution. These devices may have access to organizational resources, but they operate outside admin control. On the other hand, non-compliant devices are the ones that fail to meet security requirements like encryption or antivirus required by the organization.

To make sure that only safe and reliable devices can access the data of your company, it's crucial to block unmanaged and non-compliant devices from using Microsoft 365. By blocking these, you can reduce the risk of data leaks, malware, and unauthorized access.

Configure CA policy to block non-compliant devices using Entra admin center

  • Log in to the Microsoft Entra admin center.
  • Navigate to ID Protection»Risk-based Conditional Access»Policies, and click ‘+ New policy’.
  • Provide a suitable name to your policy.
  • Choose ‘Users’, include ‘Select users and Groups’.
  • Exclude break glass accounts to ensure there's always an emergency access path to the tenant.
  • Also choose ‘Target resources’ and include ‘All cloud apps’ or ‘Selected apps’ based on the organizations’ requirement.
  • Next, under Grant controls, select ‘Grant access’.
  • Under Grant access select, ‘Require device to be marked as compliant’ and ‘Require Microsoft Entra hybrid joined device' and click ‘Select’.
  • Finally, set the policy status to ‘Report-only’ to test them and click on ‘Create’ to finish. After testing, enforce the policy by selecting ‘On’ and click 'Save' to update.
block-unmanaged-devices-in-ui

Kickstart Your Journey With
AdminDroid

Your Microsoft 365 Companion with Enormous Reporting Capabilities

Download Now
User Help Manuals Compliance Docs
x
Delivering Reports on Time
Want a desired Microsoft 365 reports every Monday morning? Ensure automated report distribution and timely delivery with AdminDroid's Scheduling to your email anytime you need.
Delivering Reports on Time
Schedule tailored reports to execute automatically at the time you set and deliver straight to the emails you choose. In addition, you can customize report columns and add inteligent filtering to the activities just from the previous day to suit your Microsoft 365 report requirements.
Set It, Schedule It, See Results- Your Reports, Your Way, On Your Time!
Time Saving
Automation
Customization
Intelligent Filtering
Give Just the Right Access to the Right People
Grant fine-tuned access to any Microsoft 365 user with AdminDroid’s Granular Delegation and meet your organization’s security and compliance requirements.
Give Just the Right Access to the Right People
Create custom roles loaded with just the right permissions and give access to admins or normal users within AdminDroid. The result? A streamlined Microsoft 365 management experience that aligns your organization's security protocols and saves your invaluable time and effort.
Align, Define, Simplify: AdminDroid's Granular Delegation
Smart Organizational Control
Effortless M365 Management
Simplified Access
Advanced Alerts at a Glance
Receive quick notifications for malicious Microsoft 365 activities. Engage with the AdminDroid’s real-time alert policies crafted to streamline your security investigations.
Advanced Alerts at a Glance
Stay informed of critical activities like suspicious emails and high-risk logins, bulk file sharing, etc. Through creating and validating ideal alert policies, AdminDroid provides a comprehensive approach to real-time monitoring and management of potential threats within your organization.
AdminDroid Keeps You Always Vigilant, Never Vulnerable!
Proactive Protection
Real-time Monitoring
Security Intelligence
Threat Detection
Merge the Required Data to One Place
Combine multiple required columns into one comprehensive report and prioritize the information that matters most to you with AdminDroid’s Advanced Column Customization.
Merge the Required Data to One Place
This column merging capability offers a flexible way to add different columns from various reports and collate all the essential data in one place. Want to revisit the customized report? Save it as a 'View’, and your unique report is ready whenever you need it.
Merge with Ease and Save as Views!
Custom Reporting
Unique View
Desired Columns
Easy Data Interpretation
Insightful Charts and Exclusive Dashboards
Get a quick and easy overview of your tenant's activity, identify potential problems, and take action to protect your data with AdminDroid’s Charts and Dashboards.
Insightful Charts and Exclusive Dashboards
With AdminDroid charts and dashboards, visualize your Microsoft 365 tenant in ways you've never thought possible. It's not just about viewing; it's about understanding, controlling, and transforming your Microsoft 365 environment.
Explore Your Microsoft 365 Tenant in a Whole New Way!
Executive overviews
Interactive insights
Decision-making
Data Visualization
Efficient Report Exporting for Microsoft 365
Downloading your reports in the right file format shouldn’t be a hassle with AdminDroid’s Report Export. Experience seamless report exporting in various formats that cater to your needs.
Efficient Report Exporting for Microsoft 365
Navigate through diverse options and export Microsoft 365 reports flawlessly in your desired file format. Tailor your reports precisely as you need them and save them directly to your computer.
Take Control, Customize and Deliver- Your Office 365 Data, Exported in Your Way!
Easy Export
Seamless Downloading
Data Control
Manage Microsoft 365

Get AdminDroid Office 365 Reporter Now!