Datasource setup

Connect SQL Server

Set up SQL Server or Azure SQL access, enter the supported Querio authentication fields, and verify a table query.

Querio accepts a SQL login through a connection string or a Microsoft Entra service principal for Azure SQL.

1. Choose your authentication method

MethodWhat you need
Connection stringA SQL login, password, server, port, database, and Microsoft ODBC Driver 18 URL. SQL Server authentication must be enabled on the server.
Active Directory Service PrincipalAn Entra app in the Azure SQL server's tenant, its application (client) ID, directory (tenant) ID, and client secret. The app also needs a user in the target database. Microsoft explains the Azure SQL setup.

Querio's service-principal form uses a client secret. It does not accept a certificate or managed identity. These forms do not provide generic Windows integrated authentication.

You also need permission to manage datasource credentials in Querio, the database name, and a table with a known result. Ask your administrator to confirm that Querio can reach the server and trusts its certificate. If the database restricts inbound traffic, use Copy IP Address in the connection form and confirm the deployment's source address with Querio. Allow only the required endpoint and port. For Azure SQL, see network access controls. A private endpoint needs a route from Querio's gateway; Querio's SSH Tunnel datasource does not support SQL Server.

2. Give that identity read access

For a SQL login, an authorized administrator creates a dedicated login using your secret-management process:

CREATE LOGIN querio_reader WITH PASSWORD = '<GENERATE_AND_STORE_SECRET>';

Keep the real password out of prompts, source control, screenshots, and support messages. See Microsoft's CREATE LOGIN reference.

Connect to the target database and create a database user for the chosen identity. For the SQL login example:

USE Analytics;
CREATE USER querio_reader FOR LOGIN querio_reader;

For an Azure SQL service principal, an authorized Microsoft Entra administrator creates a contained database user. Replace querio-app with the app's display name:

CREATE USER [querio-app] FROM EXTERNAL PROVIDER;

The SQL login and service principal are alternatives. Create the user in the database you will enter in Querio. See Microsoft's CREATE USER reference and Azure SQL service-principal instructions.

Grant SELECT on each approved table or view. Run this in the target database and replace the object and user names:

GRANT SELECT ON OBJECT::dbo.Orders TO querio_reader;

For the service principal, grant to [querio-app] instead. Object-level grants keep the scope narrow. Use db_datareader only if the identity should read all user tables and views in that database. Existing roles, denials, and row-security policies can change effective access.

3. Enter the connection in Querio

Open Settings > Datasources > Add datasource, choose Internal, enter a unique Slug, and select SQL Server. Choose one authentication form:

FormEnter
Connection stringOne mssql+pyodbc SQLAlchemy URL with SQL login, password, server, port, database, and driver query option.
Active Directory Service PrincipalServer, Database, Client id, Tenant id, Client secret, and optional Port (default 1433).

For a SQL login, replace every uppercase value in this example. URL-encode reserved characters in the user name and password:

mssql+pyodbc://querio_reader:ENCODED_PASSWORD@sql.example.com:1433/Analytics?driver=ODBC+Driver+18+for+SQL+Server&Encrypt=yes&TrustServerCertificate=no

SQLAlchemy requires a lowercase driver URL key and encoded driver name. Querio's gateway image includes Microsoft ODBC Driver 18. The connection-string form passes its driver, encryption, and certificate options from the URL. The service-principal form uses Driver 18 with Encrypt=yes and TrustServerCertificate=no; it has no encryption or certificate switch. If certificate validation fails, arrange a trusted certificate and matching server name with your administrator or Querio. Do not disable validation to pass the test.

Querio has no separate Schema field for SQL Server. Qualify table names with their schema, such as dbo.Orders. If your SQL login name or password contains a space, Querio's current URL normalization can change it before the driver receives it; ask Querio to resolve that case before connecting. Enter the secret only in the connection form.

4. Test the connection and read a table

Select Test connection, then Create. Querio tests again when creating the datasource. A successful connection test checks connectivity; it does not prove that the identity can read your table. See Connect a datasource for the shared catalog and access steps.

In Context, add the intended table to the datasource catalog. As a user authorized to query with this credential, start an Explore and check the database identity:

SELECT DB_NAME() AS database_name, USER_NAME() AS database_user;

Then query a small, known slice. Replace the table and columns, and compare the rows with a trusted result for the same identity:

SELECT TOP (5) OrderID, TotalDue
FROM dbo.Orders
ORDER BY OrderID;

The ORDER BY makes the TOP result stable for comparison. If a teammate will use this datasource, have them run a query with their own Querio account. They need datasource permission and exactly one authorized credential; management permission alone does not grant query access. See credential selection.

If a check fails

SymptomCheck
Connection test failsHost, port, firewall or private route, authentication form, secret, driver, and server certificate. For Azure SQL, check the app tenant and database user.
Test succeeds but table query failsDatabase user, schema and object name, SELECT grant, effective denials, and row-security policy.
Table is missing from ContextSelected database and catalog refresh result. A connection test does not prove every object was discovered.
One Querio user cannot queryDatasource permission and credential selection. The user must have exactly one authorized credential.

Resolve SQL Server network reachability with your administrator and Querio. The SSH Tunnel connection kind supports PostgreSQL and MySQL, not SQL Server. For field details and credential replacement, see Datasources and credentials. Once the table query works, add context and check a business answer.

Was this page helpful?

Last updated on December 3, 2026

On this page