3
votes

I can't deploy to an Azure SQL Database inside an Azure Failover Group using the Read/write listener endpoint from VS2015/17 database project publish or using DACFx? I'm using a contained user with appropriate permissions and have proved it works by deploying directly to the primary Azure SQL server of the database but not to the read/write listener of the Failover Group.

I get the same exception using using DacFX or directly publishing from VS2015/17.

Exception Message:
Could not deploy package.

Inner Exception Message:
Unable to connect to master or target server '<MY DATABASE>'. You must have a user with the same password in master or target server '<MY DATABASE>'.

StackTrace:
   at Microsoft.SqlServer.Dac.DeployOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)
   at Microsoft.SqlServer.Dac.OperationExtension.Execute(IOperation operation, DacLoggingContext loggingContext, CancellationToken cancellationToken)
   at Microsoft.SqlServer.Dac.DacServices.InternalDeploy(IPackageSource packageSource, Boolean isDacpac, String targetDatabaseName, DacDeployOptions options, CancellationToken cancellationToken, DacLoggingContext loggingContext, Action`3 reportPlanOperation, Boolean executePlan)
   at Microsoft.SqlServer.Dac.DacServices.Deploy(DacPackage package, String targetDatabaseName, Boolean upgradeExisting, DacDeployOptions options, Nullable`1 cancellationToken)
1

1 Answers

1
votes

This problem is caused by the fact that DacFx opens a connection to the master database behind the scenes. At present, the failover group does not include the master database because it would require replicating it and the master cannot be replicated - the masters on primary and secondary servers are independent and both writeable. This is a known issue and we are addressing it by treating the master as a special case. We will allow connections to it on the server to which the listener points to.