Skip to main content
When a database alert fires, you need answers fast. OpenSRE connects to your Azure SQL instances to quickly diagnose what’s going wrong — checking server health, finding those slow queries that are bogging things down, monitoring resource usage, and analyzing query execution plans to pinpoint bottlenecks.

What you’ll need

Before getting started, make sure you have:
  • An Azure SQL Database instance up and running
  • Network connectivity from your OpenSRE environment to your Azure SQL server
  • Database credentials ready (username and password)
  • Your server hostname handy

Getting connected

The easy way: Interactive setup

If you prefer guided steps, just run:
Pick Azure SQL from the menu and follow the prompts.

The flexible way: Environment variables

Add these to your .env file:

The permanent way: Integration store

You can also save your connection details to ~/.opensre/integrations.json:

Finding your connection details

Your Azure SQL server hostname looks like myserver.database.windows.net. You can find it:
  1. Open the Azure Portal
  2. Navigate to your SQL Database resource
  3. Look for Server name in the overview panel
  4. Copy it and add .database.windows.net if needed

Network access: Firewall setup

Azure SQL uses firewall rules to control who can connect. Make sure OpenSRE can reach your server:
  1. In Azure Portal, go to your SQL server → SecurityFirewalls and virtual networks
  2. Add your OpenSRE environment’s IP address
  3. Or check Allow Azure services and resources to access this server if running in Azure
If you’re not sure of your IP, start with a permissive rule temporarily, get OpenSRE working, then lock it down.

Investigation tools

When OpenSRE investigates an Azure SQL-related alert, these diagnostic tools are available:

Server status

Retrieves service tier, resource utilization, connection counts, and database size. Useful for spotting DTU or vCore throttling.

Current queries

Lists active sessions and running queries to identify lock contention or long-running operations.

Slow queries

Surfaces top resource-consuming queries from Query Store or DMVs to pinpoint performance regressions.

Wait stats

Reports cumulative wait types to identify I/O, lock, or CPU bottlenecks.

Resource stats

Returns CPU, memory, and I/O utilization metrics for the target database.

Test the connection

Ready to verify everything works?
Expected output:

Troubleshooting

Security best practices

  • Use a dedicated read-only SQL user for OpenSRE — avoid admin credentials.
  • Keep encryption enabled (AZURE_SQL_ENCRYPT=true) in production.
  • Restrict firewall rules to the OpenSRE environment’s egress IP.
  • Store credentials in .env or the integration store, never in source code.