Can't install Azure AD Connect Cloud Sync silently without user interaction


I am trying to follow this guide to install Azure AD Connect Cloud Sync using Powershell, ideally silently without user interaction:

When trying to connect using the following commands, a login window opens instead of accepting my credentials.

$globalAdminPassword = ConvertTo-SecureString -String "Global admin password" -AsPlainText -Force
$globalAdminCreds = New-Object System.Management.Automation.PSCredential -ArgumentList ("GlobalAdmin@Company portal", $globalAdminPassword)
Connect-AADCloudSyncAzureAD -Credential $globalAdminCreds
I need to automate this so I don't understand why the credential I pass in this function don't seem to do anything and I get prompted with a login screen.

Any idea? I tried some powershell commands like NonInteractive or WindowStyle hidden, but no luck.

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,407 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,849 questions
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous

    Found the problem! My password had a special character "`" which was disappearing using the above command. I found the difference using Get-Credential instead and converting the secure string back...

0 additional answers

Sort by: Most helpful