Skip to content

Commit 98df3e6

Browse files
authored
Merge pull request #213613 from billmath/ric1
staging
2 parents 90c2cbf + 9c7a0b6 commit 98df3e6

File tree

2 files changed

+144
-1
lines changed

2 files changed

+144
-1
lines changed

articles/active-directory/hybrid/TOC.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,4 +403,6 @@
403403
- name: msExchUserHoldPolicies and cloudMSExchUserHoldPolicies
404404
href: reference-connect-msexchuserholdpolicies.md
405405
- name: Azure AD Connect version history archive
406-
href: reference-connect-version-history-archive.md
406+
href: reference-connect-version-history-archive.md
407+
- name: How to use BypassDirSyncOverrides
408+
href: how-to-bypassdirsyncoverrides.md
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
---
2+
title: How to use the BypassDirSyncOverrides feature of an Azure AD tenant
3+
description: Describes how to use bypassdirsyncoverrides tenant feature to restore synchronization of Mobile and OtherMobile attributes from on-premises Active Directory.
4+
services: active-directory
5+
author: billmath
6+
ms.date: 08/11/2022
7+
ms.author: billmath
8+
ms.topic: how-to
9+
ms.service: active-directory
10+
ms.workload: identity
11+
ms.subservice: hybrid
12+
---
13+
14+
# How to use the BypassDirSyncOverrides feature of an Azure AD tenant.
15+
16+
This article describes the _BypassDirsyncOverrides_  feature and how to restore synchronization of Mobile and otherMobile attributes from Azure AD to on-premises Active Directory.
17+
18+
Generally, synchronized users cannot be changed from Azure or Microsoft 365 admin portals, neither through PowerShell using AzureAD or MSOnline modules. The exception to this is the Azure AD user’s attributes called _MobilePhone_ and _AlternateMobilePhones_. These attributes are synchronized from on-premises Active Directory attributes mobile and otherMobile, respectively, but end users can update their own phone number in _MobilePhone_ attribute in Azure AD through their profile page. Admins can also update synchronized user’s _MobilePhone_ and _AlternateMobilePhones_ values in Azure AD using MSOnline PowerShell module.
19+
20+
Giving users and admins the ability to update phone numbers directly in Azure AD enables enterprises to reduce the administrative overhead of managing user’s phone numbers in local Active Directory as these can change more frequently.
21+
22+
The caveat however, is that once a synchronized user's _MobilePhone_ or _AlternateMobilePhones_ number is updated via admin portal or PowerShell, the synchronization API will no longer honor updates to these attributes when they originate from on-premises Active Directory. This is commonly known as a _“DirSyncOverrides”_ feature. Administrators will notice this behavior when updates to Mobile or otherMobile attributes in Active Directory, do not update the correspondent user’s MobilePhone or AlternateMobilePhones in Azure AD accordingly, even though, the object is successfully synchronized through Azure AD Connect's engine.
23+
24+
## Identifying users with different Mobile and otherMobile values
25+
26+
You can export a list of users with different Mobile and otherMobile values between Active Directory and Azure Active Directory using _‘Compare-ADSyncToolsDirSyncOverrides’_ from _ADSyncTools_ PowerShell module. This will allow you to determine the users and respective values that are different between on-premises Active Directory and Azure Active Directory. This is important to know because enabling the _BypassDirSyncOverrides_ feature will overwrite all the different values in Azure Active Directory with the value coming from on-premises Active Directory.
27+
28+
### Using Compare-ADSyncToolsDirSyncOverrides
29+
30+
As a prerequisite you need to be running Azure AD Connect version 2 or later and install the latest ADSyncTools module from PowerShell Gallery with the following command:
31+
32+
```powershell
33+
Install-Module ADSyncTools
34+
```
35+
36+
To compare all the synchronized user’s Mobile and OtherMobile values, run the following command:
37+
38+
```powershell
39+
Compare-ADSyncToolsDirSyncOverrides -Credential $(Get-Credential)
40+
```
41+
42+
>[!NOTE]
43+
> The target API used by this feature does not handle authentication user interactions. MFA or conditional policies will block authentication. When prompted to enter credentials, please use a Global Administrator account that doesn't have MFA enabled or any conditional access policy applied. As a last resort, please create a temporary Global Administrator user account without MFA or Conditional Access that can be deleted after completing the desired operations using the BypassDirSyncOverridees feature.
44+
45+
This function will export a CSV file with a list of users where Mobile or OtherMobile values in on-premises Active Directory are different than the respective MobilePhone or AlternateMobilePhones in Azure AD.
46+
47+
At this stage you can use this data to reset the values of the on-premises Active Directory _Mobile_ and _otherMobile_ properties to the values that are present in Azure Active Directory. This way you can capture the most updated phone numbers from Azure AD and persist this data in on-premises Active Directory, before enabling _BypassDirSyncOverrides_ feature. To do this, import the data from the resulting CSV file and then use the _'Set-ADSyncToolsDirSyncOverrides'_ from _ADSyncTools_ module to persist the value in on-premises Active Directory.
48+
49+
For example, to import data from the CSV file and extract the values in Azure AD for a given UserPrincipalName, use the following command:
50+
51+
```powershell
52+
$upn = '<UserPrincipalName>'
53+
$user = Import-Csv 'ADSyncTools-DirSyncOverrides_yyyyMMMdd-HHmmss.csv' |
54+
where UserPrincipalName -eq $upn |
55+
select UserPrincipalName,*InAAD
56+
Set-ADSyncToolsDirSyncOverridesUser -Identity $upn -MobileInAD $user.MobileInAAD
57+
```
58+
59+
## Enabling BypassDirSyncOverrides feature
60+
61+
By default, _BypassDirSyncOverrides_ feature is turned off. Enabling _BypassDirSyncOverrides_ allows your tenant to bypass any changes made in _MobilePhone_ or _AlternateMobilePhones_ by users or admins directly in Azure AD and always honor the values present in on-premises Active Directory _Mobile_ or _OtherMobile_.
62+
63+
If you do not wish to have end users updating their own mobile phone number or there is no requirement to have admins updating mobile or alternative mobile phone numbers using PowerShell, you should leave the feature _BypassDirsyncOverrides_ enabled on the tenant.
64+
65+
With this feature turned on, even if an end user or admin updates either _MobilePhone_ or _AlternateMobilePhones_ in Azure Active Directory, the values synchronized from on-premises Active Directory will persist upon the next sync cycle. This means that any updates to these values only persist when the update is performed in on-premises Active Directory and then synchronized to Azure Active Directory.
66+
67+
### Enable the _BypassDirSyncOverrides_ feature:
68+
69+
To enable BypassDirSyncOverrides  feature use the MSOnline PowerShell module.
70+
71+
```powershell
72+
Set-MsolDirSyncFeature -Feature BypassdirSyncOverrides -Enable $true
73+
```
74+
75+
Once the feature is enabled, start a full synchronization cycle in Azure AD Connect using the following command:
76+
77+
```powershell
78+
Start-ADSyncSyncCycle -PolicyType Initial
79+
```
80+
81+
[!NOTE] Only objects with a different _MobilePhone_ or _AlternateMobilePhones_ value from on-premises Active Directory will be updated.
82+
83+
### Verify the status of the _BypassDirSyncOverrides_ feature:
84+
85+
```powershell
86+
Get-MsolDirSyncFeatures -Feature BypassdirSyncOverrides
87+
```
88+
89+
## Disabling _BypassDirSyncOverrides_ feature
90+
91+
If you desire to restore the ability to update mobile phone numbers from the portal or PowerShell, you can disable _BypassDirSyncOverrides_ feature using the following Microsoft Online PowerShell module command:
92+
93+
```powershell
94+
Set-MsolDirSyncFeature -Feature BypassdirSyncOverrides -Enable $false
95+
```
96+
97+
When this feature is turned off, anytime a user or admin updates the _MobilePhone_ or _AlternateMobilePhones_ directly in Azure AD, a _DirSyncOverrides_ is created which prevents any future updates to these attributes coming from on-premises Active Directory. From this point on, a user or admin can only manage these attributes from Azure AD as any new updates from on-premises _Mobile_ or _OtherMobile_ will be dismissed.
98+
99+
## Managing mobile phone numbers in Azure AD and on-premises Active Directory
100+
101+
To manage the user’s phone numbers, an admin can use the following set of functions from _ADSyncTools_ module to read, write and clear the values in either Azure AD or on-premises Active Directory.
102+
103+
### Get _Mobile_ and _OtherMobile_ properties from on-premises Active Directory:
104+
105+
```powershell
106+
Get-ADSyncToolsDirSyncOverridesUser '[email protected]' -FromAD
107+
```
108+
109+
### Get _MobilePhone_ and _AlternateMobilePhones_ properties from Azure AD:
110+
111+
```powershell
112+
Get-ADSyncToolsDirSyncOverridesUser '[email protected]' -FromAzureAD
113+
```
114+
115+
### Set _MobilePhone_ and _AlternateMobilePhones_ properties in Azure AD:
116+
117+
```powershell
118+
Set-ADSyncToolsDirSyncOverridesUser '[email protected]' -MobileInAD '999888777' -OtherMobileInAD '0987654','1234567'
119+
```
120+
121+
### Set _Mobile_ and _otherMobile_ properties in on-premises Active Directory:
122+
123+
```powershell
124+
Set-ADSyncToolsDirSyncOverridesUser '[email protected]' -MobilePhoneInAAD '999888777' -AlternateMobilePhonesInAAD '0987654','1234567'
125+
```
126+
127+
### Clear _MobilePhone_ and _AlternateMobilePhones_ properties in Azure AD:
128+
129+
```powershell
130+
Clear-ADSyncToolsDirSyncOverridesUser '[email protected]' -MobileInAD -OtherMobileInAD
131+
```
132+
133+
### Clear _Mobile_ and _otherMobile_ properties in on-premises Active Directory:
134+
135+
```powershell
136+
Clear-ADSyncToolsDirSyncOverridesUser '[email protected]' -MobilePhoneInAAD -AlternateMobilePhonesInAAD
137+
```
138+
139+
## Next Steps
140+
141+
Learn more about [Azure AD Connect: ADSyncTools PowerShell Module](reference-connect-adsynctools.md)

0 commit comments

Comments
 (0)