How to Configure Azure VM Audit SSH Sessions

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up azure vm audit ssh sessions by pairing cloud role checks with host logs. This setup records who logs into a server and when the login happens. Many teams start by giving engineers broad cloud roles or shared SSH keys. Those broad permissions let one person change files across every Linux server at once. When an outage hits, shared keys make it hard to see who ran a bad command. How native azure vm audit ssh sessions work To track logins well, teams combine cloud role rules with Ope

SSH Session Recording + Session Binding to Device: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

You set up azure vm audit ssh sessions by pairing cloud role checks with host logs. This setup records who logs into a server and when the login happens. Many teams start by giving engineers broad cloud roles or shared SSH keys. Those broad permissions let one person change files across every Linux server at once. When an outage hits, shared keys make it hard to see who ran a bad command.

How native azure vm audit ssh sessions work

To track logins well, teams combine cloud role rules with OpenSSH certificates. An OpenSSH certificate holds a public key, identity data, and principal names. A Certification Authority key signs all of these fields together. OpenSSH certificates use a much simpler format than X.509 certificates. When an engineer asks to log in, the system checks their cloud role first.

If the role matches the server rule, a signing tool signs their public key. The signing step adds a key identity and lists allowed user or host names. It also sets a time window so the signed certificate expires on schedule. Without an end time, a certificate stays valid forever by default. The Linux server trusts the Certification Authority key and reads the identity from the certificate.

The server then writes that identity and the login time to the system log. Teams often forward these system logs to a central cloud log workspace. They also route traffic through a bastion or jump host to limit direct network paths. This gives security teams a central list of every login event across the fleet. You can check the log workspace to see which user opened an SSH tunnel.

What native login logs solve and what they miss

Native login logs and certificates solve the problem of static, shared SSH keys. You no longer need to copy public keys onto every new Linux machine by hand. When someone leaves the team, you do not have to scrub keys from old servers. Their signed certificate simply expires, and the cloud role blocks any new key signing. The server log also shows a clear user identity for every single login event.

Still, this native setup only decides who can open the door to the server. Once the SSH tunnel opens, the cloud control plane steps out of the way. Standard SSH daemon logs record the login event, not the commands typed inside the shell. If an engineer logs in as a root user, every command runs with full power. A mistyped command can still drop a local table or delete system files.

SSH Session Recording + Session Binding to Device: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Even if you turn on OS command accounting, root users can alter local log files. Local agents can also lag before they send log lines to the central workspace. Moreover, native SSH logs do not scrub sensitive text that prints to the terminal screen. If someone runs a script that outputs emails, phone numbers, or card numbers, raw values print out. Native login rules govern the gate, not what happens inside the active shell.

Closing the gap on live command control

To close this gap, teams need controls that work inside the active session itself. Instead of stopping at the login check, security rules must inspect commands in flight. Teams also need a way to require peer approval before risky shell commands run. Masking rules that rewrite emails, national IDs, or card numbers in output reduce data exposure. Moving audit capture outside the target VM keeps logs safe from local root changes.

Inspect one-shot SSH commands and file tasks

SSH certificates and host rules decide who is allowed on a machine. Setup alone does not check single commands or block sftp reads on sensitive paths. By design, hoop.dev runs an inline open-source SSH listener on the host where engineers and AI agents keep their normal ssh, sftp, and scp tools. On every production command or file operation, hoop.dev decides whether to pass, mask, block, or hold it for approval.

First, hoop.dev guardrails check one-shot commands and file paths before they run, and hoop.dev data masking masks matched values in file downloads. The audit trail logs the certificate principal, requested action, and verdict without storing session content. Interactive shells carry no guardrails and can be turned off when every action must be checked. Explore the code on GitHub.

Frequently asked questions

Do standard SSH daemon logs record every command a user runs?

No, standard SSH daemon logs only record login checks, key details, and connection drops. Capturing each shell command requires extra OS audit tools or an external session layer.

How do OpenSSH certificates improve server login tracking?

Each certificate embeds a signed key identity and a list of allowed principal names. The SSH server writes this identity straight into the log whenever a user logs in.

Why is local VM log forwarding risky for strict audits?

A user with root rights on the VM can pause the log agent or edit local files. Capturing session data outside the host prevents users from tampering with the audit trail.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.