Resolve a SQL Server session-evidence permission gap
Resolve a SQL Server evidence permission gap
Loading video…
What you will accomplish
Follow one SQL Server metadata scan from a partial result to an explicitly reviewed permission change, a second scan, and a comparison of historical evidence. This lesson follows native agent installation and local database authorization. The agent, verified server certificate, pinned destination, and read-only database connection are prepared before the recording.
The SQL command panel is a formatted live response viewer: an administrator helper sends the displayed statement to the owned database and returns the fresh reader check. It is not a native SQL console or prerecorded command output. The workspace forms, job transitions and evidence navigation are the actual product interface.
The database is an owned SQL Server 2022 Developer test instance. Commands and workspace responses are real; no provider responses are mocked. The example grant is temporary. Do not apply it to production without the database owner's approval.
Before you begin
- Use a database-capable enrolled agent with a successful local readiness check. See the Windows, Linux and macOS database authorization lessons.
- Keep the exact locally authorized connection ID. The workspace job references that ID; it does not carry a database password.
- Verify hostname, destination, CA trust and service-account access separately. A permission change does not repair an invalid certificate or unreachable server.
- Use a workspace role authorized to submit scans. A separate database administrator reviews any database grant.
- Retain the initial job ID and evidence receipt. A later successful result must not erase earlier missing evidence.
Run and inspect the initial scan
- Open scan setup and choose Database.
- Enter a recognizable job name and the locally authorized connection ID.
- Search for and choose the intended database-capable agent.
- Submit once and follow the job through completion. Inspect a partial outcome rather than retrying blindly.
- Open the resulting inventory asset and expand evidence. Locate the SQL Server session probe.
- A
permission-deniedstatus means the collector could not observe the requested metadata. It is not an observation that encryption is disabled.
Review the exact permission
For SQL Server 2022 and later, Microsoft documents VIEW SERVER PERFORMANCE STATE for sys.dm_exec_connections. Earlier SQL Server versions and Azure database products have different requirements. Consult the version and service-specific Microsoft documentation.
This grant permits server-wide performance metadata visibility. The collector's query filters to its own session, but that query restriction does not narrow the permission's overall authority. If the additional visibility is unacceptable, retain the gap and document that decision. Do not replace the reader with sysadmin merely to remove a warning.
In this owned fixture, an administrator runs:
GRANT VIEW SERVER PERFORMANCE STATE TO qscan;
qscan is the fixture login, not a universal installation username. The live check confirms the session becomes readable while SELECT on the fixture's application table remains ungranted. No application rows are queried or exported by the discovery task.
Run a second scan and compare
- Submit a new database job using the same connection and agent.
- Wait for the new job's result and inspect its evidence.
- Confirm the session probe changes from
permission-deniedtoobserved. - Review the returned encryption flag, network transport and login authentication scheme.
- Preserve unknown fields. An enabled session encryption flag does not identify its cipher, key exchange or PQC status. SQL authentication identifies a login scheme, not the certificate signature algorithm.
- TDE and aggregate Always Encrypted column metadata remain separately requested probes with their own permission requirements. They are not implicitly assessed by this change.
- Reopen the earlier evidence receipt and confirm it still records the original denial. Historical evidence describes the earlier scan, not current permissions.
Remove temporary access
The test administrator restores the original permission state:
REVOKE VIEW SERVER PERFORMANCE STATE FROM qscan;
A new reader check returns the original denial. This does not invalidate or rewrite the evidence already collected. In production, follow the approved decision about whether the grant is permanent or temporary. Revoking one direct grant does not remove equivalent permissions inherited through another role or grant; inspect the actual effective access.
Recover from common problems
- Permission still denied: check the actual SQL Server version, login, effective role memberships and the service account's configured connection. Do not escalate automatically.
- TLS validation fails: restore the correct CA/hostname configuration; do not disable certificate verification to reach the permission test.
- Job remains partial: inspect each probe. Correcting session visibility does not satisfy optional storage probes or reveal unsupported crypto details.
- No new evidence: inspect job state, agent readiness and local authorization. A successful SQL grant alone is not managed-scan acceptance.
- Duplicate job uncertainty: check the existing job before submitting again. Use a new job deliberately for the post-change comparison.
- Revocation appears ineffective: inspect role-derived or other effective grants. A direct REVOKE is not a DENY and does not override other authorization paths.
Narration transcript
Let's troubleshoot a SQL Server evidence gap. We'll run a bounded scan, inspect the denied probe, review one permission, and compare a second result. The native agent and local database authorization are already prepared. Choose Database and give this first job a recognizable name. Enter the connection ID from the local authorization, then search for the intended database-capable agent. Check both selections before submitting. This is our isolated SQL Server twenty twenty-two instance. The job asks for metadata, not application rows. Submit once and follow the job's state. If the response is slow, inspect the existing job before starting another one. We'll open its evidence next. The first job is partial. Find its database connection in inventory, open the asset, and expand the evidence. Look specifically at the session probe. Permission denied means the collector couldn't observe that metadata. It doesn't mean the connection is unencrypted, and it doesn't mean the database is safe. Keep the original job as the before change record. For SQL Server twenty twenty-two, this view requires View Server Performance State. That's server-wide metadata access, so review it with the database owner. If that visibility isn't acceptable, keep the gap. Don't grant sysadmin just to turn a status green. In this owned test instance, we approve that specific permission. Watch the command execute. The reader still has no select permission on our application table. We're changing metadata visibility, not weakening certificate validation. Create a second job with a different name so we can distinguish the comparison. Keep the same database connection and the same authorized agent. Review those selections and submit once. The earlier job stays in history. A changed permission doesn't rewrite its evidence. Wait for this new result before drawing a conclusion. A successful SQL command proves that the grant executed, but the managed scan still has to demonstrate that this collector can read the view. Now inspect the new session evidence. Encryption is observed as enabled with TCP transport and SQL authentication. The negotiated cipher and key establishment are still unknown. This fixes one visibility gap. It does not establish post-quantum readiness. We'll revoke the temporary metadata permission in this test instance and confirm the probe is denied again. A production administrator would retain or remove the grant according to the approved policy. Existing evidence remains historical. You've traced a partial result to a specific permission, checked its scope, rerun discovery, and compared the outcome. Preserve the unknown fields and the original evidence. Investigate the next gap separately without automatically widening access.