Azure SQL Database Deployment Task `Active Directory - Password` Bug
See original GitHub issueRequired Information
Type: Bug
Enter Task Name: Azure SQL Database Deployment Task
Environment
- Server - Azure Pipelines Hosted
windows-2019
Issue Description
When using the Azure SQL Database Deployment task with the Active Directory - Password
Authentication Type, the task will not complete if there is a dollar sign ($) in the password.
This issue is similar but ultimately different than the issue reported here: #12012
Steps to Reproduce
- Create an Active Directory user with a dollar sign ($) in password
- Create another Active Directory user with no special chars in password
- Grant permissions to both accounts to Azure SQL Server
- Create Azure SQL Database Deployment Task
- Select
Active Directory - Password
Authentication Type - Test Both user accounts with Task
- Observe failure when user with dollar sign ($) in password is used
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:12 (4 by maintainers)
Top Results From Across the Web
Azure SQL Database Deployment task fails with Active Directory
Please help us to check if the Azure SQL Database Deployment task works fine when using the SQL Server Authentication or the Active...
Read more >Non-breaking error AADSTS50196 at end of SQLPackage.exe ...
The deployment is successful overall, and the same error occurs when running either locally or via a devops Release using the latest version...
Read more >Invalid username or password Errors During Azure SQL ...
Appearances can be deceiving on this one - the error would seem to suggest that the incorrect username or password values have been...
Read more >Deployment issues when publishing Azure SQL database ...
When Service principal is a member of Active Directory Admin of Azure SQL Server, the deployment works fine. But , when Service principal...
Read more >Authentication Error in Azure Devops when Deploying DACPAC
For the deployment step, I use the built-in Azure SQL Database ... use 'Authentication=Active Directory Interactive' with 'Password' or ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I went ahead and looked into the source code. I’ve discovered that the password is not being escaped for all authentication methods. The password is only escaped (on line 260) when authentication type is
server
: https://github.com/microsoft/azure-pipelines-tasks/blob/c763c141845d8f8a9eae9571c9df8c63f5a44dd7/Tasks/SqlAzureDacpacDeploymentV1/SqlAzureActions.ps1#L253-L260When authentication type is
aadAuthenticationPassword
oraadAuthenticationIntegrated
, theGet-AADAuthenticationConnectionString
function is called: https://github.com/microsoft/azure-pipelines-tasks/blob/c763c141845d8f8a9eae9571c9df8c63f5a44dd7/Tasks/SqlAzureDacpacDeploymentV1/SqlAzureActions.ps1#L277-L282The
Get-AADAuthenticationConnectionString
function builds the connection string without escaping password - allowing for special chars to be in the connection string: https://github.com/microsoft/azure-pipelines-tasks/blob/961d90a3b8d4390ea62066ff601a0c3fbc8ea538/Tasks/SqlAzureDacpacDeploymentV1/Utility.ps1#L249-L251Probable Solution:
Ensure the password is escaped for all authentication types by using
EscapeSpecialChars
function at the top of the function. This can be achieved by moving line 260 to line 252, aboveif
statement.https://github.com/microsoft/azure-pipelines-tasks/blob/c763c141845d8f8a9eae9571c9df8c63f5a44dd7/Tasks/SqlAzureDacpacDeploymentV1/SqlAzureActions.ps1#L252-L261
I’m not in a position to test this myself but hopefully this can jump-start a fix for this issue.
@AmrutaKawade I don’t think this resolves the issue. I should not care how this task is implemented under the hood - if it’s Powershell, Python or anything else. It’s not possible to escape all possible special characters in all languages. This should be fixed in the Task itself.