Reputation: 303
I am trying to deploy dacpac to an existing sql db, and getting the following error:
##[error]*** Could not deploy package. ##[error]Unable to connect to target server 'AAA.database.windows.net'. Please verify the connection information such as the server name, login credentials, and firewall rules for the target server. Cannot open server ##[error] 'MyMSSQlServer' requested by the login. Client is not allowed to access the server.
##[error]The Azure SQL DACPAC task failed. SqlPackage.exe exited with code 1.Check out how to troubleshoot failures at https://aka.ms/sqlazuredeployreadme#troubleshooting-
Here are my steps in release pipeline:
- download: current
artifact: databases
- task: SqlAzureDacpacDeployment@1
displayName: Execute Azure SQL Dacpac
inputs:
azureSubscription: 'MySuvscription'
ServerName: 'MyMSSQlServer.database.windows.net'
DatabaseName: 'AAA'
SqlUserName: 'mysqlserveradmin'
SqlPassword: 'mysqlserverpassword'
DacpacFile: '$(Pipeline.Workspace)\databases\foldera\folderb\folderc\folderd\MyApp.Database.dacpac'
IpDetectionMethod: AutoDetect
I assumed IpDetectionMethod should handle the access permission. Can anyone suggest how to fix this now?
Upvotes: 0
Views: 1941
Reputation: 303
- download: current
artifact: databases
- task: SqlAzureDacpacDeployment@1
displayName: Execute Azure SQL Dacpac
inputs:
azureSubscription: 'MySubscription'
ServerName: 'MyMSSQlServer.database.windows.net'
DatabaseName: 'AAA'
SqlUserName: 'mysqlserveradmin'
SqlPassword: 'mysqlserverpassword'
deployType: 'DacpacTask'
DeploymentAction: 'Publish'
DacpacFile: '$(Pipeline.Workspace)\databases\foldera\folderb\folderc\folderd\MyApp.Database.dacpac'
AdditionalArguments: //If you have any parameters, sql cmd variables please add here
IpDetectionMethod: 'IPAddressRange'
StartIpAddress: '0.0.0.0'
EndIpAddress: '0.0.0.0'
DeleteFirewallRule: true
Upvotes: 0
Reputation: 15698
Please make sure you have set the Azure SQL Firewall to allow Azure Services access to the database.
Upvotes: 2
Reputation: 46
The error message is showing the Database name where the Server name should be: Unable to connect to target server 'AAA.database.windows.net' instead of 'MyMSSQlServer.database.windows.net'.
Check if these parameters were entered correctly.
Upvotes: 1