Troubleshoot Microsoft Defender for Containers

This article provides troubleshooting guidance for common deployment and operational issues in Microsoft Defender for Containers across all supported environments.

Common deployment issues

  • Defender sensor installation fails

    • Symptoms: kubectl get pods -n kube-system -l app=defender shows Defender sensor pods in Pending, CrashLoopBackOff, or Error.
    • Resolution:
      • Insufficient resources: Check node capacity. Use kubectl top nodes to verify if nodes have enough CPU and memory to schedule the sensor.
      • Network egress: Verify your cluster firewall or NSG allows outbound traffic to the required FQDNs.
      • Taints and Tolerations: Ensure node taints aren't preventing the pods from scheduling on specific node pools.
  • Missing recommendations

    • Symptoms: Clusters show as "Healthy" but specific recommendations like "AKS clusters should have Defender profile enabled" are missing.

    • Resolution:

      • Wait time: Assessment scans can take up to 24 hours to reflect in the dashboard.
      • Exclusion tags: Check if the resource has the tag ms_defender_container_exclude_sensors = true.
      • Policy Add-on: Ensure the Azure Policy add-on is installed; without it, configuration-based recommendations will not trigger.
  • Security Gating Fails to provision

    • Symptoms: Security Gating is enabled, but its admission-controller resources are missing or Admission Monitoring shows no data.

    • Diagnosis: In the affected AKS cluster's Activity log, look for a failed Microsoft.ContainerService/managedClusters/write operation with the error RequestDisallowedByPolicy. Inspect the error details to identify the blocking policy assignment. A policy assignment using the Deny effect can reject provisioning even when the existing cluster is compliant.

    • Policies enforcing the following AKS settings can be involved:

      • Disabled local authentication.

      • Customer-managed encryption keys for operating-system and data disks.

      • Encryption at host for temporary disks and agent-node-pool caches.

      • Private clusters.

    • Resolution:

      • Work with your Azure Policy administrator to resolve the identified conflict using an approved, narrowly scoped change, such as an exemption for the affected cluster.

      • Preserve the cluster's required security configuration. Don't enable local authentication or disable policy enforcement at a broader scope to work around the failure.

      • If provisioning remains incomplete, contact Microsoft Support for the supported recovery procedure.

Vulnerability scan issues

  • Missing vulnerability findings for images in Azure Container Registry

    • Symptoms: Vulnerability findings don't appear for images stored in Azure Container Registry.
    • Resolution:
      • Registry scanning: Confirm that the relevant registry scanning capability is enabled for Defender for Containers. In the Azure portal, verify that Registry access is enabled for the relevant scope.
      • Further investigation: If registry scanning is enabled and findings are still missing, open a support case with the registry name, image name, image digest, and expected finding details.
  • Missing vulnerability findings for images running on AKS clusters

    • Symptoms: Vulnerability findings don't appear for images that are currently running in AKS workloads.
    • Resolution:
      • Vulnerability scanning: Confirm that the relevant vulnerability scanning capability is enabled for Defender for Containers. Runtime vulnerability findings depend on available scan results for the running image, such as registry scan or disk scan results.
      • Pod inventory collection: Confirm that pod inventory collection is enabled for the cluster. For AKS, pod inventory can be collected by the Defender sensor or by agentless collection, depending on the deployment configuration.
      • Further investigation: If vulnerability scanning and pod inventory collection are enabled but findings are still missing, open a support case with the cluster name, namespace, workload name, image name, and image digest.

Verification via alert simulation

Use the Kubernetes alerts simulation tool to verify that Defender for Containers can generate alerts for your cluster and send them to Defender for Cloud.