Exchange OnlineTroubleshooting

Microsoft Purview Message Encryption not working in Exchange Online: test, fix and verify

Test-IRMConfiguration fails, the RMS template list is empty or mail goes out unencrypted? Check Azure Rights Management, the IRM configuration and your rules, then prove it works.

Microsoft Purview Message Encryption is usually switched on automatically, so when it breaks, admins are often unsure where to look. The cause is nearly always one of a few things: the Azure Rights Management service isn't active, the IRM configuration in Exchange Online is incomplete, or a mail flow rule doesn't do what people think. In this post I'll show how to test each layer, fix what fails and verify that encrypted mail reaches people outside the organization.

Errors this guide fixes

  • Failed to acquire RMS templatesTest-IRMConfiguration
  • OVERALL RESULT: FAILTest-IRMConfiguration
  • AzureRMSLicensingEnabled : FalseGet-IRMConfiguration
  • This cmdlet is deprecated. The Trusted Publishing Domain (TPD) for your organization is managed in Microsoft Azure Rights Management.Exchange Online PowerShell
How this guide is organized: Symptoms → Why it happens → How to fix it → Verify the fix → Key takeawaysFlow diagram of the article's sections in reading order: 1. Symptoms. 2. Why it happens. 3. How to fix it. 4. Verify the fix. 5. Key takeaways. Toolbox: Test-IRMConfiguration, Get-IRMConfiguration, Connect-AipService, Mail flow › Rules, AzureRMSLicensingEnabled.1Symptoms2Why it happens3How to fix it4Verify the fix5Key takeawaysTOOLBOXTest-IRMConfigurationGet-IRMConfigurationConnect-AipServiceMail flow › RulesAzureRMSLicensingEnabledHow this guide is organized: Symptoms → Why it happens → How to fix it → Verify the fix → Key takeawaysFlow diagram of the article's sections in reading order: 1. Symptoms. 2. Why it happens. 3. How to fix it. 4. Verify the fix. 5. Key takeaways. Toolbox: Test-IRMConfiguration, Get-IRMConfiguration, Connect-AipService, Mail flow › Rules, AzureRMSLicensingEnabled.1Symptoms2Why it happens3How to fix it4Verify the fix5Key takeawaysTOOLBOXTest-IRMConfigurationGet-IRMConfigurationConnect-AipServiceMail flow › RulesAzureRMSLicensingEnabled
At a glance: how this guide is organized · 5 sections · 5 key tools

Symptoms#

Test-IRMConfiguration in Exchange Online PowerShell fails at the first step:

Text
Results : Acquiring RMS Templates ...
- FAIL: Failed to acquire RMS templates. This failure may cause features such as Transport Protection Rules, IRM in OWA, and IRM in EAS to not work.

OVERALL RESULT: FAIL
  • Get-IRMConfiguration shows AzureRMSLicensingEnabled : False.
  • When you build a mail flow rule, the RMS template list under Apply Office 365 Message Encryption and rights protection is empty.
  • Following an older guide, Import-RMSTrustedPublishingDomain -RMSOnline returns This cmdlet is deprecated. The Trusted Publishing Domain (TPD) for your organization is managed in Microsoft Azure Rights Management.
  • External recipients still get the old HTML-attachment format instead of the current experience.
  • A rule meant to encrypt incoming mail does nothing, or on-premises users' mail goes out unencrypted.

Why it happens#

Message Encryption is built on the Azure Rights Management service, the encryption service behind Microsoft Purview Information Protection. Microsoft says that's the only prerequisite. When the service is active, message encryption is enabled automatically, and Azure Rights Management is itself activated automatically for most eligible plans. Things break when:

  • Azure Rights Management was disabled or never activated, or the sender has no license that includes it.
  • The IRM configuration in Exchange Online is incomplete. AzureRMSLicensingEnabled is off, or the licensing location is missing, so Exchange can't get the templates.
  • The tenant still uses AD RMS. Message Encryption isn't compatible with Active Directory Rights Management Services, so you have to migrate to Azure Rights Management first.
  • Old rules. Rules that still use Apply the previous version of OME keep sending the legacy format. Microsoft deprecated the legacy Office 365 Message Encryption as of July 1, 2023.
  • Expectations that don't match the design. You can't encrypt inbound mail from outside senders; it's delivered unencrypted. In hybrid, on-premises users get encryption only when their mail is routed through Exchange Online.

How to fix it#

Finding the layer that breaks Message EncryptionDoes Get-AipService return Enabled? if No: Activate Azure Rights Management (Run Enable-AipService. AD RMS tenants migrate first.); if Yes: Does Test-IRMConfiguration pass? if Fails: Is AzureRMSLicensingEnabled True? if No: Set it to $true (Change it in the IRM configuration, then test again.); if Yes: Set the licensing location (Copy the licensing URL from the Rights Management configuration.); if Passes: Does the mail come from outside senders? if Yes: Inbound mail isn't encrypted (Rules encrypt outbound and internal mail only.); if No: Fix the mail flow rule (Replace any Apply the previous version of OME action.)Does Get-AipService returnEnabled?FIXActivate AzureRightsManagementRunEnable-AipService.AD RMS tenantsmigrate first.NoDoes Test-IRMConfigurationpass?Is AzureRMSLicensingEnabledTrue?FIXSet it to $trueChange it in the IRMconfiguration, thentest again.NoFIXSet the licensinglocationCopy the licensingURL from the RightsManagementconfiguration.YesFailsDoes the mail come fromoutside senders?NOTEInbound mail isn'tencryptedRules encryptoutbound andinternal mail only.YesFIXFix the mail flowruleReplace any Applythe previous versionof OME action.NoPassesYesFinding the layer that breaks Message EncryptionDoes Get-AipService return Enabled? if No: Activate Azure Rights Management (Run Enable-AipService. AD RMS tenants migrate first.); if Yes: Does Test-IRMConfiguration pass? if Fails: Is AzureRMSLicensingEnabled True? if No: Set it to $true (Change it in the IRM configuration, then test again.); if Yes: Set the licensing location (Copy the licensing URL from the Rights Management configuration.); if Passes: Does the mail come from outside senders? if Yes: Inbound mail isn't encrypted (Rules encrypt outbound and internal mail only.); if No: Fix the mail flow rule (Replace any Apply the previous version of OME action.)Does Get-AipService return Enabled?NoFIXActivate Azure Rights ManagementRun Enable-AipService. AD RMS tenants migrate first.YesDoes Test-IRMConfiguration pass?FailsIs AzureRMSLicensingEnabled True?NoFIXSet it to $trueChange it in the IRM configuration, then testagain.YesFIXSet the licensing locationCopy the licensing URL from the RightsManagement configuration.PassesDoes the mail come from outsidesenders?YesNOTEInbound mail isn't encryptedRules encrypt outbound and internal mailonly.NoFIXFix the mail flow ruleReplace any Apply the previous version ofOME action.
Figure 1 · Decision tree Finding the layer that breaks Message Encryption. Check Azure Rights Management first, then the IRM configuration in Exchange Online, then the rules. Test-IRMConfiguration is the quickest health check.
  1. Check the IRM configuration in Exchange Online.
    PowerShell
    Connect-ExchangeOnline
    Get-IRMConfiguration | Format-List AzureRMSLicensingEnabled, InternalLicensingEnabled, LicensingLocation
    
    # If AzureRMSLicensingEnabled is False
    Set-IRMConfiguration -AzureRMSLicensingEnabled $true
  2. Confirm Azure Rights Management is active. Use the AIPService module. If Connect-AipService fails in PowerShell 7, run it in Windows PowerShell 5.1:
    PowerShell
    Install-Module -Name AIPService -Scope CurrentUser
    Connect-AipService
    Get-AipService      # should return Enabled
    Enable-AipService   # only if it returned Disabled
  3. Fix "Failed to acquire RMS templates". Microsoft's documented fix copies the licensing URL from the Rights Management configuration into the Exchange Online IRM configuration. Run it in a session that's connected to both services:
    PowerShell
    $RMSConfig = Get-AipServiceConfiguration
    $LicenseUri = $RMSConfig.LicensingIntranetDistributionPointUrl
    Set-IRMConfiguration -LicensingLocation $LicenseUri
    Set-IRMConfiguration -InternalLicensingEnabled $true
    Don't use Import-RMSTrustedPublishingDomain -RMSOnline from older guides. As the error says, Azure Rights Management now manages the trusted publishing domain.
  4. Create or update the mail flow rule. In the Exchange admin center, go to Mail flow › Rules. Under Do the following, choose Modify the message security › Apply Office 365 Message Encryption and rights protection and pick a template: Encrypt, Do Not Forward or one of your own. Remove any Apply the previous version of OME action from older rules. In PowerShell:
    PowerShell
    New-TransportRule -Name "Encrypt external [secure] mail" -FromScope InOrganization -SentToScope NotInOrganization `
        -SubjectContainsWords "[secure]" -ApplyRightsProtectionTemplate "Encrypt"
    To take encryption off mail from inside the organization, use Remove Office 365 Message Encryption and rights protection applied by the organization. For rule order and exceptions, see mail flow rules that don't backfire.
  5. Check how recipients can open messages. People outside Microsoft 365 open an encrypted message through a portal. They sign in with an account the service supports or request a one-time passcode by email. If they never see the passcode option, check the branding template:
    PowerShell
    Get-OMEConfiguration | Format-List Identity, OTPEnabled, SocialIdSignIn
  6. Hybrid: route on-premises mail through Exchange Online. The Exchange Server equivalent, with the RMS connector, is covered in Exchange Server IRM with the RMS connector.

Verify the fix#

Run the test with any two users in your tenant:

PowerShell
Test-IRMConfiguration -Sender securityadmin@contoso.com -Recipient securityadmin@contoso.com

Good looks like this, with your organization's name and template names:

Text
Acquiring RMS Templates ...
- PASS: RMS Templates acquired. Templates available: Contoso - Confidential View Only, Contoso - Confidential, Do Not Forward.
Verifying encryption ...
- PASS: Encryption verified successfully.
Verifying decryption ...
- PASS: Decryption verified successfully.
Verifying IRM is enabled ...
- PASS: IRM verified successfully.

OVERALL RESULT: PASS
  • Send a message that matches the rule to an external mailbox you control. It should arrive encrypted and open after sign-in or a one-time passcode.
  • In message trace, the message's details should show your mail flow rule acting on it.
  • In Outlook on the web, users should see the Encrypt option once their license includes Azure Rights Management.

Key takeaways#

  • Check Azure Rights Management first, then AzureRMSLicensingEnabled, then the rules.
  • Test-IRMConfiguration with -Sender and -Recipient is the quickest health check. Run it again after every change.
  • Rules encrypt outbound and internal mail, not mail arriving from outside.
  • Retire legacy OME actions and AD RMS before you troubleshoot anything else.

References#

Written and checked against current Microsoft Learn documentation. Test changes with a pilot group before rolling them out to everyone, and if an admin center path has moved since, search for the setting name instead.

Spotted a mistake, or did this fix work differently for you? Email me or message me on LinkedIn — corrections are credited in the article.

Written by

Omer Eltayeb

Intune Subject Matter Expert in Cairo, Egypt, former Microsoft Cloud Solutions Architect, Microsoft Certified Trainer and Microsoft Innovative Educator Expert (2024–26) and Microsoft Elevate Educator Expert (2026–27). I share practical, step-by-step guides, study plans, scripts and toolkits for Microsoft Intune, Configuration Manager, Microsoft Entra ID, Microsoft Defender, Exchange and Microsoft 365 with the community.

Microsoft Certified Trainer (MCT) 2026Microsoft Innovative Educator Expert 2025–2026Microsoft Elevate Educator Expert 2026–2027ISC2 Certified Information Systems Security Professional (CISSP)Microsoft 365 Certified: Enterprise Administrator Expert (MS-102)