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...
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:
https://learn.microsoft.com/en-us/azure/active-directory/cloud-sync/how-to-install-pshell
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 .onmicrosoft.com", $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.