SqlBLT Deployment Guide
1. Overview
This guide describes how to deploy the SqlBLT Portal and its API: the deployment options, the authentication of users and programs in each, the set-up at an identity provider, the security of each option, and every setting. The SqlBLT Guide describes SqlBLT itself, and the SqlBLT Database its database.
The Portal is one executable, SqlBLTPortal.exe: an ASP.NET Core application on Kestrel (.NET 10), published as a single self-contained file, which needs no installation and no runtime on the computer that runs it. It serves the report page and the SqlBLT API, the operations under api/v1/ through which the page reads every report. Any other program, a script or an AI agent, calls the same operations with the same results. The description of the API, api/v1/openapi.json (OpenAPI 3.1), states how to call it, what the data answers, and every operation, parameter and column.
Whatever the deployment, the Portal and its API:
- read only: they execute the read-only report procedures of the schema
SqlBLTPortaland read the catalog views, and never change a database. Access to a SqlBLT database needs membership of the database roleSqlBLT_Reader(the guide, section 5.2); - connect to SQL Server as the caller decides: as the caller's Windows account, as a SQL login the caller supplies, or, for the service connections a server lists, as the server's own account. SQL Server authenticates and authorises every connection;
- let users register any instance they want to connect to; what they can read is decided by SQL Server;
- hold a connection for the caller who opened it only, under a random identifier; another caller cannot use it;
- store no password: a SQL login's password is held in memory while its connection is open, and a remembered password is kept by the user's browser, encrypted by the Portal.
Deployment options
| A. Desktop app | B. Windows service | C. IIS site | D. Published with OpenID Connect | |
|---|---|---|---|---|
| Runs | on the user's computer or a jump host, as the user | on a server, as a service account | on an IIS web server, as the application pool identity | on a server, as B or C, reached at a public HTTPS address |
| Users sign in | not at all: the app answers its own Windows user only | with their Windows accounts (Kerberos or NTLM) | with their Windows accounts, through IIS Windows Authentication | at the organisation's identity provider |
| Programs and AI agents | on the same computer, with the key of the desktop app | as the Windows account they run under | as the Windows account they run under | with an access token of the identity provider |
| Windows authentication to SQL Server connects as | the user | the user, with --impersonate and Kerberos constrained delegation | the user, with --impersonate and Kerberos constrained delegation | the user's Active Directory account, with --impersonate, WindowsAccountClaim and Kerberos protocol transition |
| Section | 3 | 4 | 5 | 6, 7, 8 |
Option D is not a fourth executable: it is option B or C with the section OpenIdConnect and the setting PublicAddress in appsettings.json. Option B or C with PublicAddress alone is published with Windows authentication (section 6.10).
2. Choosing an option
| When | Choose |
|---|---|
| A DBA or an analyst reads the data on a workstation or a jump host that reaches the SQL Server instances | A, the desktop app: nothing to install, nothing to configure |
| Several users on the organisation's network open the Portal in their browsers | B, a Windows service on a server of its own, or C, where an IIS web server is already run |
| The site permits neither SQL logins nor users' Windows logins on its SQL Servers | B or C with service connections: the service account alone holds a read-only login |
| Users must reach the Portal from outside the organisation's network, or sign in with the organisation's identity provider (Microsoft Entra ID, Okta, Google, PingOne, Keycloak, AD FS or another OpenID Connect provider) | D |
| Users of option D must connect to SQL Server with their own Windows accounts | D with Kerberos protocol transition (section 8); the Portal's server is a member of the users' Active Directory domain |
| A program or an AI agent reads SqlBLT data | The API of whichever option the users have (section 9) |
3. A. The desktop app
Copy the executable to any computer with network access to the SQL Server instances and run it. It listens on http://127.0.0.1:8781, or on a free port when that one is taken, and opens the browser on its page. The user registers each instance with the connect icon of the menu and adds its SqlBLT databases with Add Database. A Windows registration connects as the user running the app; a SQL login registration asks for its password when the instance connects, unless the password is remembered.
Files. The app keeps two files in %APPDATA%\SQLBench\SqlBLTPortal, both protected with Windows data protection (DPAPI) for the current user, so that another account on the computer cannot read them: registrations.dat, the user's registrations (names of instances, authentication and login names, never a password), and apikey.dat, the key of the desktop app. The registrations survive a port change, a reinstall and the clearing of the browser's data. A remembered password is kept by the browser for the address of the page, so it is asked for once more after a port change or after the browser's site data is cleared. The download and upload icons of the menu move the list of registrations between computers as a file of names. Nothing else is installed or written.
The key of the desktop app. The loopback address on which the app listens can be reached by every user and every process of the computer, so the app answers only callers that present its key. It creates the key once for the Windows user who runs it and requires it on every call of api/, as the header Authorization: Bearer <key>. The page receives the key in the address the app opens the browser on (after #key=, a part of an address that a browser sends to no server), keeps it for that address and removes it from the address bar; the user sees no difference. While the app listens on the loopback address only, it also refuses a request whose Host header names another host. The key stays the same from start to start, so a program that was given it goes on working; to replace it, stop the app, delete apikey.dat and start the app again.
The API window. The button API at the right of the top bar of the page opens a window with the address of the API, the address of its description and the key, for a program of the same user on the same computer (section 9).
| Command line | Effect |
|---|---|
SqlBLTPortal.exe | listens on http://127.0.0.1:8781, or a free port, and opens the browser on the page |
--no-browser | does not open the browser; writes the address to open, with the key, to the console |
--urls http://0.0.0.0:8781 | serves other computers as well, without TLS; a browser there needs the address with the key. Prefer option B for users of other computers. |
4. B. A Windows service on a server
The Portal runs on a server of its own (Windows Server 2022 or later) as a Windows service under a service account, in hosted mode (--hosted). Users open the page in their browsers and authenticate with their own Windows accounts; a program authenticates in the same way, as the Windows account it runs under. Each user's registrations live in that user's browser; the service stores nothing of theirs.
- The service account. A domain account with the Log on as a service right on the server, or a group managed service account (gMSA), which has no password to store and is the better choice. Interactive logon is not needed and may stay denied: the Service Control Manager uses the service logon type.
New-ADServiceAccount -Name svc_sqlblt -DNSHostName svc_sqlblt.domain.local -PrincipalsAllowedToRetrieveManagedPassword SQLBLTVM$ Install-ADServiceAccount svc_sqlblt # on the server Test-ADServiceAccount svc_sqlblt - The service, registered from a folder the account can read. A gMSA is given without a password; a domain account adds
password=. The listen address is set in step 3; behind a reverse proxy that terminates TLS, add--urls http://0.0.0.0:8781instead.sc.exe create SqlBLTPortal binPath= "D:\SqlBLTPortal\SqlBLTPortal.exe --hosted" start= auto obj= DOMAIN\svc_sqlblt$ sc.exe start SqlBLTPortal - TLS. Passwords and the Kerberos exchange cross the network, so the site must be HTTPS. Give Kestrel the server's certificate in an
appsettings.jsonbeside the executable, the standard Kestrel configuration, or terminate TLS on a reverse proxy in front of the Portal. Open the firewall for that port only.{ "Kestrel": { "Endpoints": { "Https": { "Url": "https://0.0.0.0:8443", "Certificate": { "Subject": "sqlblt.domain.local", "Store": "My", "Location": "LocalMachine" } } } } } - Kerberos, so that browsers authenticate with Kerberos rather than NTLM: register the service principal name of the site on the service account,
setspn -S HTTP/sqlblt.domain.local DOMAIN\svc_sqlblt$, and have users open the page by that host name. - Windows registrations, where the site allows users' Windows logins on the SQL Servers: add
--impersonateto the command line and configure constrained delegation from the service account to theMSSQLSvcservice principal names of the registered instances (the account's Delegation tab, orSet-ADServiceAccount -PrincipalsAllowedToDelegateToAccounton the SQL Server service accounts for resource-based delegation). Each user then needs a Windows login on each instance with the grants of the guide's section 5.2. Without--impersonatea hosted Portal refuses Windows registrations, and users register SQL logins. - Allowed users. Every user the domain authenticates may use the Portal unless
AllowedGroupnames the Windows group a user must belong to. - Service connections, where the site permits neither SQL logins nor users' Windows logins on the SQL Servers: give the service account a Windows login on each instance, with the grants of the guide's section 5.2 on each SqlBLT database it should show, list the instances in
appsettings.json, and name the group of users allowed to use the server.
Every allowed user sees the service connections at the top of the menu, connects without any credential, and adds and reads any database the service account can access on the listed instances. The group, the list and the account's database access are the access control.{ "ServiceConnections": [ { "name": "Production", "server": "SQLPROD01" }, { "name": "Finance", "server": "SQLFIN01\\INST1" } ], "AllowedGroup": "DOMAIN\\SqlBLT Users" }
5. C. An IIS site
The same executable runs under IIS, started by the ASP.NET Core Module as a separate process: IIS forwards every request to it and, from the site's Windows Authentication, the user's Windows identity. IIS supplies the users' sign-on and TLS.
- Install the ASP.NET Core Hosting Bundle for .NET 10 on the web server (it adds the ASP.NET Core Module to IIS) and the IIS feature Windows Authentication.
- Create the site folder and copy
SqlBLTPortal.exeand theweb.configof the release into it. Theweb.configstarts the executable with--hosted --iis; add--impersonateto itsargumentsattribute when constrained delegation is configured for the application pool identity as in option B. The listen address is IIS's. - Create an application pool with .NET CLR version: No Managed Code and the service account or gMSA as its identity (Advanced Settings > Identity > Custom account; a gMSA is entered as
DOMAIN\svc_sqlblt$with no password), and give that identity read and execute permission on the site folder. - Create the site on that pool with an HTTPS binding and the server's certificate. Enable Windows Authentication and disable Anonymous Authentication for the site: the Portal requires an authenticated user on every request. Authorise a domain group with URL Authorization when access is to be narrower than all authenticated users, or name it as
AllowedGroup. - For service connections, put the
appsettings.jsonof option B in the site folder; the application pool identity is the account that connects.
IIS starts the executable on the first request, and again after a failure or a recycle of the pool. The executable writes nothing to the site folder; a logs subfolder receives its console output only while stdoutLogEnabled is set in the web.config. For option D under IIS, put the settings of section 6 in the site folder's appsettings.json, and disable Windows Authentication and enable Anonymous Authentication for the site: the Portal then signs users in itself.
6. D. Published with OpenID Connect
A published Portal is reached at a public HTTPS address. Users sign in at the organisation's identity provider, which decides who they are; the Portal decides from a claim of the identity provider whether a user may use it; SQL Server still authenticates and authorises every connection to a database. Programs present an access token of the same identity provider.
6.1 What it needs
- A server for the Portal (option B, or option C with the changes of section 5), which reaches the SQL Server instances over TCP and the identity provider over HTTPS.
- A public host name, for example
sqlblt.example.com, and a certificate for it: on the Portal (Kestrel or IIS), or on a reverse proxy or load balancer in front of it. - A registration of the Portal at the identity provider (section 6.2), and a client credential: a certificate, or a client secret where the identity provider issues only secrets.
- The event source of the audit log, registered once by an administrator of the Portal's server:
New-EventLog -LogName Application -Source SqlBLTPortal
6.2 The registration at the identity provider
Register the Portal as a web application, a confidential client, with these values. Section 7 gives the notes for common identity providers.
| Item | Value |
|---|---|
| Application type | Web application (confidential client) |
| Grant type | Authorization code, with PKCE (S256). The identity provider returns the browser with a GET (response mode query). |
| Redirect URI | https://sqlblt.example.com/signin-oidc |
| Sign-out redirect URI | https://sqlblt.example.com/signout-callback-oidc |
| Client authentication | Private key JWT: the public key of the Portal's certificate is uploaded to the registration (preferred); or a client secret |
| Scopes | openid and profile, which the Portal always asks for, and any the provider needs to issue the claim of AllowedClaim |
| Claim that allows a user | A claim in the ID token whose values name the users allowed: an application role (for example roles with the value SqlBLT.User) or a group claim (for example groups with the value SqlBLT Users) |
| For programs (optional) | An API, or resource, whose audience the access tokens of programs carry; its value is OpenIdConnect:Audience. The access token must carry the claim of AllowedClaim as well. |
| For Windows authentication to SQL Server (optional) | A claim that carries each user's Active Directory user principal name (user@domain), in the ID token and in the access token: OpenIdConnect:WindowsAccountClaim (section 8) |
6.3 appsettings.json
The settings are read from appsettings.json beside the executable when the Portal starts. With a certificate:
{
"PublicAddress": "https://sqlblt.example.com",
"OpenIdConnect": {
"Authority": "https://login.microsoftonline.com/<tenant id>/v2.0",
"ClientId": "<the client id of the registration>",
"ClientCertificate": "<thumbprint of the certificate>",
"AllowedClaim": { "type": "roles", "values": [ "SqlBLT.User" ] },
"Audience": "api://sqlblt",
"SessionHours": 8
},
"Kestrel": { "Endpoints": { "Https": { "Url": "https://0.0.0.0:443",
"Certificate": { "Subject": "sqlblt.example.com", "Store": "My", "Location": "LocalMachine" } } } }
}
Here Kestrel serves HTTPS itself. Behind a reverse proxy, omit Kestrel, start the Portal with --urls, and add ReverseProxies (section 6.5). Section 11 lists every setting. The Portal checks them before it listens, and when one is missing or wrong it does not start: it writes the reason, which names the setting, and ends with exit code 2.
6.4 The client credential
- Certificate. Put the certificate with its private key in the certificate store of the computer (Local Computer, Personal), give the Portal's account read permission on its private key (Manage Private Keys), and name its thumbprint in
ClientCertificate. Upload the public part (the.cerfile, or the key in the form the provider asks for) to the registration. The Portal signs a short-lived assertion with the private key at each sign-in; the key never leaves the server. - Client secret, where the identity provider issues only secrets. Encrypt the secret on the Portal's server, and put the line it prints in
ClientSecret:
The command asks for the secret without echoing it (or reads it from a pipe) and prints it encrypted with Windows data protection for that computer: it can be decrypted on that computer only, by any of its accounts, so the file holds no secret in clear text. After the Portal moves to another server, encrypt the secret there again.SqlBLTPortal.exe --encrypt-client-secret
6.5 The reverse proxy or load balancer
The Portal may listen behind a reverse proxy or a load balancer that terminates TLS for the public address. PublicAddress is then the address users open; the Portal builds its redirect URIs from it, never from the Host header of a request, and answers every request as if it had come to that address. List the addresses of the proxies in ReverseProxies: for a request from one of them, the audit log records the client address from the last entry of X-Forwarded-For. Keep the path between the proxy and the Portal on a private network, or use HTTPS on it as well.
6.6 Signing in and out
- Opening the page without a session leads the browser to the identity provider; after the sign-in it returns to the page. A user whose claim does not hold an allowed value is shown a page that says so; the page offers to sign in with another account.
- The session is held in the Portal's memory, under the cookie
__Host-SqlBLT(Secure, HttpOnly, SameSite=Lax, bound to the host). It ends afterSessionHours(8 hours unless set), however active the user is, and when the Portal restarts. When a session ends while a report is on the screen, the page takes the report up again after a sign-in within five minutes. - The top bar shows the signed-in user (the claim of
DisplayNameClaim, or else the first ofpreferred_username,emailandnamethat the ID token carries) and the sign-out control, which closes the user's connections, ends the session, and signs the user out at the identity provider when the provider offers that. - A user who signs out at the identity provider elsewhere keeps the Portal's session until it ends.
6.7 Protections of a published Portal
| Protection | What it does |
|---|---|
| HTTPS only | The Portal answers under its public address and sends Strict-Transport-Security. |
| Response headers | A content security policy that allows the page's own script by its SHA-256 hash and nothing loaded from another address, and forbids framing; X-Content-Type-Options, Referrer-Policy, Cross-Origin-Resource-Policy, Cache-Control: no-store. These headers are sent in every option. |
| Requests from other sites | A request that changes state (any method but GET) must carry the Origin of the public address, or it is refused. |
| Connections by TCP only | A server name a user registers is connected by TCP; a name that asks for named pipes or another protocol is refused. Without this, the SQL client would try named pipes when TCP fails, a connection over SMB in which Windows presents the Portal's account to the host named. |
| Refused SQL logins | When SQL Server has refused five SQL logins of one user within five minutes, that user's further SQL login attempts are not made until the five minutes have passed. |
| Remember me | Not offered unless RememberMe is true. |
| Programs | A program has at most four requests running at a time; a request above that is answered 429. |
| Audit log | The Windows event log Application, source SqlBLTPortal (table below). Each entry names the user and the client address; no password, token or statement text is written. A caller whose requests or tokens keep being refused is logged at most once a minute. |
| Event | Entry |
|---|---|
| 1000 | The Portal started |
| 1001 | Sign-in of a user |
| 1002 | Sign-in refused: the ID token carries none of the values of AllowedClaim; or the sign-in was not completed, with the cause |
| 1003 | Sign-out, with the number of connections closed |
| 1004 | A session ended at the end of its lifetime |
| 1005 | Connect: the instance, the authentication, the login and the result (connected, refused or failed) |
| 1006 | Open database: the database and the result |
| 1007 | Request refused: Origin, protocol of a server name, limit on refused SQL logins, limit on the running requests of a program |
| 1008 | Access token refused, with the reason |
6.8 Start and check
- Start the Portal: the service of option B with
--hosted(and--impersonatefor section 8), or the IIS site of option C. - Read event 1000 in the Application log: it confirms the settings in force. If the Portal does not start, the console, the service's error or the IIS stdout log gives the reason and names the setting.
- Open the public address, sign in as an allowed user, connect an instance and open a SqlBLT database; sign in as a user without the claim and see the refusal.
- For programs, obtain an access token (section 9) and call
api/v1/version.
6.9 Users and SQL Server
A user who signs in at the identity provider has no Windows identity of the organisation's domain unless section 8 provides one. Such a user connects with a SQL login, typed in the Connect form and held in memory while connected, or through the service connections of the server. With section 8, the user's own Active Directory account connects.
6.10 Published with Windows authentication
Option B or C with PublicAddress and without the section OpenIdConnect keeps Windows authentication of the users and programs, and applies the protections of section 6.7 and the audit log.
7. Identity providers
The Portal works with an identity provider that implements OpenID Connect: discovery at <Authority>/.well-known/openid-configuration, the authorization code flow with PKCE, signed ID tokens, and, for programs, access tokens in JWT form for an audience the organisation defines. Authority is the issuer address of the provider, which begins with https. The labels of the providers' consoles change from time to time; the notes below name what to set.
| Identity provider | Notes |
|---|---|
| Microsoft Entra ID | Authority: https://login.microsoftonline.com/<tenant id>/v2.0, one tenant; the addresses common, organizations and consumers admit several organisations and are refused. App registration, single tenant; platform Web with the two redirect URIs; Certificates & secrets: upload the certificate. Create an app role (for example value SqlBLT.User), assign it to the users or groups allowed under Enterprise applications, and set AllowedClaim to {"type": "roles", "values": ["SqlBLT.User"]}. For programs, Expose an API gives the Application ID URI, which is the Audience. For section 8, add the optional claim upn to the ID token and the access token; it carries the user principal name of users synchronised from Active Directory. |
| Okta | App integration: OIDC, Web Application, grant type Authorization Code; the two redirect URIs; client authentication Public key / Private key with the Portal's public key. Group claim on the ID token (for example a filter on the group SqlBLT Users), and AllowedClaim on groups. Access tokens for programs come from a custom authorization server, whose audience is the Audience, and whose issuer is then the Authority. |
Google Auth Platform, OAuth client of type Web application, with the redirect URI. Google issues a client secret only: encrypt it with --encrypt-client-secret. Google issues no group claim: allow users by email, or by hd, the domain of a Google Workspace or Cloud Identity organisation. | |
| PingOne | Application of type OIDC Web App; response type Code, grant type Authorization Code, PKCE required (S256); the redirect and sign-off URLs; token endpoint authentication Private Key JWT with the Portal's key set. Map a groups attribute for AllowedClaim. |
| Keycloak | Authority: https://<host>/realms/<realm>. Client with client authentication on, standard flow, PKCE S256; credential Signed JWT with the Portal's certificate, or a client secret; a group membership mapper, or client roles, for AllowedClaim. |
| AD FS | Application group with a server application (the redirect URIs, and a certificate or secret) and, for programs, a web API whose identifier is the Audience; issuance transform rules for the claim of AllowedClaim (for example groups or role) and, for section 8, upn. |
8. Windows authentication to SQL Server for users who sign in at an identity provider
With --impersonate and OpenIdConnect:WindowsAccountClaim, a user who signed in at the identity provider and registers an instance with Windows authentication is connected to SQL Server as that user's own Active Directory account, and so is a program whose access token carries the claim. The Portal obtains the account's Windows identity by Kerberos protocol transition, without any password of the user; SQL Server authenticates the account by Kerberos and applies its permissions.
- The Portal's server is a member of the domain of the users.
- The identity provider issues each user's user principal name (
user@domain) in a claim: in the ID token for the page, in the access token for a program. - The Portal runs with
--impersonate, andappsettings.jsonnames the claim:"OpenIdConnect": { ..., "WindowsAccountClaim": "upn" }. With the sectionOpenIdConnect, the Portal does not start with one of the two and not the other. - In Active Directory, the Portal's account may delegate to each SQL Server instance: constrained delegation to the
MSSQLSvcservice principal names of the instance with Use any authentication protocol, or resource-based constrained delegation (the account of the SQL Server names the Portal's account). With Use Kerberos only the connection is refused. - On the Portal's server, the Portal's account holds the user right Act as part of the operating system. The local system account has it; a domain service account is granted it in the local security policy (User Rights Assignment). The Portal enables the right in its own process at the first such connection.
When one of these is missing, the connection is refused and the answer says which: the identity provider names no account; the domain does not hold the account; Windows gave the identity for identification only (item 5); SQL Server received no identity (item 4). The Portal never connects as another account in the user's place. A user for whom the identity provider names no account still signs in, and uses SQL logins and service connections; the Connect form does not offer Windows authentication to that user. The Portal keeps an account's Windows identity for ten minutes, so a change of the account in Active Directory reaches the Portal within that time.
What a site trusts with this method. Active Directory issues the Kerberos ticket on the word of the Portal's account. The Portal's account can therefore connect, to the SQL Server instances it may delegate to and to no other service, as any account of the domain, and it takes the user principal name from the claim of the identity provider. Keep the delegation narrow, protect the Portal's server as a tier of the SQL Servers, and mark accounts that must never be delegated as Account is sensitive and cannot be delegated.
9. Programs and AI agents
A program reads SqlBLT data through the API of the Portal the users have. Give it the address of the API and a credential, and have it read the description first: <address>/api/v1/openapi.json. The description holds everything a program needs, including what the data answers and how: blocking hierarchies, blocked statements, top blockers, long running requests, SQL Server's missing index recommendations, the warnings of the query optimizer, trends, and the metrics of the instance.
| Option | The program presents | How it obtains it |
|---|---|---|
| A. Desktop app | Authorization: Bearer <key>, the key of the desktop app | The user copies the key from the API window. The program runs on the same computer; the address is http://127.0.0.1:<port>/api/v1/. |
| B, C. Windows authentication | HTTP Negotiate (Kerberos or NTLM) | The Windows account the program runs under, which must be allowed as a user is (AllowedGroup, IIS authorisation). |
| D. OpenID Connect | Authorization: Bearer <access token> | From the identity provider, for the audience of OpenIdConnect:Audience: a program of its own by the client credentials grant, a program acting for a user by the authorization code flow with PKCE. The token's claim of AllowedClaim decides as for a user. |
The program then connects an instance as the page does: with auth windows (its own Windows account, or with section 8 the account its token names), sql (a SQL login it holds), or service (a service connection of the server). Give the account a login with the role SqlBLT_Reader of its own, so that its access is granted, audited and revoked apart from the users'. A program has at most four requests running at a time on a server with OpenID Connect; a request above that is answered 429, and the program should wait and repeat it.
For example, in PowerShell, with the address and the key of the API window of the desktop app:
$h = @{ Authorization = 'Bearer <the key>' }
$api = 'http://127.0.0.1:8781/api/v1'
Invoke-RestMethod "$api/version" -Headers $h
$c = Invoke-RestMethod "$api/connect" -Method Post -Headers $h -ContentType 'application/json' -Body '{"server": "SQLPROD01", "auth": "windows"}'
$d = Invoke-RestMethod "$api/open?id=$($c.id)&database=SqlBLT" -Method Post -Headers $h
$r = Invoke-RestMethod "$api/report?id=$($d.id)" -Method Post -Headers $h -ContentType 'application/json' -Body (@{ from = $d.from; to = $d.to; blt = 'L'; measure = 'elapsed' } | ConvertTo-Json)
An AI agent is given the same three things: the address of the API, the credential (in a file or a header it is told to use, rather than in its prompt), and the instruction to read openapi.json first. Ask it to cover the three roles (blocked, top blockers, long running) and the missing index recommendations, as the description's section What the data answers, and how sets out. The agent reads with the permissions of the account it connects as; it cannot change a database through the API.
10. Security
10.1 Where credentials are held
| Credential | Held |
|---|---|
| Registrations | A: the DPAPI-protected file in the user's profile. B, C, D: the user's browser. Never a password. |
| SQL login password | In the Portal's memory while its connection is open; dropped at disconnect, after four idle hours, or when the Portal restarts. |
| Remembered password | In the user's browser, encrypted by the Portal with DPAPI: with the key of the computer that hosts the Portal (B, C, D) or of the Windows user who runs the desktop app (A), and bound to the instance, the login and, when hosted, the user. It cannot be read in the browser, and another server or another Windows user cannot decrypt it. |
| Windows identity | B, C: the user's own, delegated per request by Kerberos constrained delegation. D with section 8: obtained by protocol transition, kept ten minutes. |
| Service connections | No credential: the server's own account. |
| Key of the desktop app | The DPAPI-protected file in the user's profile, and the browser's storage for the page's address. |
| Client credential of option D | The certificate's private key in the computer's store, or the client secret encrypted for that computer in appsettings.json. |
| Sessions and access tokens | The session in the Portal's memory; the access token with the program that presents it, validated at each request and not kept. |
10.2 Constraints a site may set
| Constraint | How it is met |
|---|---|
| No installation on the database server | Only the SqlBLT database with its SqlBLT schema and report procedures, and the three Agent jobs, exist there, all Transact-SQL. The Portal runs on a workstation, a server or a web server. |
| No credentials on the server | As table 10.1. The service account connects only to the service connections listed in its own configuration. |
| Read-only access to the database | The Portal and its API only execute the report procedures and read catalog views. SqlBLT_Reader is all they need. |
| Service accounts cannot log on interactively | The service logon type (B) and the IIS application pool (C) need no interactive logon. |
| Users' Windows logins on SQL Server | Needed only for Windows registrations: with --impersonate (B, C), and with section 8 (D). Where they are not permitted, users register SQL logins. |
| Neither SQL logins nor users' Windows logins on SQL Server | Service connections: the service account alone holds a read-only login on each SQL Server, and the allowed users read through it. |
| Sign-in with the organisation's identity provider, multi-factor authentication | Option D: the identity provider applies its own policies, including multi-factor authentication and conditional access, before the Portal sees the user. |
10.3 Network
| From | To | Port | For |
|---|---|---|---|
| Browsers, programs | The Portal, or its reverse proxy | 443, or the port of --urls or Kestrel (A: loopback only) | The page and the API |
| The Portal | Each SQL Server instance | TCP 1433, or the instance's port | The report procedures |
| The Portal (D) | The identity provider | HTTPS 443 | Discovery, signing keys, the token endpoint |
| The Portal (B, C, and D with section 8) | Domain controllers | The ports of a domain member, Kerberos 88 among them | Delegation and protocol transition |
10.4 Residual risks
- The administrator of a hosted Portal's server could read a connected user's SQL password from the process's memory. A remembered password is decrypted on that server at each connect, so whoever can run code there and obtains the encrypted text from a user's browser can recover it. That is inherent in any server that connects on a user's behalf with SQL authentication, and it is why Windows registrations, or service connections, are preferable where the site allows them.
- With service connections the access control is the group and the list of instances: keep both narrow.
- The key of the desktop app gives any process of the same Windows user the access of that user's registrations. It is no protection against the user's own processes, and it is not meant to be.
- An access token is a bearer credential: whoever holds it calls the API as its program until it expires. Keep tokens short-lived and out of logs and prompts.
- With section 8, the Portal's account may connect as any account of the domain to the instances it may delegate to, on the claim of the identity provider (section 8, the note).
11. Configuration reference
11.1 Command line
| Switch | Effect |
|---|---|
| (none) | A, the desktop app: http://127.0.0.1:8781 or a free port; opens the browser; the key of the desktop app is required |
--no-browser | A: does not open the browser; writes the address with the key to the console |
--urls <address> | The listen address, for example http://0.0.0.0:8781; or set the Kestrel endpoints in appsettings.json |
--hosted | B, C, D: the hosted server. Users authenticate with Windows, or with the section OpenIdConnect at the identity provider; registrations are kept in each user's browser; a connection belongs to the caller who opened it; nothing is written to disk |
--iis | C: with --hosted, started by the ASP.NET Core Module through the web.config beside the executable |
--impersonate | With --hosted: Windows registrations connect as the user: the user's Windows identity by Kerberos constrained delegation, or with the section OpenIdConnect the account of WindowsAccountClaim by protocol transition. Without it a hosted server refuses Windows registrations |
--encrypt-client-secret | Asks for a client secret and prints it encrypted for this computer, for OpenIdConnect:ClientSecret; starts nothing |
11.2 appsettings.json
| Setting | Options | Meaning |
|---|---|---|
Kestrel | A, B, D | The standard Kestrel endpoints and certificate |
ServiceConnections | B, C, D | An array of { "name", "server" }: instances the server connects to as its own account, listed for every user; the list is the allow-list of the service account |
AllowedGroup | B, C | The Windows group a user or program must belong to. Not allowed with the section OpenIdConnect: use AllowedClaim |
PublicAddress | D (required), B, C | The HTTPS address users open, host and port only, no path. With it, or with the section OpenIdConnect, the Portal is published (section 6.7) |
RememberMe | published | true: the Connect form offers Remember me. Unpublished, it is always offered |
ReverseProxies | published | An array of IP addresses of reverse proxies whose X-Forwarded-For gives the client address of the audit log |
OpenIdConnect:Authority | D (required) | The issuer address of the identity provider, https |
OpenIdConnect:ClientId | D (required) | The client identifier of the registration |
OpenIdConnect:ClientCertificate | D (one of two) | The thumbprint of the certificate in the store of the computer (Personal), whose private key the Portal's account can use |
OpenIdConnect:ClientSecret | D (one of two) | The client secret, encrypted by --encrypt-client-secret on this computer |
OpenIdConnect:AllowedClaim | D (required) | { "type": "<claim>", "values": [ ... ] }: a user or program is allowed when the claim holds one of the values |
OpenIdConnect:Scopes | D | Scopes asked for in addition to openid and profile |
OpenIdConnect:DisplayNameClaim | D | The claim whose value the top bar and the audit log show for a user |
OpenIdConnect:SessionHours | D | The absolute lifetime of a session; 8 unless set |
OpenIdConnect:Audience | D | The audience the access tokens of programs must be issued for. Without it the API accepts no access token |
OpenIdConnect:WindowsAccountClaim | D with --impersonate | The claim that carries each user's Active Directory user principal name (section 8). Required with --impersonate, refused without it |
11.3 Addresses outside the API
| Address | Served |
|---|---|
/ | The page. D without a session: the sign-in |
/api/v1/..., /api/v1/openapi.json | The API and its description |
/signin-oidc, /signout-callback-oidc | D: the redirect URIs of the registration |
POST /signout | D: signs the user, or the program of the token, out and closes its connections |
/signed-out, /sign-in-not-completed, /account-not-allowed | D: the pages served without a session |
/api/registrations | A: the user's registrations, from the DPAPI-protected file |