When it is written
Microsoft lists Set-InboxRule among the audited Exchange mailbox activities: the mailbox owner or another user with access to the mailbox changed an inbox rule in Outlook on the web. The same record is written when the cmdlet is run in Exchange Online PowerShell, where Mailbox names the mailbox when it is not the caller's own. Microsoft's property reference lists it as an Exchange admin record (RecordType 1), like New-InboxRule; rules changed in the Outlook desktop client are recorded as the mailbox action UpdateInboxRules instead. That one is a mailbox audit record: for users without an E5 licence, Microsoft notes that searches of the unified audit log return such records only where mailbox auditing was enabled on the mailbox by hand.
Identity names the rule (its name, or MailboxAlias\RuleIdentity in Exchange Online). Parameters carries only what the change set: conditions (From, SubjectContainsWords, BodyContainsWords, SubjectOrBodyContainsWords, FromAddressContainsWords, HeaderContainsWords, and ExceptIf... exceptions) and actions (ForwardTo, ForwardAsAttachmentTo, RedirectTo, DeleteMessage, SoftDeleteMessage, MoveToFolder, MarkAsRead, StopProcessingRules). A condition or action the rule already had and that was not touched does not appear. Microsoft notes that changing a rule from PowerShell removes the client-side rules Outlook created. Microsoft publishes no sample record of Set-InboxRule itself: the mailbox, client and session fields below follow its sample record of the companion New-InboxRule.
Forwarding to external addresses is governed by the outbound spam filter policy, and remote domain settings or mail flow rules can block it too. Where it is off, automatically forwarded messages are returned to the sender with a non-delivery report (5.7.520). Microsoft describes what happens to the messages, not to the rule: it does not say that the change is refused or left unrecorded, so look for this record even where forwarding is blocked.
How to turn it on
Microsoft 365 unified audit log (Exchange) records Set-InboxRule calls to Microsoft 365 unified audit log (Exchange) without any setup. Vendor documentation
Microsoft Purview Audit (Standard) is on by default for most Microsoft 365 organizations: every cmdlet run in the Exchange admin center or in Exchange Online PowerShell is recorded, except cmdlets whose verb is Get-, Search- or Test- and some service maintenance cmdlets that Microsoft does not log. Microsoft lists two exceptions where auditing is not on by default: tenants with Business Basic, Business Standard or Business Premium licences, and unmanaged tenants on enterprise trials. Check UnifiedAuditLogIngestionEnabled in Exchange Online PowerShell (in Security & Compliance PowerShell the property always reads False).
- Mailbox actions (inbox rules created from Outlook, folder permission changes, mail access) also need mailbox auditing, which is on by default for user, shared and Microsoft 365 Group mailboxes (
AuditDisabledisFalse). An account set to bypass mailbox auditing (Set-MailboxAuditBypassAssociation) leaves no mailbox audit records, and a mailbox whose audited actions were customised does not get new default actions. For users without an E5 licence, Microsoft notes that mailbox audit records are returned by the audit search,Search-UnifiedAuditLogand the Management Activity API only after mailbox auditing is enabled on the mailbox by hand (Set-Mailbox -AuditEnabled $true). Microsoft states this limit for mailbox audit events only, not for cmdlet records. - Retention follows the licence of the user who performed the activity: 180 days with Audit (Standard) (90 days for records created before 17 October 2023); with Audit (Premium) (E5 or an E5 Compliance or eDiscovery and Audit add-on) Exchange records are kept one year by default, and up to 10 years with a separate add-on licence and a retention policy.
- Collection: the Office 365 Management Activity API publishes Exchange records in the
Audit.Exchangecontent type. A subscription has to be started first (the first content can take up to 12 hours), each content blob can be downloaded for 7 days, and records do not arrive in order. Microsoft Sentinel's Microsoft 365 data connector with Exchange selected writes them to theOfficeActivitytable, which is a free data source. - Delay: Microsoft guarantees no delivery time. Exchange records are typically available 60 to 90 minutes after the activity; Microsoft notes that an Exchange admin record can take up to 30 minutes to appear in an audit search.
- Turning auditing off (
Set-AdminAuditLogConfig -UnifiedAuditLogIngestionEnabled $false) also stops the Management Activity API and Sentinel collection; the change itself is recorded as aSet-AdminAuditLogConfigrecord.
Get-AdminAuditLogConfig | Format-List UnifiedAuditLogIngestionEnabledGet-OrganizationConfig | Format-List AuditDisabledGet-Mailbox -Identity <MailboxIdentity> | Format-List AuditEnabled,DefaultAuditSetGet-MailboxAuditBypassAssociation -Identity <MailboxIdentity> | Format-List AuditByPassEnabledSearch-UnifiedAuditLog -StartDate (Get-Date).AddDays(-7) -EndDate (Get-Date) -Operations Set-InboxRule -ResultSize 5 | Select-Object -ExpandProperty AuditDataFields
The operation’s own fields first, then the fields every Microsoft 365 unified audit log (Exchange) record has. Field names are the JSON paths of the record as the vendor documents it.
| Field | What it holds |
|---|---|
ParametersRead by 3 rules | The parameters the cmdlet was run with, as Name and Value pairs: Identity (the rule), Mailbox when the rule is in another mailbox, and the conditions and actions that were set in this change, for example ForwardTo, RedirectTo, DeleteMessage, MoveToFolder, MarkAsRead and the ...ContainsWords conditions. |
MailboxOwnerUPN | The owner of the mailbox the rule belongs to; Microsoft names it a key property for rule changes. |
MailboxGuid | The Exchange GUID of that mailbox, as in Microsoft's sample record of the companion New-InboxRule action. |
ClientInfoString | The client used. Microsoft's table of values gives Client=OWA for Outlook on the web; its sample record of the companion New-InboxRule action shows Client=WebServices;ExchangeWebServices. |
SessionId | Identifier of the session the change was made in, as in the same sample record; links it to the other actions of the same session. |
Fields every Microsoft 365 unified audit log (Exchange) record has (17)
| Field | What it holds |
|---|---|
CreationTime | When the record was generated, in UTC. |
Id | Unique identifier of the audit record. |
OperationRead by 3 rules | The activity. For Exchange admin records, the name of the cmdlet that was run; for mailbox audit records, the mailbox action. The operation this page is about. |
RecordType | The kind of record (1 ExchangeAdmin for a cmdlet, 2 ExchangeItem and 3 ExchangeItemGroup for mailbox actions). |
Workload | The Microsoft 365 service the activity happened in, Exchange for every record of this source. |
OrganizationId | GUID of the Microsoft 365 tenant, the same in every service. |
OrganizationName | The name of the tenant. |
UserId | UPN of the user who performed the activity. Activity of system accounts such as NT AUTHORITY\SYSTEM is recorded too. |
UserKey | An alternative ID for the user in UserId (the passport unique ID, PUID, for Exchange activity). |
UserType | Who performed the activity (0 Regular, 2 Admin, 3 DCAdmin, 4 System, 5 Application, 6 ServicePrincipal, 9 PartnerTechnician, 10 Guest...). |
ClientIP | Address of the device used for the activity; for some services it can be the address of an application acting for the user. |
ObjectId | For Exchange admin records, the object the cmdlet changed (a mailbox, a rule, a policy, a role group); for mailbox audit records, what the action was done on. |
ResultStatus | Whether the activity succeeded. The schema gives True or False for Exchange admin records and Succeeded, PartiallySucceeded or Failed for others; Microsoft's own sample Exchange records also show Success, so match all of them. |
ExternalAccess | For a cmdlet, true when it was run by Microsoft datacenter personnel, a datacenter service account or a delegated administrator, false when someone in your organization ran it. For a mailbox action, true when the user's domain differs from the mailbox owner's. |
OriginatingServer | The Exchange server the cmdlet ran on, or the operation came from. |
TokenObjectId | The oid claim (object ID of the signed-in user or application) of the Microsoft Entra token behind the activity. |
TokenTenantId | The tid claim (tenant) of that token. |
Values to know
Parameters
| Value | Meaning | Signal |
|---|---|---|
ForwardTo, ForwardAsAttachmentTo or RedirectTo | The rule now sends matching messages to other recipientsWhat the forwarding rule reports. An external address is the case to confirm with the mailbox owner. | Attack signal |
DeleteMessage, MarkAsRead or MoveToFolder with a words condition | The rule hides messages that match keywordsWhat the hiding rules report; the condition may have been set earlier and not appear in this record. | Attack signal |
An action set to False | The change turns that action offAlso matched, since the detection rules read parameter names. | Noise |
Volume and noise
Users adjust their filing rules regularly. The detection rules match parameter names, so they also report a change that turns an action off (DeleteMessage False), and, because SubjectContainsWords is part of ExceptIfSubjectContainsWords, a rule whose keywords are only an exception. A change that adds a forwarding address, or that adds a move, delete or mark as read action to a keyword condition, made from an unusual address or client or by someone other than the owner, is the record to read first.
Keeping it manageable
- Read the record together with the rule's current state,
Get-InboxRule -Mailbox <mailbox> -Identity <rule> | Format-List, which shows the conditions and actions the change did not repeat. - Compare
UserIdwithMailboxOwnerUPN; a rule changed in someone else's mailbox needs an explanation. - Use
SessionIdandClientIPto find the sign-in behind the change, and check it for a risky or unfamiliar sign-in (the rule's detection logic hypothesis). - Collect forwarding addresses across all rule records; the same external address on several mailboxes points to one actor.
Sample event
A Microsoft 365 unified audit log (Exchange) record in the vendor’s format, with made-up values.
{
"CreationTime": "2026-11-18T09:30:12",
"Id": "6f1c2d3e-4a5b-4c6d-8e9f-0a1b2c3d4e5f",
"Operation": "Set-InboxRule",
"OrganizationId": "00000000-0000-0000-0000-00000000c0de",
"RecordType": 1,
"ResultStatus": "True",
"UserKey": "10032001A2B3C4D5",
"UserType": 0,
"Workload": "Exchange",
"ClientIP": "203.0.113.24",
"ObjectId": "jdoe\\Invoice notices",
"UserId": "j.doe@corp.example.com",
"ExternalAccess": false,
"OrganizationName": "corpexample.onmicrosoft.com",
"OriginatingServer": "AM0PR01MB0001 (15.20.8100.10)",
"TokenObjectId": "00000000-0000-0000-0000-0000000a11ce",
"TokenTenantId": "00000000-0000-0000-0000-00000000c0de",
"MailboxOwnerUPN": "j.doe@corp.example.com",
"MailboxGuid": "00000000-0000-0000-0000-0000000b0b01",
"ClientInfoString": "Client=OWA",
"SessionId": "00000000-0000-0000-0000-000000005e55",
"Parameters": [
{
"Name": "Identity",
"Value": "jdoe\\Invoice notices"
},
{
"Name": "ForwardTo",
"Value": "invoices.copy@mail.example.net"
}
]
}Attacks this event reveals
Detection rules that read this event:
Frequently asked questions
Why does the record not show all of the rule's conditions and actions?
Parameters lists only the parameters used with the cmdlet, so a change shows only what it set. Read the rule with Get-InboxRule, or the earlier New-InboxRule and Set-InboxRule records of the same rule.
References
- Set-InboxRule, Exchange PowerShell reference (Microsoft)
- Audit log activities, Exchange mailbox activities (Microsoft)
- Learn about properties in Exchange audit records (Microsoft)
- Control external email forwarding (Microsoft)
- Search the audit log to investigate common support issues, mailbox activities of users without E5 licences (Microsoft)