Query Details

Options: Draft | InProgress | Stable | Deprecated

Entra ID Cross Tenant Settings Organization

Query

let identities = (
IdentityInfo
| where TimeGenerated > ago(30d)
| where isnotempty( AccountUpn)
| distinct AccountUpn, AccountDisplayName, CompanyName, Department);
AuditLogs
| where TimeGenerated > ago(90d)
| where OperationName == "Delete partner specific cross-tenant access setting" or OperationName == "Add a partner to cross-tenant access setting"
| extend userPrincipalName = tostring(parse\_json(tostring(InitiatedBy.user)).userPrincipalName)
| extend TenantID = tostring(parse\_json(tostring(parse\_json(tostring(TargetResources\[0].modifiedProperties))\[0].newValue)))
| extend ipAddress = tostring(parse\_json(tostring(InitiatedBy.user)).ipAddress)
| extend IpAddressLocation = geo\_info\_from\_ip\_address(ipAddress)
| extend Country = tostring(IpAddressLocation.country)
| project TimeGenerated,OperationName, TenantID, userPrincipalName, ipAddress, Country
| join kind=leftouter (identities)
on $left. userPrincipalName == $right. AccountUpn
| sort by TimeGenerated asc

About this query

Explanation

This KQL query is designed to audit changes in cross-tenant access settings within Microsoft Entra ID. Specifically, it looks for events where a partner was added or removed from these settings over the past 90 days. The query extracts details such as the tenant ID, the user who initiated the change, their IP address, and the estimated country based on the IP address. Additionally, it enriches this data by joining it with identity records from the past 30 days to include user display names, company names, and departments. This helps in identifying and understanding any unexpected changes in cross-tenant collaboration settings.