Reputation: 233
I've got an Azure DevOps Release Pipeline and I'm trying to deploy a SQL Database.
Here is the YAML for the task:
steps:
- task: SqlAzureDacpacDeployment@1
displayName: 'Azure SQL DacpacTask'
inputs:
azureSubscription: 'Dev/Test Connection'
AuthenticationType: aadAuthenticationIntegrated
ServerName: 'myserver.database.windows.net'
DatabaseName: 'mydb'
DacpacFile: '$(System.DefaultWorkingDirectory)/PATHTOMYFILE.Db.dacpac'
DeleteFirewallRule: false
The error in the log are somewhat vague:
[debug]The Azure SQL DACPAC task failed. SqlPackage.exe exited with code 1.Check out how to troubleshoot failures at...
However the log also says this:
[debug]Processed: ##vso[task.logissue type=error]*** An unexpected failure occurred: One or more errors occurred.. [debug]No Firewall Rule was added
I know that a firewall rule must be added for IPs trying to Access Azure SQL. My understanding is that the task will try to create the firewall exception for me based on the IP address of the Agent being used. But the log says "no firewall rule was added". You may notice that I have set DeleteFirewallRule: false
. I wasn't sure if the rules were getting created and then deleted, this setting would keep them available for me to check. But again, none were created.
I can't add the firewall rule manually in the Azure Portal because the Agent will be different each time the release pipeline runs. Does anyone have any ideas on how to resolve this?
Upvotes: 4
Views: 4308
Reputation: 233
The error messages for this task are not very clear at all. After trying a bunch of different ways to resolve this, I took a shot at changing the authentication mode.
steps:
- task: SqlAzureDacpacDeployment@1
displayName: 'Azure SQL DacpacTask'
inputs:
azureSubscription: 'Dev/Test Connection'
ServerName: 'myserver.database.windows.net'
DatabaseName: 'mydb'
SqlUsername: '$(dbdeployuser)'
SqlPassword: '$(dbdeploypassword)'
DacpacFile: '$(System.DefaultWorkingDirectory)/PATHTOMYFILE.Db.dacpac'
DeleteFirewallRule: false
Once I did this, it worked. So the problem is not the firewall at all.
Upvotes: 1