skip to Main Content

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)databasesfolderafolderbfoldercfolderdMyApp.Database.dacpac'
    IpDetectionMethod: AutoDetect

I assumed IpDetectionMethod should handle the access permission. Can anyone suggest how to fix this now?

3

Answers


  1. Chosen as BEST ANSWER
    - 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)databasesfolderafolderbfoldercfolderdMyApp.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
    

  2. 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.

    Login or Signup to reply.
  3. Please make sure you have set the Azure SQL Firewall to allow Azure Services access to the database.

    enter image description here

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search