You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/defender-for-cloud/container-image-mapping.md
+40-10Lines changed: 40 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ ms.topic: how-to
6
6
ms.custom: ignite-2023
7
7
---
8
8
9
-
# Map Container Images from Code to Cloud
9
+
# Map container images from code to cloud
10
10
11
11
When a vulnerability is identified in a container image stored in a container registry or running in a Kubernetes cluster, it can be difficult for a security practitioner to trace back to the CI/CD pipeline that first built the container image and identify a developer remediation owner. With DevOps security capabilities in Microsoft Defender Cloud Security Posture Management (CSPM), you can map your cloud-native applications from code to cloud to easily kick off developer remediation workflows and reduce the time to remediation of vulnerabilities in your container images.
12
12
@@ -15,7 +15,7 @@ When a vulnerability is identified in a container image stored in a container re
15
15
- An Azure account with Defender for Cloud onboarded. If you don't already have an Azure account, [create one for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
16
16
-[Azure DevOps](quickstart-onboard-devops.md) or [GitHub](quickstart-onboard-github.md) environment onboarded to Microsoft Defender for Cloud.
17
17
- For Azure DevOps, [Microsoft Security DevOps (MSDO) Extension](azure-devops-extension.md) installed on the Azure DevOps organization.
18
-
- For GitHub, [Microsoft Security DevOps (MSDO) Action](github-action.md) configured in your GitHub repositories.
18
+
- For GitHub, [Microsoft Security DevOps (MSDO) Action](github-action.md) configured in your GitHub repositories. Additionally, the GitHub Workflow must have "**id-token: write"** permissions for federation with Defender for Cloud. For an example, see [this YAML](https://github.com/microsoft/security-devops-action/blob/7e3060ae1e6a9347dd7de6b28195099f39852fe2/.github/workflows/on-push-verification.yml).
- The container images must be built using [Docker](https://www.docker.com/) and the Docker client must be able to access the Docker server during the build.
21
21
@@ -48,14 +48,44 @@ The following is an example of an advanced query that utilizes container image m
48
48
49
49
1. Add the container image mapping tool to your MSDO workflow:
50
50
51
-
```yml
52
-
# Run analyzers
53
-
- name: Run Microsoft Security DevOps Analysis
54
-
uses: microsoft/security-devops-action@latest
55
-
id: msdo
56
-
with:
57
-
include-tools: container-mapping
58
-
```
51
+
```yml
52
+
name: Build and Map Container Image
53
+
54
+
on: [push, workflow_dispatch]
55
+
56
+
jobs:
57
+
build:
58
+
runs-on: ubuntu-latest
59
+
# Set Permissions
60
+
permissions:
61
+
contents: read
62
+
id-token: write
63
+
steps:
64
+
- uses: actions/checkout@v3
65
+
- uses: actions/setup-python@v4
66
+
with:
67
+
python-version: '3.8'
68
+
# Set Authentication to Container Registry of Choice
69
+
- name: Azure Container Registry Login
70
+
uses: Azure/docker-login@v1
71
+
with:
72
+
login-server: <containerRegistryLoginServer>
73
+
username: ${{ secrets.ACR_USERNAME }}
74
+
password: ${{ secrets.ACR_PASSWORD }}
75
+
# Build and Push Image
76
+
- name: Build and Push the Docker image
77
+
uses: docker/build-push-action@v2
78
+
with:
79
+
push: true
80
+
tags: ${{ secrets.IMAGE_TAG }}
81
+
file: Dockerfile
82
+
# Run Mapping Tool in MSDO
83
+
- name: Run Microsoft Security DevOps Analysis
84
+
uses: microsoft/security-devops-action@latest
85
+
id: msdo
86
+
with:
87
+
include-tools: container-mapping
88
+
```
59
89
60
90
After building a container image in a GitHub workflow and pushing it to a registry, see the mapping by using the [Cloud Security Explorer](how-to-manage-cloud-security-explorer.md):
0 commit comments