Home › Studies › SC-500 › Secure Compute › Server & VM Security

Server & VM Security

Disk encryption · Azure Bastion · just-in-time VM access · Azure Arc · Defender for Servers · agentless scanning · Trusted Launch · Azure Machine Configuration

By the tools4free.dev team · Last reviewed November 13, 2026

Practice questions for this topic →

Disk encryption options

OptionWhat it doesWhat to remember
Server-side encryption (SSE)Always enabled. Encrypts OS and data disks when Azure persists the data on the storage clusters.Doesn't encrypt temp disks or disk caches. With a disk encryption set (DES) it supports customer-managed keys.
Encryption at hostA VM option that enhances SSE. All temp disks and disk caches are encrypted at rest and flow encrypted to the storage clusters.Temporary disks and ephemeral OS disks use platform-managed keys. Needs the EncryptionAtHost feature registered on the subscription.
Azure Disk Encryption (ADE)Encrypts OS and data disks inside the VM by using DM-Crypt (Linux) or BitLocker (Windows). Integrated with Azure Key Vault, with an optional key encryption key (KEK).Scheduled for retirement on September 15, 2028. Use encryption at host for new VMs.
Confidential disk encryptionBinds disk encryption keys to the VM's TPM; the protected disk content is accessible only to the VM.Customer control of keys is through a DES. Defender for Cloud has no applicable recommendation for it.

Customer key control per option, from Microsoft's comparison: SSE and encryption at host use a DES, ADE uses a KEK, confidential disk encryption uses a DES. Defender for Cloud has one recommendation that detects only encryption at host and one for each OS that detects both ADE and EncryptionAtHost.

Azure Disk Encryption: prepare the key vault

  1. Create the key vault in the same region and tenant as the VMs to encrypt.
  2. Enable the vault for disk encryption: --enabled-for-disk-encryption when you create it, or az keyvault update ... --enabled-for-disk-encryption "true" on an existing vault. In the portal this is Access policies > Azure Disk Encryption for volume encryption. Enabling the vault for deployment or template deployment is only "if needed".
  3. If the vault firewall is enabled, open the vault's Networking tab and allow Microsoft Trusted Services.
  4. Optional: create a KEK. It must be an RSA key (Elliptic Curve isn't supported) and its URL must be versioned.
  5. Run az vm encryption enable (CLI) or Set-AzVMDiskEncryptionExtension (PowerShell) and pass the vault and, if used, the KEK.

Encryption at host with customer-managed keys

  1. Register the EncryptionAtHost feature in Microsoft.Compute for the subscription and wait until it shows Registered.
  2. Create the key vault with soft delete and purge protection. Both are mandatory when a vault encrypts managed disks.
  3. Give the admin who works with the vault the Key Vault Administrator, Owner or Contributor role.
  4. Create the disk encryption set in the same region as the vault with encryption type Encryption at-rest with a customer-managed key. The type can't be changed later; create a new DES instead.
  5. Create the VM, select Encryption at host on the Disks pane, and pick the key under Key management.

Azure Bastion

Azure Bastion is a fully managed PaaS service that gives RDP/SSH connectivity to VMs directly over TLS from the Azure portal, or through the native client on your computer. The VMs don't need a public IP address, an agent or special client software.

SKUDeploymentNotable features
DeveloperShared infrastructure; no virtual network, no AzureBastionSubnet, no public IP.Free. Supports one VM at a time and no virtual network peering. Not suitable for production.
BasicDedicated host. Requires AzureBastionSubnet and a public IP.Two instances are created.
StandardDedicated host. Requires AzureBastionSubnet and a public IP.Host scaling, native client, shareable links, IP-based connections, custom ports, file transfer.
PremiumDedicated host. Public IP not required for private-only deployment.All Standard features plus session recording and private-only deployment.

Subnet and public IP requirements

Features that need a higher SKU

NSG rules when you apply an NSG

If you apply an NSG to the Bastion resource, you must create all required rules. Omitting a rule blocks platform updates and can block VM connectivity.

RuleDirectionSourceDestinationPorts
AllowHttpsInboundInboundInternet*443
AllowGatewayManagerInboundInboundGatewayManager*443
AllowBastionHostCommunicationInboundVirtualNetworkVirtualNetwork8080, 5701
AllowAzureLoadBalancerInboundInboundAzureLoadBalancer*443
AllowSshRdpOutboundOutbound*VirtualNetwork22, 3389
AllowAzureCloudOutboundOutbound*AzureCloud443
AllowBastionCommunicationOutboundVirtualNetworkVirtualNetwork8080, 5701
AllowHttpOutboundOutbound*Internet80

Ports 3389 and 22 aren't required inbound on AzureBastionSubnet. The target VM subnet needs its own inbound rule for 3389/22 (or your custom ports) from the AzureBastionSubnet range. Without it Bastion can't reach the VMs even when it is configured correctly. Outbound 80 to the Internet is for session validation, Shareable Link and certificate validation.

Just-in-time (JIT) VM access

JIT is a Defender for Cloud feature of Defender for Servers Plan 2. It locks down inbound management ports on VMs and opens them only on request, for a limited time and from a given source.

  1. Enable Defender for Servers Plan 2 on the subscription.
  2. In Defender for Cloud, open Workload protections > Just-in-time VM access. On the Not configured tab, select the VMs and choose Enable JIT on VMs.
  3. Review the ports (22, 3389, 5985, 5986 are recommended) and per port the protocol, allowed source IPs and maximum request time. Select Save.
  4. Users then use Request access (from Defender for Cloud or the VM's Connect page), choosing ports, source IPs and the time window.

How it works

Support and permissions

Azure Arc and Defender for Servers

Azure Arc-enabled servers

Defender for Servers plans and scope

PlanWhat it adds
Plan 1Entry level. Focuses on endpoint detection and response (EDR) from the Defender for Endpoint integration.
Plan 2Everything in Plan 1 plus agentless scanning, compliance assessment, premium Defender Vulnerability Management, 500-MB free data ingestion for specific data types, OS configuration assessment, file integrity monitoring, just-in-time machine access and network map.
ScopePlan 1Plan 2
Enable for Azure subscriptionYesYes
Enable for resourceYesNo
Disable for resourceYesYes

Hybrid and multicloud onboarding

EDR and vulnerability scanning

Agentless scanning

Agentless scanning needs no agent or network connectivity and doesn't affect machine performance. It is available for Azure VMs, AWS EC2 and GCP compute instances connected to Defender for Cloud.

CapabilityDefender CSPMDefender for Servers Plan 2
Software inventoryYesYes
Vulnerability assessmentYesYes
Secrets scanningYesYes
Malware scanningNoYes

VM security features and Machine Configuration

Trusted Launch (security type)

Azure Machine Configuration

Azure Policy's machine configuration audits or configures operating system settings as code on machines in Azure and on Arc-enabled machines. It uses Azure Policy to assign configurations, or you can assign them manually.

Assignment typeBehavior
AuditOnly reports on the state of the machine.
ApplyAndMonitorApplied once, then monitored. If it drifts to NonCompliant it isn't corrected unless remediation is triggered. This is the default remediation-on-demand behavior.
ApplyAndAutoCorrectApplied, and if it drifts the local service corrects it at the next evaluation.

CLI and PowerShell

TaskAzure CLIPowerShell
Register encryption at host on the subscriptionaz feature register --name EncryptionAtHost --namespace Microsoft.ComputeRegister-AzProviderFeature -FeatureName "EncryptionAtHost" -ProviderNamespace "Microsoft.Compute"
Enable an existing key vault for disk encryptionaz keyvault update --name "<your-unique-keyvault-name>" --resource-group "MyResourceGroup" --enabled-for-disk-encryption "true"Set-AzKeyVaultAccessPolicy -VaultName "<your-unique-keyvault-name>" -ResourceGroupName "MyResourceGroup" -EnabledForDiskEncryption
Enable Azure Disk Encryption with a KEKaz vm encryption enable -g "MyResourceGroup" --name "myVM" --disk-encryption-keyvault "<your-unique-keyvault-name>" --key-encryption-key "myKEK"Set-AzVMDiskEncryptionExtension -ResourceGroupName MyResourceGroup -VMName "MyVM" -DiskEncryptionKeyVaultUrl $KeyVault.VaultUri -DiskEncryptionKeyVaultId $KeyVault.ResourceId -KeyEncryptionKeyVaultId $KeyVault.ResourceId -KeyEncryptionKeyUrl $KEK.Id -SkipVmBackup -VolumeType All
Configure JIT access on a VM-Set-AzJitNetworkAccessPolicy -Kind "Basic" -Location "LOCATION" -Name "default" -ResourceGroupName "RESOURCEGROUP" -VirtualMachine $JitPolicyArr
Request JIT access-Start-AzJitNetworkAccessPolicy -ResourceId "/subscriptions/SUBSCRIPTIONID/resourceGroups/RESOURCEGROUP/providers/Microsoft.Security/locations/LOCATION/jitNetworkAccessPolicies/default" -VirtualMachine $JitPolicyArr
Limit what the Arc agent can do (extension allowlist)azcmagent config set extensions.allowlist "Microsoft.Azure.Monitor/AzureMonitorWindowsAgent,Microsoft.Azure.AzureDefenderForServers/MDE.Windows"-
Disable Arc agent incoming connections and machine configurationazcmagent config set incomingconnections.enabled false azcmagent config set guestconfiguration.enabled false-
Enable Trusted launch on a deallocated Gen2 VMaz vm update --resource-group myResourceGroup --name myVm --security-type TrustedLaunch --enable-secure-boot true --enable-vtpm trueGet-AzVM -ResourceGroupName myResourceGroup -VMName myVm | Update-AzVM -SecurityType TrustedLaunch -EnableSecureBoot $true -EnableVtpm $true

Exam Tips

Tick each tip once you can answer it without looking.

“New VM: encrypt temp disks and caches end to end, no VM CPU cost, and avoid a retiring feature” → Encryption at host.. Trap: Server-side encryption doesn't encrypt temp disks or caches; ADE is scheduled for retirement on September 15, 2028.

“az vm encryption enable fails on a vault created without special options” → Enable the vault for disk encryption (--enabled-for-disk-encryption, or Access policies > Azure Disk Encryption for volume encryption).. Trap: Deployment and template-deployment access are marked "if needed"; disk encryption is the required one.

“ADE key vault has its firewall on and encryption fails” → On the vault's Networking tab, allow Microsoft Trusted Services.. Trap: The page says to allow Microsoft Trusted Services on the vault, and the vault must also be in the same region and tenant as the VM.

“Turn on encryption at host for a VM that was once encrypted with ADE” → Not possible: it can't be enabled on VMs that currently or ever had ADE.. Trap: Removing ADE doesn't help; the restriction covers VMs that ever had it.

“Customer-managed key for managed disks” → Key vault (soft delete + purge protection) + key + disk encryption set in the same region; the DES type can't be changed later.. Trap: A KEK is for ADE; the DES is for SSE and encryption at host.

“Bastion deployment (Basic or higher) fails on the subnet” → Subnet named AzureBastionSubnet, /26 or larger, no other resources, in the Bastion's virtual network.. Trap: Only Bastion resources already deployed in /27 subnets before November 2, 2021 keep working; Developer is the SKU with no subnet.

“Record RDP/SSH sessions for audit, no public IP on Bastion” → Premium SKU (session recording and private-only deployment).. Trap: Standard has native client, shareable links and custom ports, but not session recording.

“Bastion Basic needs native client, shareable links or custom ports” → Upgrade to Standard or Premium; downgrading isn't supported.. Trap: You can't edit the SKU down later: you would delete and recreate Bastion.

“NSG on AzureBastionSubnet, connections fail” → All required rules must exist (443 from Internet and GatewayManager, 8080/5701, outbound 22/3389, 443 AzureCloud, 80 Internet), plus inbound 22/3389 from AzureBastionSubnet on the target VM subnet.. Trap: 22 and 3389 inbound aren't needed on AzureBastionSubnet itself.

“Keep RDP/SSH closed and open them on request for a limited time” → Just-in-time VM access in Defender for Cloud, which needs Defender for Servers Plan 2.. Trap: Plan 1 doesn't include JIT; Azure Bastion is a separate service for RDP/SSH over TLS, not the Plan 2 feature that locks inbound ports.

“JIT can't be enabled on a VM” → Classic VM, firewall controlled by Azure Firewall Manager, or no NSG and no Azure Firewall.. Trap: Wrong plan is another cause: JIT is a Plan 2 feature.

“JIT is enabled but port 22 is still open from the internet” → An existing allow rule for that port has priority over the new deny rule; remove or adjust it.. Trap: Existing rules take priority over the new deny rule; the new rule only takes top priority when no rules exist on the port.

“On-premises server needs full Defender for Servers features” → Onboard it as an Azure Arc-enabled server.. Trap: Installing only the Defender for Endpoint agent gives Plan 1 functionality (plus premium Defender Vulnerability Management in Plan 2).

“Enable Defender for Servers for a few machines only” → Plan 1 can be enabled at the resource level (script, policy on a tag, or API); Plan 2 can't be enabled at the resource level.. Trap: Plan 2 can be disabled per resource but must be enabled on the subscription.

“Agentless scanning: which plan, how often, what about malware” → Defender CSPM or Servers Plan 2; every 24 hours; malware scanning only in Plan 2.. Trap: Defender CSPM alone doesn't include malware scanning, and you can't switch single capabilities off.

“A VM never shows agentless results” → Check that it was running during a scan, has 14 disks or fewer, has a combined disk size of 4 TB or less (above that only the OS disk is scanned), and has no unsupported disk type or file system; allow 24 hours.. Trap: A stopped VM isn't scanned in that cycle.

“Defender for Cloud raises attestation alerts for a VM” → Trusted Launch with Secure Boot, vTPM and the Guest Attestation extension (boot integrity monitoring).. Trap: Attestation fails if Secure Boot is disabled; a suppressed alert is the answer when you must disable it.

“Machine configuration must fix drift automatically” → Assignment type ApplyAndAutoCorrect.. Trap: ApplyAndMonitor applies once and then only reports drift unless remediation is triggered.

Sources

Checked against Microsoft Learn on November 13, 2026.

← AI Workload SecurityContainer Security →