Search code examples
sql-serverazureazure-sql-databaseazure-devopsms-release-management

VSTS: Deploy Azure SQL DACPAC throws an error


I am trying to setup a Release on VSTS for an Azure SQL database using the 'Deploy Azure SQL DACPAC'. I get the following error (with system.debug = true)

2016-08-09T06:23:08.4767615Z Publishing to database 'DBName' on server 'DBServer'. 
2016-08-09T06:23:08.6821649Z Initializing deployment (Start) 
2016-08-09T06:23:24.7312223Z Initializing deployment (Failed) 
2016-08-09T06:23:24.7684904Z ##[debug]System.Management.Automation.RemoteException: * Could not deploy package. 
2016-08-09T06:23:24.7794888Z ##[debug][Azure RDFE Call] Deleting firewall rule 7d14da9b-4c86-4ed6-a3f3-d238a3143c39 on azure database server: DBServer 
2016-08-09T06:23:25.9730592Z ##[debug][Azure RDFE Call] Firewall rule 7d14da9b-4c86-4ed6-a3f3-d238a3143c39 deleted on azure database server: DBServer 
2016-08-09T06:23:25.9840576Z ##[error]System.Management.Automation.ParentContainsErrorRecordException: * Could not deploy package.

Following is the publish profile -

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <IncludeCompositeObjects>True</IncludeCompositeObjects>
    <TargetDatabaseName>SocialRecruiting</TargetDatabaseName>
    <DeployScriptFileName>Database.sql</DeployScriptFileName>
    <TargetConnectionString>Data Source=DBServer;Persist Security Info=True;User ID=username;Pooling=False</TargetConnectionString>
    <ProfileVersionNumber>1</ProfileVersionNumber>
    <ScriptDatabaseOptions>True</ScriptDatabaseOptions>
    <BlockOnPossibleDataLoss>True</BlockOnPossibleDataLoss>
    <CreateNewDatabase>False</CreateNewDatabase>
  </PropertyGroup>
</Project>

I read a couple of similar posts on this, one here and one on another forum. They suggested adding the IP range manually (0.0.0.0 to 255.255.255.255) and using friendly server name instead of FQDN but that did not work. I am able to publish it manually through Visual Studio without any problems.

EDIT
I tried the suggestions from the following posts already
VSTS: Deploy Azure SQL DACPAC Release Management throwing an error
Azure SQL DACPAC task keeps failing

EDIT - full DACPAC log
http://pastebin.com/bWvTi5Vx


Solution

  • I was able to solve this with the help of a colleague's friend. The database that was being updated had a table with a column set as NULL and the DACPAC had the create script for the table with column as NOT NULL which caused the error. I altered the existing table to make the column NOT NULL and the release worked.