How do I deploy a dacpac to a sql managed instance?

Oblio 21 Reputation points
2024-09-27T16:21:20.0233333+00:00

How do I use the 'Azure SQL Database deployment' task in a release pipeline to deploy a dacpac to an Azure SQL Managed Instance? The error I'm getting is that the server cannot be found. I assume that's because it's not publicly accessible (as it shouldn't be). I've found some instructions that discuss creating a firewall rule to temporarily permit access, but I'm concerned those are for SQL databases, not managed instances. I've also found discussions that indicate I would have to have a self-hosted agent to do the deployments. I could look into that, but it's an additional expense and doesn't feel very cloud-native.

Azure SQL Database
{count} votes

1 answer

Sort by: Most helpful
  1. Nandan Hegde 32,416 Reputation points MVP
    2024-09-30T03:58:53.9533333+00:00

    The Azure SQL MI is hosted within a VNet which is not directly accessible from the Azure devops agent.

    So ideally we would have to create a server within the VNet in which the SQL MI is hosted and set up Azure devops self hosted agent within that server which would help to deploy the DACPAC.

    Sample of On Prem SQL server (similar to SQL MI)

    https://datasharkx.wordpress.com/2021/05/28/automated-deployment-of-sql-server-database-through-azure-devops/


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.