Hiding Mailboxes from Global Address List Using Entra ID Connect
This guide explains how to configure Entra ID Connect to automatically hide mailboxes from the Global Address List (GAL) in Exchange Online based on an on-premises Active Directory attribute.
Alternative: Cloud-Managed Attribute
If you don't need to manage GAL visibility from on-premises AD, you can use Exchange Online's native feature:
This changes the source of authority to Exchange Online, avoiding sync conflicts. Use the method below if you need centralized management from on-premises AD.Prerequisites
- Entra ID Connect is installed and configured
- Administrative access to the Entra ID Connect server
- Administrative access to on-premises Active Directory
- Administrative access to Exchange Online PowerShell
Configuration Steps
Step 1: Open Synchronization Rules Editor
- Log into your Entra ID Connect server
- Launch Synchronization Rules Editor
- Click Add new rule to create a custom sync rule
Step 2: Configure Rule Description
| Property | Value |
|---|---|
| Name | HideFromGAL Mapping |
| Description | Map msDS-cloudExtensionAttribute1 to msExchHideFromAddressLists |
| Connected System | Select your on-premises Active Directory connector |
| Connected System Object Type | user |
| Metaverse Object Type | person |
| Link Type | Join |
| Precedence | 100 (must be lower than default Exchange rules) |
Precedence Value
Set precedence to a value lower than default Exchange sync rules (typically below 100). Lower numbers = higher priority.
Leave unchecked: - Enable Password Sync - Disabled
Step 3: Configure Scoping Filter
- Click Add Group
- Click Add Clause
- Configure the clause:
- Attribute:
msDS-cloudExtensionAttribute1 - Operator:
ISNOTNULL
Step 4: Configure Transformations
- Click Add transformation
- Configure the transformation:
- Flow Type:
Expression - Target Attribute:
msExchHideFromAddressLists - Source:
IIF([msDS-cloudExtensionAttribute1] = "HideFromGAL", True, False) - Apply Once: Unchecked
- Merge Type:
Update
Step 5: Save and Synchronize
- Click OK to save the sync rule
- Run a full synchronization:
Step 6: Verify Configuration
# Check a specific mailbox
Get-Mailbox -Identity "user@domain.com" | Select-Object DisplayName, HiddenFromAddressListsEnabled
# Check all hidden mailboxes
Get-Mailbox -ResultSize Unlimited | Where-Object {$_.HiddenFromAddressListsEnabled -eq $true} | Select-Object DisplayName, PrimarySmtpAddress
Setting the Attribute in Active Directory
Using PowerShell
# Hide a user from GAL
Set-ADUser -Identity "username" -Add @{"msDS-cloudExtensionAttribute1"="HideFromGAL"}
# Show a user in GAL (remove attribute)
Set-ADUser -Identity "username" -Clear msDS-cloudExtensionAttribute1
# Verify the attribute
Get-ADUser -Identity "username" -Properties msDS-cloudExtensionAttribute1 | Select-Object Name, msDS-cloudExtensionAttribute1
Using Active Directory Users and Computers
- Open Active Directory Users and Computers
- Enable Advanced Features (View menu)
- Right-click the user → Properties
- Go to the Attribute Editor tab
- Find
msDS-cloudExtensionAttribute1 - Set the value to:
HideFromGAL - Click OK and wait for the next sync cycle
Bulk Operations
# Hide all users in a specific OU
Get-ADUser -SearchBase "OU=Service Accounts,DC=contoso,DC=com" -Filter * |
Set-ADUser -Add @{"msDS-cloudExtensionAttribute1"="HideFromGAL"}
# Hide users from a CSV file
$users = Import-Csv -Path "C:\users_to_hide.csv"
foreach ($user in $users) {
Set-ADUser -Identity $user.SamAccountName -Add @{"msDS-cloudExtensionAttribute1"="HideFromGAL"}
}
# Trigger sync after bulk changes
Start-ADSyncSyncCycle -PolicyType Delta
Troubleshooting
Changes Not Appearing in Exchange Online
Solutions:
- Verify the sync rule is active in Synchronization Rules Editor
- Run a full sync: Start-ADSyncSyncCycle -PolicyType Initial
- Check Entra ID Connect sync errors in Synchronization Service Manager
- Verify the attribute value is exactly "HideFromGAL" (case-sensitive)
- Wait 15-30 minutes for changes to propagate
Sync Rule Not Taking Effect
Solutions: - Check the precedence value is lower than existing Exchange rules - Verify the scoping filter is correct - Ensure the Connected System matches your AD connector name - Review sync rule order in Synchronization Rules Editor
Sync Cycle Fails
Solutions:
- Check expression syntax in the transformation
- Review sync errors in Event Viewer (Application log)
- Verify Entra ID Connect service is running
- Review logs in: C:\ProgramData\AADConnect\trace-*.log
Related Documentation
- Entra ID Connect Sync: Understanding the Default Configuration
- Entra ID Connect Sync: Understanding Declarative Provisioning Expressions
- Hide mailboxes from Exchange Online address lists
This guide applies to Entra ID Connect (formerly Azure AD Connect) in hybrid Exchange environments.