Login failed when using AD credentials from the command line
troyhunt
Posts: 17 Bronze 3
I'm trying to run SQL Compare 10 from the command line to sync a database under source control and a remote DB server as follows:
"C:\Program Files (x86)\Red Gate\SQL Compare 10\SQLCompare.exe" /scr1:[VCS location of DB] /server2:[server name] /db2:[DB name] /Include:identical /Report:Report/SchemaDiffReport.html /ReportType:Interactive /ScriptFile:Report/SchemaSyncScript.sql /Force /Sync /u2:[domain\username] /p2:[password]
Which results in the following:
Registering data sources
Error: Comparison of 'Scripts.Database' and
'[server.database]' failed: Login failed for user
'[domain\username]'.
Can the username and password params accept Active Directory credentials or only SQL logins? I've previously used integrated auth simply by omitting the credentials but in this case I'd really like to use a named AD account - is this feasible?
"C:\Program Files (x86)\Red Gate\SQL Compare 10\SQLCompare.exe" /scr1:[VCS location of DB] /server2:[server name] /db2:[DB name] /Include:identical /Report:Report/SchemaDiffReport.html /ReportType:Interactive /ScriptFile:Report/SchemaSyncScript.sql /Force /Sync /u2:[domain\username] /p2:[password]
Which results in the following:
Registering data sources
Error: Comparison of 'Scripts.Database' and
'[server.database]' failed: Login failed for user
'[domain\username]'.
Can the username and password params accept Active Directory credentials or only SQL logins? I've previously used integrated auth simply by omitting the credentials but in this case I'd really like to use a named AD account - is this feasible?
Comments
Is there any chance you can try using runas from the command line? Out of interest, what is kicking off the automation? If it's TeamCity, would it be a question of running the agent with a user that has the privileges you need?
David Atkinson
Product Manager
Red Gate
Product Manager
Redgate Software
This is mostly a problem when the build server is used for multiple autonomous projects. Basically the only way you can segregate out access rights is to specify credentials on a per-build basis which is why I wanted to pass these to the command line. It's not a biggie, it just means automation needs to happen using SQL logins instead of AD.
Thanks for clarifying!
Product Manager
Redgate Software
By adding an environment parameter of type "password" you can include the credentials in the build without disclosing them through any UIs.
Product Manager
Redgate Software