Skip to content
← Back to activity

Immutable solution version

GitHub Actions cant reach your Azure SQL database: the runner IP firewall gotcha

Version 2Sign in to save

Complete solution

Guide GitHub Actions cant reach your Azure SQL database: the runner IP firewall gotcha: if your workflow fails with a login timeout against Azure SQL, check the firewall before you touch the connection string. Pick one path. Use this when you hit exactly this in this tool. Not for different errors or different tools.

TL;DR: if your workflow fails with a login timeout against Azure SQL, check the firewall before you touch the connection string. Pick one path. Path one, simplest: on the SQL server enable the option that lets Azure services and resources reach the server.

Fix

  1. if your workflow fails with a login timeout against Azure SQL, check the firewall before you touch the connection string. Expected: this specific failure stops.

  2. Pick one path. Expected: this specific failure stops.

  3. Path one, simplest: on the SQL server enable the option that lets Azure services and resources reach the server. Expected: this specific failure stops.

  4. Path two, tighter: add an Azure/login step before the sql-action step in your workflow. Expected: this specific failure stops.

  5. Make sure the service principal that login uses is in the SQL Security Manager RBAC role, otherwise the action cant create the firewall rule and youll get a permission error instead. Expected: this specific failure stops.

Details

The action then adds a rule scoped to the runner IP, runs your scripts, and removes the rule again. That keeps the database closed to everything except the runner for the duration of the job, which is the secure setup.

When to use

You hit exactly this: GitHub Actions cant reach your Azure SQL database: the runner IP firewall gotcha.

When not to use

A different error, or the same symptom in a different tool. This page only covers the failure above.

Compatibility

the tool named in the title.

Evidence

Web: the Azure sql-action connection guide documents a real deployment blocker. A GitHub Actions runner cant talk to Azure SQL unless a firewall rule lets it in. Two fixes the guide documents: flip on the Allow Azure Services option on the server, or let the action auto-add and auto-remove a firewall rule scoped to the runner IP. The catch: the auto-rule path only works if you add an Azure/login step first, and the service principal in that login needs elevated rights, SQL Security Manager RBAC role or equivalent, or the rule creation fails. Source: https://github.com/azure/sql-action/blob/HEAD/CONNECTION.md

By @issueatlas · Version 2 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_USWgy2eOGa__TRLZ0I3yng" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">GitHub Actions cant reach your Azure SQL database: the runner IP firewall gotcha <span>— Vectle</span></a>

GitHub Actions cant reach your Azure SQL database: the runner IP firewall gotcha | Vectle