Sync New Active Directory with Existing Office 365 Tenant

Published on
3,747 Points
1 Endorsement
Last Modified:
Synchronize a new Active Directory domain with an existing Office 365 tenant
These are some high level projects tasks I put together based on an existing Office 365 tenant who is creating a "greenfield" (new) on premise Active Directory forest/domain for the purpose of being able to manage Office 365 users through the utilization of Active Directory synchronization.
1.  Connect to Office 365 via Azure AD PowerShell Module with customer's Office 365 global admin account.
2.  From the Azure AD PowerShell console, collect user information from Office 365 using this command. The exported data will be used to create on premise Active Directory user objects that will be synchronized with the associated O365 users.
Get-User | Export-Csv "C:\O365Export.csv" –NoTypeInformation
3.  Add UPN suffix(es) in Active Directory Domains and Trusts to match email domain(s) in Office 365 (as needed).
4.  Create OU(s) for filtering of users (as needed).
5.  From Windows PowerShell, create new Active Directory users from CSV file. Using this command with the CSV file created in step 2, AD users are added based on an UPN suffix, to a specific OU, and assigned a password that does not expire.
Import-Csv "C:\O365Export.csv" | ForEach-Object{ $Domain = "@CompanyA.com"; $UPN = $_.Identity+$Domain; New-ADUser -SamAccountName $_.Identity -UserPrincipalName $UPN -Name $_.Name -DisplayName $_.DisplayName -GivenName $_.FirstName -Initials $_.initials -Surname $_.LastName -Department $_.Department -Company $_.Company -Fax $_.Fax -City $_.City -State $_.StateOrProvince -PostalCode $_.PostalCode -Title $_.Title -EmailAddress $_.WindowsEmailAddress -Office $_.Office -OfficePhone $_.Phone -MobilePhone $_.MobilePhone -StreeAddress $_.StreetAddress -Path "OU=Users,OU=Company A,DC=onpremdomain,DC=local" -AccountPassword (ConvertTo-SecureString "Password" -AsPlainText -Force) -Enabled $True -PasswordNeverExpires $True -PassThru }
6.  After the user objects are created, have users log on to their newly domain joined workstations with their Active Directory account to change passwords to what they currently have set in Office 365.
7.  Download Azure Active Directory Connect (AAD Connect).
8.  Create AAD Connect service account (in Active Directory) and set as a member of the Enterprise Admins group.
9.  Prepare member server to install AAD Connect on...
  • Set AAD Connect service account as a member of the Local Administrators group
  • Log in as AAD Connect service account
10.  Install AAD Connect (with Express Settings).
  • Provide O365 global admin account
  • Provide AAD Connect service account
  • Use Express Settings
  • Do not enable start synchronization (we will start later)
  • Reboot after install to verify "Microsoft Azure AD Sync" service has started
  • If the service doesn't start, make sure the "AAD_" auto created account is set to "log on as a service" in the "Local Security Policy"
11.  Configure filtering with AAD Connect.
  • Configure to sync accounts in previously created OU(s)
  • Run manual sync per article
12.  From O365 Admin Center, enable Active Directory synchronization via Users > Active Users.
13.  Check Office 365 for account status of "Synchronized with Active Directory" instead of "In cloud".
Author:Todd Nelson

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Join & Write a Comment

This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
A query can call a function, and a function can call Excel, even though we are in Access. This is Part 2, and steps you through the VBA that "wraps" Excel functionality so we can use its worksheet functions in Access. The declaration statement de…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month