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.
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 MSOnline3. Enter Yes to install PSGallery.
4. Run the below cmdlets to connect Microsoft 365 Tenant. Enter your username and password and click OK.
$msolcred = get-credentialconnect-msolservice -credential $msolcred5. Run the below cmdlet to disable directory synchronization and enter Yes to confirm.
Set-MsolDirSyncEnabled –EnableDirSync $false6. Run the below cmdlet to check the directory synchronization status.
(Get-MSOLCompanyInformation).DirectorySynchronizationEnabled7. Run the below cmdlet to remove the Directory Synchronization Service Account and enter Yes to confirm.
Remove-MsolUser -UserPrincipalName Sync_ADCONNECT01_ce8add722dc4@angussun.onmicrosoft.com8. Ensure the Sync_ADCONNECT01_ce8add722dc4@angussun.onmicrosoft.com.
9. Run the below cmdlet to enable directory synchronization and enter Yes to confirm.
Set-MsolDirSyncEnabled -EnableDirSync $true10. Run the below cmdlet to check the directory synchronization status.
(Get-MSOLCompanyInformation).DirectorySynchronizationEnabledI hope you enjoy this post.
Cary Sun
Twitter: @SifuSun
Web Site: carysun.com
Blog Site: checkyourlogs.net
Blog Site: gooddealmart.com
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