0

I am trying to deploy a .dacpac on my newly created azure sql database.

Both the server and the database have a lock on top of them:

enter image description here

I am deploying my dacpac through Azure Devops Pipeline by using SqlAzureDacpacDeployment task. Everything seems in place except the fact that when it tries to deploy it gives me the error:

##[error]*** An error occurred during deployment plan generation. Deployment cannot continue.

##[error]A project which specifies SQL Server 2016 as the target platform cannot be published to Microsoft Azure SQL Database v12.

##[error]The scope '/subscriptions//resourceGroups//providers/Microsoft.Sql/servers//firewallRules/' cannot perform delete operation because following scope(s) are locked: '/subscriptions//resourceGroups//providers/Microsoft.Sql/servers/*****'. Please remove the lock and try again.

My question is: why is my Azure Pipeline deployment step trying to delete the database? My dacpac only creates tables so far, and even in the remote case my dacpac was removing tables or anything else, the lock in on the database level and it feels like the deployment step wants to delete the database itself. What am I missing? The step in my yaml deployment is:

- task: SqlAzureDacpacDeployment@1
  inputs:
    azureSubscription: '****'
    AuthenticationType: 'server'
    ServerName: '****.database.windows.net'
    DatabaseName: '****'
    SqlUsername: '****'
    SqlPassword: '****'
    deployType: 'DacpacTask'
    DeploymentAction: 'Publish'
    DacpacFile: '****.Db.dacpac'
    IpDetectionMethod: 'AutoDetect'
Tarta
  • 1,729
  • 1
  • 29
  • 63
  • Its not trying to delete the database its trying to delete the firewallrules to by complaint with what you are trying to deploy. – Daniel Björk Aug 07 '20 at 13:03

1 Answers1

1

Azure Pipeline deployment step doesn't try to delete the database. Task SqlAzureDacpacDeployment has a parameter Delete Rule After Task Ends*: If selected then after the task ends, the IP Addresses specified here are deleted from the 'Allowed IP Addresses' list of the Azure SQL Server's Firewall., and this parameter is enabled by default.

This task is open source on GitHub, you can check it in the link below:

https://github.com/microsoft/azure-pipelines-tasks/tree/master/Tasks/SqlAzureDacpacDeploymentV1

Cece Dong - MSFT
  • 29,631
  • 1
  • 24
  • 39