Securing Kubernetes with Microsoft Defender for Containers on Azure, AWS, and Beyond

Containers are at the heart of modern cloud-native architectures, but they bring new security challenges. Whether you're running on AKS, EKS, GKE, or on-prem Kubernetes, you need visibility, vulnerability management, and real-time threat detection.
That's where Microsoft Defender for Containers steps in.
In this post, we'll explore how Defender for Containers works, how to enable it on your Kubernetes clusters, its multi-cloud capabilities, and key network/security considerations for production deployments.
🧭 What is Microsoft Defender for Containers?
Microsoft Defender for Containers is a cloud-native security solution that provides:
✅ Threat detection for containerized workloads
✅ Vulnerability scanning for images in ACR and workloads in AKS
✅ Kubernetes-aware recommendations and policy enforcement
✅ Runtime protection via eBPF sensors
✅ Security analytics & alerting integrated with Defender for Cloud
It brings full lifecycle security—from CI/CD pipeline to production runtime.
🌐 Multi-Cloud and Hybrid Kubernetes Protection
Microsoft Defender for Containers is not limited to Azure. It protects clusters running in:
Azure Kubernetes Service (AKS):
Azure's fully managed Kubernetes service.Amazon EKS (AWS):
Protect workloads in AWS by connecting the EKS clusters to Defender via Defender for Cloud’s multi-cloud connectors.Google GKE (GCP):
Integrate GKE clusters to gain visibility and apply the same Defender protections in your GCP environment.Other Kubernetes distributions (On-Prem or IaaS):
Using Azure Arc-enabled Kubernetes, you can bring any CNCF-compliant Kubernetes cluster under Defender protection, hosted on-premises or in any cloud.
This means you can standardize container security across all your environments, simplifying operations and compliance.
🚀 How to Enable Defender for Containers on AKS
Here's a step-by-step guide using the Azure Portal:
1. Open Microsoft Defender for Cloud
Navigate to the Azure Portal
Search for and open Microsoft Defender for Cloud
2. Enable Defender for Containers
Go to Environment settings
Select your subscription
Under Defender plans, turn on Microsoft Defender for Containers
Save your changes
3. Verify Agent Deployment
After enabling, Defender will:
Deploy Azure Policy extensions
Install the Log Analytics agent or Azure Monitor agent
Deploy the eBPF sensor for runtime visibility
Verify deployment by running:
bashCopyEditkubectl get pods -n azuredefender
📦 What Defender for Containers Secures
Feature | Description |
Threat Detection | Detects suspicious processes, crypto mining, lateral movement, etc. |
Vulnerability Scanning | Image scanning in ACR and runtime images in AKS |
Kubernetes Audit Log Analysis | Detects suspicious activity from Kubernetes API |
Runtime Monitoring (eBPF) | Deep kernel-level visibility without code changes |
Policy Enforcement | Via Azure Policy (e.g., block privileged containers, enforce TLS) |
🌐 Network & Connectivity Considerations (Production-Ready)
To ensure security and compliance in production, you should consider the following network integrations:
🔒 Private Link to Log Analytics
If your clusters send data to Log Analytics, use Azure Private Link to avoid exposing data over public internet.
Configure private endpoints for the Log Analytics workspace and Azure Monitor ingestion.
🧱 NSG Rules & UDRs
Ensure that network security groups (NSGs) and user-defined routes (UDRs) allow outbound access to:
Azure Policy service
Azure Monitor ingestion endpoints
Defender threat intelligence APIs
If you're using Private DNS Zones, configure them for services like
ods.opinsights.azure.com
andagentsvc.azure-automation.net
.
🌐 AKS Private Clusters
Defender fully supports AKS private clusters.
Ensure the Log Analytics agents and Defender components can communicate via private endpoints or service tags (e.g.,
AzureMonitor
,AzureDefender
).
🔗 Integration with Other Security Tools
Tool | Integration |
Azure Policy | Automatically audits and enforces container security settings |
Microsoft Sentinel | Stream Defender alerts into your SIEM for advanced correlation |
Azure Monitor / Log Analytics | Collects and visualizes logs and security signals |
Logic Apps / Playbooks | Trigger automated responses for container-based alerts |
🧠 Best Practices for Defender for Containers
✅ Enable Defender at the subscription level to enforce consistent protection
✅ Use Azure Container Registry (ACR) with image scanning
✅ Review alerts regularly and connect with your SOC
✅ Use Azure Policy to enforce baseline security (e.g., block privileged containers)
✅ Segment AKS clusters by workload sensitivity
✅ Integrate Defender alerts with Sentinel or a third-party SIEM
🧪 Bonus: Enable via CLI or Terraform
To automate Defender enablement, you can use Azure CLI:
bashCopyEditaz security pricing create --name ContainerRegistry --tier 'Standard'
az security pricing create --name KubernetesService --tier 'Standard'
Or use Terraform:
hclCopyEditresource "azurerm_security_center_subscription_pricing" "containers" {
tier = "Standard"
resource_type = "KubernetesService"
}
✅ Conclusion
As container adoption increases, so does the attack surface. Microsoft Defender for Containers provides a comprehensive, cloud-native way to secure your Kubernetes workloads across Azure, AWS, GCP, and even on-premises.
With built-in threat detection, vulnerability management, and runtime protection—along with flexible network and integration options—it’s a key component of any cloud-native security strategy.
📣 Call to Action:
If you're running AKS (or any Kubernetes), don’t leave it exposed. Enable Microsoft Defender for Containers today and bring your security posture up to enterprise-grade standards.
Subscribe to my newsletter
Read articles from Mostafa Elkattan directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Mostafa Elkattan
Mostafa Elkattan
Multi Cloud & AI Architect with 18+ years of experience Cloud Solution Architecture (AWS, Google, Azure), DevOps, Disaster Recovery. Forefront of driving cloud innovation. From architecting scalable infrastructures to optimizing. Providing solutions with a great customer experience.