February 29, 2024
030423 0248 HowtoRemove3 - How to Remove On-Premises Directory Synchronization Service Account from Microsoft 365
If you are trying to rebuild the Azure AD Connect server, but you noticed y the Delete user is greyed out and you cannot delete the existing On-Premises Directory Synchronization Service Account from Microsoft 365 admin center.

If you are trying to rebuild the Azure AD Connect server, but you noticed y the Delete user is greyed out and you cannot delete the existing On-Premises Directory Synchronization Service Account from Microsoft 365 admin center.

030423 0248 HowtoRemove1 - How to Remove On-Premises Directory Synchronization Service Account from Microsoft 365

I will show you how to use the PowerShell cmdlets to remove it.

1. Open a Windows PowerShell Command Prompt window.

2. Run the below command and enter Yes to install and import the NuGet provider.


Install-Module MSOnline

030423 0248 HowtoRemove2 - How to Remove On-Premises Directory Synchronization Service Account from Microsoft 365

3. Enter Yes to install PSGallery.

030423 0248 HowtoRemove3 - How to Remove On-Premises Directory Synchronization Service Account from Microsoft 365

4. Run the below cmdlets to connect Microsoft 365 Tenant. Enter your username and password and click OK.


$msolcred = get-credential

030423 0248 HowtoRemove4 - How to Remove On-Premises Directory Synchronization Service Account from Microsoft 365


connect-msolservice -credential $msolcred

030423 0248 HowtoRemove5 - How to Remove On-Premises Directory Synchronization Service Account from Microsoft 365

5. Run the below cmdlet to disable directory synchronization and enter Yes to confirm.


Set-MsolDirSyncEnabled –EnableDirSync $false

030423 0248 HowtoRemove6 - How to Remove On-Premises Directory Synchronization Service Account from Microsoft 365

6. Run the below cmdlet to check the directory synchronization status.


(Get-MSOLCompanyInformation).DirectorySynchronizationEnabled

030423 0248 HowtoRemove7 - How to Remove On-Premises Directory Synchronization Service Account from Microsoft 365

7. Run the below cmdlet to remove the Directory Synchronization Service Account and enter Yes to confirm.


Remove-MsolUser -UserPrincipalName Sync_ADCONNECT01_ce8add722dc4@angussun.onmicrosoft.com

030423 0248 HowtoRemove8 - How to Remove On-Premises Directory Synchronization Service Account from Microsoft 365

8. Ensure the Sync_ADCONNECT01_ce8add722dc4@angussun.onmicrosoft.com.

030423 0248 HowtoRemove9 - How to Remove On-Premises Directory Synchronization Service Account from Microsoft 365

9. Run the below cmdlet to enable directory synchronization and enter Yes to confirm.


Set-MsolDirSyncEnabled -EnableDirSync $true

030423 0248 HowtoRemove10 - How to Remove On-Premises Directory Synchronization Service Account from Microsoft 365

10. Run the below cmdlet to check the directory synchronization status.


(Get-MSOLCompanyInformation).DirectorySynchronizationEnabled

030423 0248 HowtoRemove11 - How to Remove On-Premises Directory Synchronization Service Account from Microsoft 365

I hope you enjoy this post.

Cary Sun

Twitter: @SifuSun

Web Site: carysun.com

Blog Site: checkyourlogs.net

Blog Site: gooddealmart.com

ca16fbd3199de5f66b829b87082fb970?s=80&d=retro&r=g - How to Remove On-Premises Directory Synchronization Service Account from Microsoft 365

Author: Cary Sun

Cary Sun has a wealth of knowledge and expertise in data center and deployment solutions. As a Principal Consultant, he likely works closely with clients to help them design, implement, and manage their data center infrastructure and deployment strategies.
With his background in data center solutions, Cary Sun may have experience in server and storage virtualization, network design and optimization, backup and disaster recovery planning, and security and compliance management. He holds CISCO CERTIFIED INTERNETWORK EXPERT (CCIE No.4531) from 1999. Cary is also a Microsoft Most Valuable Professional (MVP), Microsoft Azure MVP, Veeam Vanguard and Cisco Champion. He is a published author with several titles, including blogs on Checkyourlogs.net, and the author of many books.
Cary is a very active blogger at checkyourlogs.net and is permanently available online for questions from the community. His passion for technology is contagious, improving everyone around him at what they do.

Blog site: https://www.checkyourlogs.net
Web site: https://carysun.com
Blog site: https://gooddealmart.com
Twitter: @SifuSun
in: https://www.linkedin.com/in/sifusun/
Amazon Author: https://Amazon.com/author/carysun