Even if a device is marked as non-compliant, it can still sign in to your organization and access Microsoft 365 apps unless Conditional Access policies are properly configured. Therefore, regularly auditing sign-ins from non-compliant devices strengthens device-based access controls and supports compliance with regulations like GDPR and HIPAA.
You can follow the methods given below to get all non-compliant devices sign-ins in Microsoft 365.
- Navigate to the Sign-in logs section in the Microsoft Entra admin center.
- Click on the desired sign-in event to open the Activity Details panel.
- Then, select the Device Info tab to check whether the signed-in device is marked as compliant or non-compliant.
Note: By default, the logs display sign-in activity from the past 24 hours. However, you can customize the date range to view activity from up to the last 30 days.
In the Entra admin center, you need to manually review each entry in the sign-in logs. These logs also include compliant device sign-ins, making it time-consuming to isolate non-compliant ones.
To simplify this, connect to Microsoft Graph PowerShell using the Connect-MgGraph cmdlet with the "AuditLog.Read.All" scope. Then, run the following cmdlet to view user sign-ins from non-compliant devices.
Get-MgAuditLogSignIn -Filter "DeviceDetail/IsCompliant eq false" | ForEach-Object {
[PSCustomObject]@{
CreatedDateTime = $.CreatedDateTime;
UserPrincipalName = $.UserPrincipalName;
AppDisplayName = $.AppDisplayName;
ResourceDisplayName = $.ResourceDisplayName;
DeviceName = $.DeviceDetail.DisplayName;
IsManaged = $.DeviceDetail.IsManaged;
OS = $.DeviceDetail.OperatingSystem;
TrustType = $.DeviceDetail.TrustType
}
} | Format-Table
The above PowerShell cmdlet retrieves each non-compliant device sign-in with details such as sign-in time, signed-in user, application name, resource name, device name, device management status, OS with version, and device trust type.
Skip the manual effort of identifying sign-ins from non-compliant devices with AdminDroid!
- Simply click the Alert option (🔔) in the non-compliant device sign-in report to set up notifications for any sign-in attempts from unhealthy devices across your tenant.
- Handy Tip: Use the Threshold property in alert policies to get notified whenever multiple failed sign-in attempts from non-compliant devices happen within a short time.