In one of the projects using Azure devops deployment pipelines the deployment worked on Staging, but failed on production server. Logs indicated that a command using Invoke-Sqlcmd failed to authenticate the user. Error returned was of the form
The problem here is related to special characters in the password. So if Invoke-Sqlcmd command has special characters in a password and the password is enclosed with double quotes, it does not treat the password as literal string and instead tries to interpret it in different way. Thus the authentication fails.
Unfortunately since VSTS does not allow password to be passed using single quotes, the only option we have is to change the user's password.
More information about this error can be found at:
https://mohitgoyal.co/2017/08/09/vsts-azure-sql-database-deployment-task-keeps-failing-with-error-login-failed-for-user/
and also at
https://stackoverflow.com/questions/22335651/powershell-invoke-sqlcmd-login-failed
Many thanks to them.
Login failed for user '<User Id>'
The problem here is related to special characters in the password. So if Invoke-Sqlcmd command has special characters in a password and the password is enclosed with double quotes, it does not treat the password as literal string and instead tries to interpret it in different way. Thus the authentication fails.
Unfortunately since VSTS does not allow password to be passed using single quotes, the only option we have is to change the user's password.
More information about this error can be found at:
https://mohitgoyal.co/2017/08/09/vsts-azure-sql-database-deployment-task-keeps-failing-with-error-login-failed-for-user/
and also at
https://stackoverflow.com/questions/22335651/powershell-invoke-sqlcmd-login-failed
Many thanks to them.
No comments:
Post a Comment