Check ID: vm_jit_access_enabled
Provider: Azure
Service: vm
Severity: MEDIUM
Categories: internet-exposed
Resource type: microsoft.compute/virtualmachines
What this check verifies
Azure virtual machines are associated with a Just-in-Time (JIT) network access policy that opens management ports only for approved, time-bound requests from specified source IPs.
Risk
Without JIT, management ports like 22/3389 may stay reachable, enabling:
- brute-force and password-spray attempts
- exploitation of remote access flaws or stolen keys
This threatens confidentiality (data exfiltration), integrity (unauthorized changes), and availability (service disruption).
Recommendation
Enable JIT network access and apply least privilege and zero trust:
- keep admin ports closed by default
- approve only specific IPs, minimal ports (e.g.,
22, 3389), and short windows
- favor private access (VPN, Bastion)
- layer controls (defense in depth) and audit access requests
CLI
Terraform
Native IaC
Dashboard steps
az rest --method PUT --url "https://management.azure.com/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.Security/locations/<LOCATION>/jitNetworkAccessPolicies/default?api-version=2020-01-01" --body '{"kind":"Basic","properties":{"virtualMachines":[{"id":"/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.Compute/virtualMachines/<VM_NAME>","ports":[{"number":22,"protocol":"*","allowedSourceAddressPrefix":["*"],"maxRequestAccessDuration":"PT3H"}]}]}}'
# Enable JIT by creating a Security Center JIT policy for the VM
resource "azurerm_security_center_jit_network_access_policy" "<example_resource_name>" {
name = "default"
location = "<LOCATION>"
resource_group_name = "<example_resource_name>"
virtual_machines {
id = "<example_resource_id>" # Critical: VM ID included in the JIT policy enables JIT for this VM
ports {
number = 22
protocol = "*"
allowed_source_address_prefixes = ["*"]
max_request_access_duration = "PT3H" # Critical: Minimal port config required by JIT
}
}
}
// Bicep: Enable JIT for a VM by creating a JIT policy that references the VM
param location string = "<LOCATION>"
param vmId string = "/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<example_resource_name>/providers/Microsoft.Compute/virtualMachines/<example_resource_name>"
resource jit 'Microsoft.Security/locations/jitNetworkAccessPolicies@2020-01-01' = {
name: '${location}/default'
properties: {
virtualMachines: [
{
id: vmId // Critical: Adding the VM ID enables JIT for this VM
ports: [
{
number: 22
protocol: '*'
allowedSourceAddressPrefix: ['*']
maxRequestAccessDuration: 'PT3H' // Critical: Minimal required port configuration for JIT
}
]
}
]
}
}
- In the Azure portal, go to Microsoft Defender for Cloud
- Select Workload protections > Just-in-time VM access
- Open the Not configured tab, select the VM, and click Enable JIT on VMs
- Keep the default port (22 for Linux or 3389 for Windows) and click Save
References
Where this check fires
This check runs on every scheduled scan against your Azure account. Findings appear at Cloud Security → Findings filterable by Check ID = vm_jit_access_enabled. To re-evaluate after a fix, hit Run now on the account’s schedule under Cloud Security → Schedules — the next scan re-checks this control and marks the finding fixed or keeps it persistent.
← Back to Azure checks