An Azure service that is used to provision Windows and Linux virtual machines.
Hello Varma, you can absolutely connect your Azure DevOps pipelines to a SQL Server running in an Azure VM—even if it’s SQL Server 2022. The SQL version itself doesn’t block connectivity; pipelines speak TDS (the SQL Server wire protocol), which works the same from SQL 2008 up through SQL 2022.
Here’s what you need to consider:
- Networking & Firewalls
- By default SQL Server listens on TCP port 1433.
- If you’re using a Microsoft-hosted agent, your SQL VM must have a public endpoint (or NAT) with port 1433 open in both the Windows Firewall and the Azure NSG.
- You’ll also need to whitelist the Azure DevOps IP ranges (see below).
- If you’d rather not expose a public endpoint, deploy a self-hosted pipeline agent VM in the same VNet/subnet as your SQL VM and connect to the private IP.
- Pipeline Tasks
- Use the “SQL Server Database Deployment” task or invoke
sqlcmd/Invoke-Sqlcmddirectly in PowerShell or Azure CLI. - (The “Azure SQL Database Deployment” task only targets Azure SQL Database or Managed Instances—not SQL in a VM.)
- Use the “SQL Server Database Deployment” task or invoke
- Testing Connectivity
- From your agent (or jump box), run: PowerShell: Test-NetConnection –ComputerName –Port 1433 bash/linux: telnet 1433
- Version Support
- SQL Server 2022 images are available in the Azure Marketplace (GA/Preview) and fully supported by the generic SQL connectivity that Azure DevOps uses.
https://learn.microsoft.com/en-us/azure/azure-sql/virtual-machines/windows/ways-to-connect-to-sql?view=azuresql#connect-to-sql-server-within-a-virtual-network
https://learn.microsoft.com/en-us/azure/azure-sql/virtual-machines/windows/ways-to-connect-to-sql?view=azuresql#connect-to-sql-server-over-the-internet