Scanning container images before Kubernetes deployment with Microsoft Defender for Containers

AZ-400 By islever Editorial Last updated

Automate security and compliance scanning

Short answer

A Include Microsoft Defender for Containers, which scans container images in Azure Container Registry for vulnerabilities before deployment to the Kubernetes cluster.

Question

You plan to use Azure DevOps to build and deploy an app that will be hosted in a Kubernetes cluster.
You need to scan the app image for vulnerabilities before the image is deployed to the cluster.
What should you include in the solution?
  1. Microsoft Defender for Containers Correct Answer
  2. Microsoft Defender for App Service
  3. Microsoft Defender for DevOps
  4. Microsoft Defender for Storage

Key Takeaways

The question tests the distinction between scanning an actual container image artifact (Defender for Containers, via ACR) versus scanning source code/IaC/manifests in the pipeline (Defender for DevOps).

To scan a container image for vulnerabilities before deploying it to a Kubernetes cluster, use Microsoft Defender for Containers (A), which scans images pushed to Azure Container Registry using an integrated Trivy-based scanner.

Common mistake: Choosing C, Microsoft Defender for DevOps, because of the phrase "before deployment" — but Defender for DevOps scans code and configuration files, not the container image artifact itself; the image vulnerability scan is performed by Defender for Containers against images in ACR.

Expert Analysis

The core boundary: image-in-registry vs. code-in-pipeline

This question turns on which Microsoft Defender plan actually performs container image vulnerability scanning versus which one scans source code, IaC templates, and manifests. The scenario explicitly asks to "scan the app image for vulnerabilities before the image is deployed to the cluster" — that is a registry/pipeline artifact scan, not a code scan.

Why option A is correct

Microsoft Defender for Containers performs vulnerability assessment of container images stored in Azure Container Registry (ACR) using an integrated Trivy-based scanner. Images are scanned when pushed to ACR, i.e., before they are pulled and deployed to the Kubernetes cluster. It also adds runtime Kubernetes protection, but the pre-deployment image scan in ACR is exactly the capability the question requires. This is the long-standing AZ-400 doctrine for "scan image before deploying to AKS."

Why option C is the trap

Several community comments argue for C, Microsoft Defender for DevOps, leaning on the phrase "before the image is deployed." One comment claims "Defender for DevOps scans before deployment, Defender for Containers does not scan before deployment." That framing is misleading: Defender for DevOps primarily scans source code, IaC, and manifest files in Azure DevOps/GitHub repos — it is a code-and-configuration scanner, not an image vulnerability scanner. Defender for Containers, by contrast, scans the actual image artifact in ACR prior to cluster deployment, which is precisely the requested action.

Why B and D are wrong

B, Defender for App Service, protects App Service web apps, not Kubernetes workloads or container images. D, Defender for Storage, protects blob/container storage accounts against data threats, not container image vulnerabilities. Neither touches the image-deployment pipeline for a Kubernetes cluster.

Official Reference

https://learn.microsoft.com/en-us/azure/defender-for-cloud/defender-for-containers-introduction

This link opens the official vendor documentation in a new tab.

Exam Strategy

When an AZ-400 question asks about scanning a container image for vulnerabilities, identify the artifact being scanned: an actual image in a registry points to Microsoft Defender for Containers (Trivy-based ACR scanning), while source code, IaC, or manifest files point to Defender for DevOps. Watch for the keyword "image" versus "code" or "manifest," and remember that Defender for Containers covers both pre-deployment registry scans and runtime Kubernetes protection, so "before deployment" does not exclude it.

Community Votes

A
60%
C
40%

60% of anonymous learners picked answer A. Votes are pick records left by other test-takers — they are not the verified answer.

Discussion 9 contributions

Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.

From public community threads 9

  1. 17b9160 👍 3
    Provided answer is correct : A https://learn.microsoft.com/en-us/azure/defender-for-cloud/defender-for-containers-introduction
  2. vsvaid 👍 2
    Correct, Defender for containers
  3. Dats1987 👍 2
    Given ans is correct. A
  4. Theguy97 👍 2 Answered A
    answer is correct : A
  5. 8fc2e85 👍 1 Answered C
    Defender for DevOps I think https://learn.microsoft.com/en-us/azure/defender-for-cloud/azure-devops-extension. It'll scan the image artefact. Defender for containers sounds more runtime.
Show 4 more comments
  1. wyvern99 👍 1 Answered C
    Key: before the image is deployed. Defender for DevOps scans before deployment, Defender for Containers does not scan before deployment.
  2. Dkijc 👍 1
    It does say it uses 3rd party Trivy for container images... Why do they always make these kinds of questions??
  3. UrbanRellik 👍 1 Answered A
    A. Kubernetes is a containerized solution for web apps.
  4. ozbonny 👍 1 Answered A
    A. Microsoft Defender for Containers

Reader comments & corrections

No reader corrections yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Practice All AZ-400 Questions

Access 100 questions with complete answers and detailed explanations.

View Full AZ-400 Practice Test →

← Back to AZ-400 Study Guide