Share via

Connecting to database in Azure virtual machine SQL server

Varma 1,560 Reputation points
2026-03-19T14:41:19.0733333+00:00

I am planning to connect to azure database resided in azure SQL virtual machine server ( IAAS)

from Azure devops pipelines.

azure SQL virtual machine version is 2022, is it supported?

if it is not supported which one version is supported ?

SQL Server on Azure Virtual Machines

2 answers

Sort by: Most helpful
  1. Saraswathi Devadula 15,925 Reputation points Microsoft External Staff Moderator
    2026-03-20T03:44:40.57+00:00

    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:

    1. 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.
    2. Pipeline Tasks
      • Use the “SQL Server Database Deployment” task or invoke sqlcmd/Invoke-Sqlcmd directly in PowerShell or Azure CLI.
      • (The “Azure SQL Database Deployment” task only targets Azure SQL Database or Managed Instances—not SQL in a VM.)
    3. Testing Connectivity
      • From your agent (or jump box), run: PowerShell: Test-NetConnection –ComputerName –Port 1433 bash/linux: telnet 1433
    4. 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

    0 comments No comments

  2. Q&A Assist
    2026-03-19T14:41:32.03+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    SQL Server 2022 running on an Azure Virtual Machine is supported and can be connected to from Azure DevOps pipelines, as long as connectivity and authentication are configured correctly.

    To connect from Azure DevOps pipelines to SQL Server 2022 on an Azure VM, ensure at least the following:

    1. Enable SQL authentication on the SQL Server instance.
    2. Create a SQL login with appropriate permissions on the target database.
    3. Enable TCP/IP protocol for SQL Server.
    4. Allow inbound traffic on the SQL Server port (default 1433) in:
      • The Windows Firewall on the VM.
      • The Network Security Group (NSG) for the VM’s subnet/NIC (for internet or cross‑VNet access).
    5. Use the VM’s public DNS name/IP (or private IP if using private connectivity) and the SQL login credentials in the connection string used by the Azure DevOps pipeline task.

    These connectivity requirements apply to SQL Server on Azure VMs generally and are valid for SQL Server 2022.


    References:

Your answer

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