Azure Security Fundamentals Part - 2: Protecting Secrets with Key Vault and Securing Virtual Machines

February 12, 2025
Azure SecurityAzureSecurity

๐Ÿ” Azure Key Vault and Virtual Machine Security

Securing your cloud assets goes beyond managing users and Networks it also means protecting secrets and infrastructure. This post dives into two critical components:

  • Azure Key Vault: for secure secret management
  • Azure Virtual Machines: best practices for VM hardening

๐Ÿ—๏ธ Azure Key Vault: Secure Secret Management

Applications often require access to sensitive data

  • Connection strings
  • API keys
  • Certificates
  • Encryption keys

Storing these in environment files or configuration databases is insecure and outdated.

Azure Key Vault is a secure service that allows you to store and manage secrets centrally and safely.

๐Ÿ” Key Features

  • Stores secrets, keys, and certificates
  • Integrated with Azure AD for fine grained access control
  • Supports Hardware Security Modules (HSMs) for maximum security
  • Exposes a REST API for secure programmatic access
  • Integrates with services like Azure App Service, VMs, and Functions
  • Cost-effective for most use cases

๐Ÿ’ก Use Key Vault in combination with Managed Identities to avoid storing secrets in your code.

๐Ÿงฐ Key Vault Use Case: VM Disk Encryption

Azure Disk Encryption uses:

  • BitLocker (Windows)
  • DM Crypt (Linux)

Key management can be offloaded to Azure Key Vault, improving compliance and security posture.


๐Ÿ–ฅ๏ธ Virtual Machine Security: Locking Down Azure VMs

Azure VMs provide maximum control and therefore maximum attack surface. Treat every VM like a potential breach point.

โš–๏ธ Use Minimum Permissions

Do not assign broad roles like Contributor. Instead:

  • Use Virtual Machine Contributor for VM tasks
  • Apply least privilege principles with custom RBAC roles

๐Ÿ”„ Keep VMs Up To Date

Security starts with patches. To ensure VMs are always up to date:

  • Use the latest OS image
  • Enable Azure Automatic VM Guest Patching
  • Apply critical patches immediately
Azure handles patching during off peak hours and monitors the VM status.

โœ… Fully automatic and free with most VM SKUs.

๐Ÿ›ก๏ธ Protect Against Malware

Install and maintain a trusted antimalware solution such as

  • Microsoft Defender for Endpoint
  • Windows Defender
  • TrendMicro, McAfee, etc.

Integrate with Defender for Cloud for centralized alerting.

๐Ÿ” Enable Disk Encryption

Encrypt both OS and data disks

OSEncryption MethodKey Management
LinuxDM CryptAzure Key Vault
WindowsBitLockerAzure Key Vault

๐ŸŒ Restrict Internet Access

Public exposure is one of the top attack vectors.

Best practices

  • Use NSGs to limit RDP/SSH to specific IP ranges
  • NEVER allow full HTTP/HTTPS access to VMs directly
  • Route all public traffic via Firewall or Application Gateway (WAF)

๐Ÿงช Want to test VM vulnerabilities? Try scanning your VMs using Microsoft Defender for Cloud's integrated threat detection.


๐Ÿงช Summary

AreaAction
SecretsUse Key Vault and avoid storing in code
Disk EncryptionEnable BitLocker / DM-Crypt + Key Vault
PatchingTurn on Azure Guest Patching
Malware ProtectionUse Defender, integrate with Defender for Cloud
PermissionsAvoid broad roles, use VM-specific roles
Internet AccessBlock by default, use firewalls and WAFs