Query Details
SigninLogs //| where ResultType != 0 //| where ResultSignature == "FAILURE" //| where CrossTenantAccessType == "passthrough" | where Status.failureReason == "The resource tenant\'s cross-tenant access policy does not allow this user to access this tenant." //use something Like AADInternalsOsint to look up ResourceTenantID from AppOwnerTenantId field. //This query covers B2b. For Tenant Restrictions see the other KQL in this Repo.
This query is designed to analyze sign-in logs to identify failed login attempts due to cross-tenant access policy restrictions. Here's a simple breakdown of what it does:
Data Source: It starts by examining the SigninLogs, which contain records of sign-in activities.
Filter Criteria:
Status.failureReason indicates that the resource tenant's cross-tenant access policy is blocking the user from accessing the tenant. This is a specific type of failure reason.Additional Analysis:
AADInternalsOsint to look up the ResourceTenantID using the AppOwnerTenantId field. This would help identify which tenant's policies are causing the access issue.Scope:
In summary, this query helps identify and analyze failed sign-in attempts due to cross-tenant access policy restrictions in a B2B context.

Jay Kerai
Released: August 15, 2025
Tables
Keywords
Operators