Skip to content

Commit 2698d6e

Browse files
authored
Merge pull request #267105 from laragoldstein13/docs-editor/container-image-mapping-1708710452
Update container-image-mapping.md
2 parents 50cb832 + 38f165d commit 2698d6e

File tree

1 file changed

+40
-10
lines changed

1 file changed

+40
-10
lines changed

articles/defender-for-cloud/container-image-mapping.md

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ms.topic: how-to
66
ms.custom: ignite-2023
77
---
88

9-
# Map Container Images from Code to Cloud
9+
# Map container images from code to cloud
1010

1111
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.
1212

@@ -15,7 +15,7 @@ When a vulnerability is identified in a container image stored in a container re
1515
- 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).
1616
- [Azure DevOps](quickstart-onboard-devops.md) or [GitHub](quickstart-onboard-github.md) environment onboarded to Microsoft Defender for Cloud.
1717
- 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).
1919
- [Defender CSPM](tutorial-enable-cspm-plan.md) enabled.
2020
- 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.
2121

@@ -48,14 +48,44 @@ The following is an example of an advanced query that utilizes container image m
4848

4949
1. Add the container image mapping tool to your MSDO workflow:
5050

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+
```
5989
6090
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):
6191

0 commit comments

Comments
 (0)