Microsoft Defender for Cloud
Cloud and workloads

Map container images from code to runtime

In brief

The article now describes mapping from CI/CD pipelines to registries and Kubernetes runtime, covers DevOps connectors, Docker labels, and GitHub attestations, and adds prerequisites and Azure portal verification guidance.

What Defender admins need to know

Administrators can use the updated guidance to select a mapping method, confirm prerequisites, and verify code-to-runtime mappings.

Summaries are generated from the documentation change itself.

Documentation change

The comparison below shows only the changed extract. Use the full-page view for complete context.

When Defender for Cloud finds a vulnerability in a container image, it can be hard to trace that image back to the original CI/CD pipeline run. This challenge is common whether the image is in a container registry or running in a Kubernetes cluster. Without pipeline context, it's harder to find the right developer and start remediation quickly. Defender Cloud Security Posture Management (CSPM) includes DevOps security capabilities that map container workloads from code to cloud, so teams can start remediation faster.

This article explains the available mapping methods, the prerequisites for each, and how to verify the resulting code-to-runtime mapping in the Azure portal. Before you begin, make sure the required Defender CSPM or Defender for Containers prerequisites are met.

Code to runtime – technical prerequisites

The following prerequisites are required to establish code to runtime relationships.

Option 1: Connect your code environment to Defender for Cloud

When you connect your codean Azure DevOps or GitHub environment to Defender for Cloud, a set of automated tools is triggered automatically. TheseThe automated tools do not affect your existing DevOps workflows and enable code-to-runtime mapping.

For steps to connect a code environment to Defender for Cloud, see:

Docker labels-based mapping relies on metadata that is embedded directly in the container image at build time. Defender for Cloud extracts this metadata from the OCI/Docker image manifest and uses it to correlate the image to its source repository.

For more information,information about Docker labels-based mapping, see:

Option 3: GitHub attestations-based mapping

Attestation-based mapping uses cryptographically verifiable provenance metadata generated during GitHub Actions workflows. These attestations link container images to their exact source repository, commit, and build identity.

For more information about attestation-based mapping, see:

Verify your code to runtime mapping (Azure portal)

AfterRegardless of which mapping method you use (DevOps connector, Docker labels, or GitHub attestations), you can verify the resulting code-to-runtime mapping in the Azure portal. The following example shows how to view mapping results after building a container image in an Azure DevOps CI/CD pipeline and pushing it to a registry, useregistry. Use Cloud Security Explorer to view the mapping:

  1. Sign in to the Azure portal at Azure portal.

  2. Go to Microsoft Defender for Cloud > Cloud Security Explorer. Container image mapping can take up to four hours to appear.