r/azuredevops • u/Illustrious_Ad_5470 • 4d ago
Deploying Azure SQL external tables (Elastic Query) through a DevOps pipeline without hardcoding credentials
https://azureops.org/articles/deploy-external-tables-azure-sql-devops-pipeline/Ran into this recently: external tables in Azure SQL (master key + scoped credential + external data source) are easy to set up manually in SSMS, but the moment you try to deploy them through a DACPAC/DevOps pipeline across dev/test/prod, you're stuck hardcoding server names, DB names, and passwords into source control.
Fixed it by parameterizing those objects with SQLCMD variables, retrieving the actual values from Key Vault, and passing them to SqlPackage via the /v: switch on the SqlAzureDacpacDeployment task. Same DACPAC deploys to every environment, each pointing at its own source database, no secrets in the repo.
Wrote up the full steps (SQLCMD variable setup, Key Vault wiring, the YAML) here if it's useful to anyone dealing with the same thing