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/tutorial-enable-pull-request-annotations.md
+65-52Lines changed: 65 additions & 52 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,17 +3,17 @@ title: Tutorial Enable pull request annotations in GitHub or in Azure DevOps
3
3
description: Add pull request annotations in GitHub or in Azure DevOps. By adding pull request annotations, your SecOps and developer teams so that they can be on the same page when it comes to mitigating issues.
4
4
ms.topic: overview
5
5
ms.custom: ignite-2022
6
-
ms.date: 09/20/2022
6
+
ms.date: 10/20/2022
7
7
---
8
8
9
9
# Tutorial: Enable pull request annotations in GitHub and Azure DevOps
10
10
11
-
With Microsoft Defender for Cloud, you can configure pull request annotations in Azure DevOps. Pull request annotations are enabled in Microsoft Defender for Cloud by security operators and are sent to the developers who can then take action directly in their pull requests. This allows both security operators and developers to see the same security issue information in the systems they're accustomed to working in. Security operators see unresolved findings in Defender for Cloud and developers see them in their source code management systems. These issues can then be acted upon by developers when they submit their pull requests. This helps prevent and fix potential security vulnerabilities and misconfigurations before they enter the production stage.
11
+
Defender for DevOps exposes security findings as annotations in Pull Requests (PR). Security operators can enable PR annotations in Microsoft Defender for Cloud. Any exposed issues can then be remedied by developers. This process can prevent and fix potential security vulnerabilities and misconfigurations before they enter the production stage. Defender for DevOps annotates the vulnerabilities within the differences in the file rather than all the vulnerabilities detected across the entire file. Developers are able to see annotations in their source code management systems and Security operators can see any unresolved findings in Microsoft Defender for Cloud.
12
12
13
-
You can get pull request annotations in GitHub if you're a customer of GitHub Advanced Security.
13
+
With Microsoft Defender for Cloud, you can configure PR annotations in Azure DevOps. You can get PR annotations in GitHub if you're a GitHub Advanced Security customer.
14
14
15
15
> [!NOTE]
16
-
> During the Defender for DevOps preview period, GitHub Advanced Security for Azure DevOps (GHAS for AzDO) is also providing a free trial of pull request annotations.
16
+
> GitHub Advanced Security for Azure DevOps (GHAzDO) is providing a free trial of PR annotations during the Defender for DevOps preview.
17
17
18
18
In this tutorial you'll learn how to:
19
19
@@ -27,55 +27,47 @@ Before you can follow the steps in this tutorial, you must:
27
27
28
28
**For GitHub**:
29
29
30
-
- Have an Azure subscription, create a [free account](https://azure.microsoft.com/free/) before you begin
31
-
-[Enable Defender for Cloud](get-started.md)
32
-
- Have [enhanced security features](enhanced-security-features-overview.md) enabled on your Azure subscriptions
33
-
-[Connect your GitHub repositories to Microsoft Defender for Cloud](quickstart-onboard-github.md)
34
-
-[Configure the Microsoft Security DevOps GitHub action](github-action.md)
35
-
- Be a [GitHub Advanced Security customer](https://docs.github.com/en/get-started/learning-about-github/about-github-advanced-security)
30
+
- An Azure account. If you don't already have an Azure account, you can [create your Azure free account today](https://azure.microsoft.com/free/).
31
+
- Be a [GitHub Advanced Security](https://docs.github.com/en/get-started/learning-about-github/about-github-advanced-security) customer.
32
+
-[Connect your GitHub repositories to Microsoft Defender for Cloud](quickstart-onboard-github.md).
33
+
-[Configure the Microsoft Security DevOps GitHub action](github-action.md).
36
34
37
35
**For Azure DevOps**:
38
36
39
-
- Have an Azure subscription, create a [free account](https://azure.microsoft.com/free/) before you begin
40
-
-[Enable Defender for Cloud](get-started.md)
41
-
- Have [enhanced security features](enhanced-security-features-overview.md) enabled on your Azure subscriptions
42
-
-[Connect your Azure DevOps repositories to Microsoft Defender for Cloud](quickstart-onboard-devops.md)
43
-
-[Configure the Microsoft Security DevOps Azure DevOps extension](azure-devops-extension.md)
44
-
-[Setup secret scanning in Azure DevOps](detect-credential-leaks.md#setup-secret-scanning-in-azure-devops)
37
+
- An Azure account. If you don't already have an Azure account, you can [create your Azure free account today](https://azure.microsoft.com/free/).
38
+
-[Connect your Azure DevOps repositories to Microsoft Defender for Cloud](quickstart-onboard-devops.md).
39
+
-[Configure the Microsoft Security DevOps Azure DevOps extension](azure-devops-extension.md).
40
+
-[Setup secret scanning in Azure DevOps](detect-credential-leaks.md#setup-secret-scanning-in-azure-devops).
45
41
46
42
## Enable pull request annotations in GitHub
47
43
48
-
By enabling pull request annotations in GitHub, your developers gain the ability to see their security issues when they submit their pull requests directly to the main branch.
44
+
By enabling pull request annotations in GitHub, your developers gain the ability to see their security issues when they create a PR directly to the main branch.
49
45
50
46
**To enable pull request annotations in GitHub**:
51
47
52
-
1.Sign in to [GitHub](https://github.com/).
48
+
1.Navigate to [GitHub](https://github.com/) and sign in.
53
49
54
-
1. Select the relevant repository.
50
+
1. Select a repository that you've onboarded to Defender for Cloud.
55
51
56
-
1.Select**.github/workflows**.
52
+
1.Navigate to **`Your repository's home page`** >**.github/workflows**.
57
53
58
-
:::image type="content" source="media/tutorial-enable-pr-annotations/workflow-folder.png" alt-text="Screenshot that shows where to navigate to, to select the GitHub workflow folder.":::
54
+
:::image type="content" source="media/tutorial-enable-pr-annotations/workflow-folder.png" alt-text="Screenshot that shows where to navigate to, to select the GitHub workflow folder." lightbox="media/tutorial-enable-pr-annotations/workflow-folder.png":::
59
55
60
-
1. Select **msdevopssec.yml**.
56
+
1. Select **msdevopssec.yml**, which was created in the [prerequisites](#prerequisites).
61
57
62
-
:::image type="content" source="media/tutorial-enable-pr-annotations/devopssec.png" alt-text="Screenshot that shows you where on the screen to select the msdevopssec.yml file.":::
58
+
:::image type="content" source="media/tutorial-enable-pr-annotations/devopssec.png" alt-text="Screenshot that shows you where on the screen to select the msdevopssec.yml file." lightbox="media/tutorial-enable-pr-annotations/devopssec.png":::
63
59
64
60
1. Select **edit**.
65
61
66
-
:::image type="content" source="media/tutorial-enable-pr-annotations/edit-button.png" alt-text="Screenshot that shows you what the edit button looks like.":::
62
+
:::image type="content" source="media/tutorial-enable-pr-annotations/edit-button.png" alt-text="Screenshot that shows you what the edit button looks like." lightbox="media/tutorial-enable-pr-annotations/edit-button.png":::
67
63
68
64
1. Locate and update the trigger section to include:
69
65
70
66
```yml
71
67
# Triggers the workflow on push or pull request events but only for the main branch
72
-
push:
73
-
branches: [ main ]
74
68
pull_request:
75
-
branches: [main]
69
+
branches: ["main"]
76
70
```
77
-
78
-
By adding these lines to your yaml file, you'll configure the action to run when either a push or pull request event occurs on the designated repository.
79
71
80
72
You can also view a [sample repository](https://github.com/microsoft/security-devops-action/tree/main/samples).
81
73
@@ -85,19 +77,15 @@ By enabling pull request annotations in GitHub, your developers gain the ability
85
77
86
78
1. Select **Commit changes**.
87
79
88
-
1. Select **Files changed**.
80
+
Any issues that are discovered by the scanner will be viewable in the Files changed section of your pull request.
89
81
90
-
You'll now be able to see all the issues that were discovered by the scanner.
82
+
### Resolve security issues in GitHub
91
83
92
-
### Mitigate GitHub issues found by the scanner
93
-
94
-
Once you've configured the scanner, you'll be able to view all issues that were detected.
95
-
96
-
**To mitigate GitHub issues found by the scanner**:
84
+
**To resolve security issues in GitHub**:
97
85
98
86
1. Navigate through the page and locate an affected file with an annotation.
99
87
100
-
1. Select **Dismiss alert**.
88
+
1. Follow the remediation steps in the annotation. If you choose not remediate the annotation, select **Dismiss alert**.
101
89
102
90
1. Select a reason to dismiss:
103
91
@@ -107,7 +95,7 @@ Once you've configured the scanner, you'll be able to view all issues that were
107
95
108
96
## Enable pull request annotations in Azure DevOps
109
97
110
-
By enabling pull request annotations in Azure DevOps, your developers gain the ability to see their security issues when they submit their pull requests directly to the main branch.
98
+
By enabling pull request annotations in Azure DevOps, your developers gain the ability to see their security issues when they create PRs directly to the main branch.
111
99
112
100
### Enable Build Validation policy for the CI Build
113
101
@@ -119,13 +107,27 @@ Before you can enable pull request annotations, your main branch must have enabl
119
107
120
108
1. Navigate to **Project settings** > **Repositories**.
121
109
110
+
:::image type="content" source="media/tutorial-enable-pr-annotations/project-settings.png" alt-text="Screenshot that shows you where to navigate to, to select repositories.":::
111
+
122
112
1. Select the repository to enable pull requests on.
123
113
124
114
1. Select **Policies**.
125
115
126
-
1. Navigate to **Branch Policies** > **Build Validation**.
116
+
1. Navigate to **Branch Policies** > **Main branch**.
117
+
118
+
:::image type="content" source="media/tutorial-enable-pr-annotations/branch-policies.png" alt-text="Screenshot that shows where to locate the branch policies." lightbox="media/tutorial-enable-pr-annotations/branch-policies.png":::
119
+
120
+
1. Locate the Build Validation section.
121
+
122
+
1. Ensure the CI Build is toggled to **On**.
123
+
124
+
:::image type="content" source="media/tutorial-enable-pr-annotations/build-validation.png" alt-text="Screenshot that shows where the CI Build toggle is located.":::
125
+
126
+
1. Select **Save**.
127
127
128
-
1. Toggle the CI Build to **On**.
128
+
:::image type="content" source="media/tutorial-enable-pr-annotations/validation-policy.png" alt-text="Screenshot that shows the build validation.":::
129
+
130
+
Once you have completed these steps you can select the build pipeline you created previously and customize it's settings to suit your needs.
129
131
130
132
### Enable pull request annotations
131
133
@@ -143,48 +145,59 @@ Before you can enable pull request annotations, your main branch must have enabl
143
145
144
146
1. Toggle Pull request annotations to **On**.
145
147
146
-
1. Select a category from the drop-down menu.
148
+
:::image type="content" source="media/tutorial-enable-pr-annotations/annotation-on.png" alt-text="Screenshot that shows the toggle switched to on.":::
149
+
150
+
1. (Optional) Select a category from the drop-down menu.
147
151
148
152
> [!NOTE]
149
-
> Only secret scan results is currently supported.
153
+
> Only secret scan results are currently supported.
150
154
151
-
1. Select a severity level from the drop-down menu.
155
+
1. (Optional) Select a severity level from the drop-down menu.
156
+
157
+
> [!NOTE]
158
+
> Only high-level severity findings are currently supported.
152
159
153
160
1. Select **Save**.
154
161
155
-
All annotations will now be displayed based on your configurations with the relevant line of code.
162
+
All annotations on your main branch will be displayed from now on based on your configurations with the relevant line of code.
156
163
157
-
### Mitigate Azure DevOps issues found by the scanner
164
+
### Resolve security issues in Azure DevOps
158
165
159
166
Once you've configured the scanner, you'll be able to view all issues that were detected.
160
167
161
-
**To mitigate Azure DevOps issues found by the scanner**:
168
+
**To resolve security issues in Azure DevOps**:
162
169
163
-
1. Sign in to the [Azure portal](https://portal.azure.com).
170
+
1. Sign in to the [Azure DevOps](https://azure.microsoft.com/products/devops).
164
171
165
172
1. Navigate to **Pull requests**.
166
173
167
-
1. Scroll through the Overview page and locate an affected line with an annotation.
174
+
:::image type="content" source="media/tutorial-enable-pr-annotations/pull-requests.png" alt-text="Screenshot showing where to go to navigate to pull requests.":::
175
+
176
+
1. On the Overview, or files page, locate an affected line with an annotation.
168
177
169
-
1. Select **Active**.
178
+
1. Follow the remediation steps in the annotation.
170
179
171
-
1. Select action to take:
180
+
1. Select **Active** to change the status of the annotation and access the dropdown menu.
181
+
182
+
1. Select an action to take:
172
183
173
184
- **Active** - The default status for new annotations.
174
185
- **Pending** - The finding is being worked on.
175
186
- **Resolved** - The finding has been addressed.
176
187
- **Won't fix** - The finding is noted but won't be fixed.
177
188
- **Closed** - The discussion in this annotation is closed.
178
189
190
+
Defender for DevOps will re-activate an annotation if the security issue is not fixed in a new iteration.
191
+
179
192
## Learn more
180
193
181
194
In this tutorial, you learned how to enable pull request annotations in GitHub and Azure DevOps.
182
195
183
196
Learn more about [Defender for DevOps](defender-for-devops-introduction.md).
184
197
185
-
Learn how to [connect your GitHub](quickstart-onboard-github.md) to Defender for Cloud.
198
+
Learn how to [Discover misconfigurations in Infrastructure as Code](iac-vulnerabilities.md).
186
199
187
-
Learn how to [connect your Azure DevOps](quickstart-onboard-devops.md) to Defender for Cloud.
200
+
Learn how to [detect exposed secrets in code](detect-credential-leaks.md).
0 commit comments