User Agents

Web browsers and everyday web tech, explained

ActiveSync Device Access Rules: User Agent Filtering

· 5 min read · How the Web Works

In this article
  1. Background: How ActiveSync Identifies Devices
  2. How Device Access Rules Work
  3. Why User-Agent Is Not Used
  4. How to Configure Device Access Rules
  5. Common Misconceptions and Pitfalls
  6. Comparing Device Access Rules with Client Access Rules
  7. Safety and Best Practices
  8. Frequently Asked Questions

ActiveSync device access rules do not use the HTTP User-Agent header for filtering; they rely on the device's DeviceType and DeviceModel strings, which are sent in the ActiveSync protocol's X-MS-DeviceType and X-MS-DeviceModel headers. These rules, configured in Exchange Online or on-premises Exchange, allow or block devices by family (e.g., Apple, Android) or specific model, not by browser or mail client user agent.

Background: How ActiveSync Identifies Devices

ActiveSync (EAS) is a Microsoft protocol that synchronizes email, contacts, calendar, and tasks between a server and mobile devices. When a device connects, it sends an initial OPTIONS request that includes special headers beyond standard HTTP. The two most relevant are:

  • X-MS-DeviceType – a broad category like iPhone, Android, WindowsPhone, or Outlook for the Outlook mobile app.
  • X-MS-DeviceModel – a more specific model string, e.g., iPhone 15 Pro or Pixel 8.

These are not the same as the User-Agent HTTP header, which is typically sent by the email client (e.g., Microsoft Outlook/16.0 (Windows NT 10.0; ...)). Exchange ignores the User-Agent for access decisions because it is easily spoofed and varies by client version, whereas DeviceType and DeviceModel are part of the EAS protocol handshake.

How Device Access Rules Work

Exchange administrators create device access rules in the Exchange Admin Center (EAC) or via PowerShell. Each rule has three main components:

  1. Access level – Allow, Block, or Quarantine.
  2. DeviceType filter – e.g., Apple or Android.
  3. DeviceModel filter – optional, can be a specific model or a wildcard like iPhone*.

Rules are evaluated in a specific order: the most specific rule (with both DeviceType and DeviceModel) takes precedence over a general rule (only DeviceType). If no rule matches, the default access level (usually Allow) applies. For example, you could create a rule to block all Android devices except a specific model like Pixel 8 by adding a more specific allow rule.

Why User-Agent Is Not Used

User-Agent strings are notoriously inconsistent. The same device can send different User-Agent values depending on the email app (Outlook, Gmail, native client) and its version. Moreover, many third-party clients (like Mail on iOS) send a generic User-Agent that does not reveal the device model. In contrast, the DeviceType and DeviceModel headers are standardized by the EAS protocol and are sent by the device's sync engine, making them more reliable for policy enforcement.

Another reason is security: User-Agent can be easily modified by a user or a malicious app. DeviceType and DeviceModel are harder to spoof because they are part of the EAS handshake, though not impossible. Still, they are the industry standard for mobile device management (MDM) and Exchange ActiveSync policies.

How to Configure Device Access Rules

In Exchange Online (Microsoft 365), you can manage these rules in the Microsoft 365 Defender portal or via Exchange Online PowerShell. Steps:

  1. Go to Exchange admin center > Mobile > Device access.
  2. Click Add to create a new rule.
  3. Specify a name, access level (Allow/Block/Quarantine), and the DeviceType and DeviceModel filters.
  4. Save the rule. It may take a few minutes to propagate.

For on-premises Exchange, use the Exchange Admin Center under Mobile > Device Access, or PowerShell cmdlets like New-ActiveSyncDeviceAccessRule. The same logic applies.

Common Misconceptions and Pitfalls

A frequent misconception is that you can block a specific email client (like the Gmail app) using device access rules. You cannot, because the rules only see the device type/model, not the app. To restrict which apps can connect, you need app-based conditional access policies in Azure AD (now Microsoft Entra ID) or client access rules in Exchange Online.

Another pitfall: wildcards in DeviceModel. Use * to match any model, but be careful – iPhone* matches all iPhones, while iPhone without a wildcard matches only the exact string. Also, DeviceType values are case-insensitive but must match the exact string sent by the device. For example, some Android devices send Android, others may send android – always test.

Comparing Device Access Rules with Client Access Rules

Device access rules are often confused with client access rules in Exchange Online. Client access rules filter based on the client application (e.g., Outlook, Exchange Web Services) and can also use the User-Agent header. They are broader and can block all traffic from a specific app or protocol. Device access rules are specifically for mobile devices using ActiveSync. If you need to block a desktop mail client, you would use a client access rule, not a device access rule.

Safety and Best Practices

When blocking devices, be cautious not to lock out users unintentionally. Always test with a small group first. Use Quarantine instead of Block for unknown devices – quarantined devices can be reviewed and approved later. Also, remember that device access rules do not prevent data leakage if a user uses a non-EAS method (like IMAP or POP). For comprehensive security, combine device access rules with conditional access policies, multi-factor authentication, and mobile device management (MDM) like Intune.

Frequently Asked Questions

Can I block a specific email app using device access rules?

No. Device access rules only see the device type and model, not the app. To block specific apps, use client access rules or conditional access app controls.

Why is my iPhone showing as 'Apple' instead of 'iPhone'?

DeviceType is a broad category. Many Apple devices send Apple as the DeviceType, while the DeviceModel might be iPhone 13 Pro. Use the DeviceModel filter for more precision.

What is the difference between Block and Quarantine?

Block prevents the device from syncing entirely. Quarantine allows the device to sync but flags it for admin review. You can later approve or block it. Quarantine is useful for unknown devices.

Do device access rules affect Outlook on the web (OWA)?

No. Device access rules apply only to ActiveSync connections. OWA uses a different protocol and is not affected.

How do I find the DeviceType and DeviceModel of a device?

In Exchange admin center, go to Mobile > Devices. Select a device to see its properties, including DeviceType and DeviceModel. Alternatively, use PowerShell: Get-MobileDevice | Format-List DeviceType,DeviceModel.