Skip to content

Commit c6b1416

Browse files
Merge pull request #121137 from DCtheGeek/dmc-policy-vscodeupdate
Policy: Update to Policy extension for VSCode
2 parents 8d9bf5a + 1c5fcfe commit c6b1416

File tree

2 files changed

+71
-6
lines changed

2 files changed

+71
-6
lines changed

articles/governance/policy/how-to/extension-for-vscode.md

Lines changed: 63 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
---
22
title: Azure Policy extension for Visual Studio Code
33
description: Learn how to use the Azure Policy extension for Visual Studio Code to look up Azure Resource Manager aliases.
4-
ms.date: 10/14/2020
4+
ms.date: 10/20/2020
55
ms.topic: how-to
66
---
77
# Use Azure Policy extension for Visual Studio Code
88

9-
> Applies to Azure Policy extension version **0.0.21** and newer
9+
> Applies to Azure Policy extension version **0.1.0** and newer
1010
1111
Learn how to use the Azure Policy extension for Visual Studio Code to look up
12-
[aliases](../concepts/definition-structure.md#aliases) and review resources and policies. First,
13-
we'll describe how to install the Azure Policy extension in Visual Studio Code. Then we'll walk
14-
through how to look up aliases.
12+
[aliases](../concepts/definition-structure.md#aliases), review resources and policies, export
13+
objects, and evaluate policy definitions. First, we'll describe how to install the Azure Policy
14+
extension in Visual Studio Code. Then we'll walk through how to look up aliases.
1515

1616
Azure Policy extension for Visual Studio Code can be installed on all platforms that are supported
1717
by Visual Studio Code. This support includes Windows, Linux, and macOS.
@@ -192,6 +192,64 @@ the treeview, the Azure Policy extension opens the JSON that represents the poli
192192
all its Resource Manager property values. The extension can validate the opened Azure Policy JSON
193193
schema.
194194

195+
## Export objects
196+
197+
Objects from your subscriptions can be exported to a local JSON file. In either the **Resources** or
198+
**Policies** pane, hover over or select an exportable object. At the end of the highlighted row,
199+
select the save icon and select a folder to save that resources JSON.
200+
201+
The following objects can be exported locally:
202+
203+
- Resources pane
204+
- Resource groups
205+
- Individual resources (either in a resource group or under a Resource Provider)
206+
- Policies pane
207+
- Policy assignments
208+
- Built-in policy definitions
209+
- Custom policy definitions
210+
- Initiatives
211+
212+
## On-demand evaluation scan
213+
214+
An evaluation scan can be started with the Azure Policy extension for Visual Studio Code. To start
215+
an evaluation, select and pin each of the following objects: a resource, a policy definition, and a
216+
policy assignment.
217+
218+
1. To pin each object, find it in either the **Resources** pane or the **Policies** pane and select
219+
the pin to an edit tab icon. Pinning an object adds it to the **Evaluation** pane of the
220+
extension.
221+
1. In the **Evaluation** pane, select one of each object and use the select for evaluation icon to
222+
mark it as included in the evaluation.
223+
1. At the top of the **Evaluation** pane, select the run evaluation icon. A new pane in Visual
224+
Studio Code opens with the resulting evaluation details in JSON form.
225+
226+
> [!NOTE]
227+
> If the selected policy definition is either an
228+
> [AuditIfNotExists](../concepts/effects.md#auditifnotexists) or
229+
> [DeployIfNotExists](../concepts/effects.md#deployifnotexists), in the **Evaluation** pane use the
230+
> plus icon to selected a _related_ resource for the existence check.
231+
232+
The evaluation results provide information about the policy definition and policy assignment along
233+
with the **policyEvaluations.evaluationResult** property. The output looks similar to the following
234+
example:
235+
236+
```json
237+
{
238+
"policyEvaluations": [
239+
{
240+
"policyInfo": {
241+
...
242+
},
243+
"evaluationResult": "Compliant",
244+
"effectDetails": {
245+
"policyEffect": "Audit",
246+
"existenceScope": "None"
247+
}
248+
}
249+
]
250+
}
251+
```
252+
195253
## Sign out
196254

197255
From the menu bar, go to **View** > **Command Palette**, and then enter **Azure: Sign Out**.

articles/governance/policy/how-to/get-compliance-data.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ resource group:
125125
az policy state trigger-scan --resource-group "MyRG"
126126
```
127127

128-
You can chose not to wait for the asynchronous process to complete before continuing with the
128+
You can choose not to wait for the asynchronous process to complete before continuing with the
129129
**no-wait** parameter.
130130

131131
#### On-demand evaluation scan - Azure PowerShell
@@ -215,6 +215,13 @@ with the status:
215215
}
216216
```
217217

218+
#### On-demand evaluation scan - Visual Studio Code
219+
220+
The Azure Policy extension for Visual Studio code is capable of running an evaluation scan for a
221+
specific resource. This scan is a synchronous process, unlike the Azure PowerShell and REST methods.
222+
For details and steps, see
223+
[On-demand evaluation with the VS Code extension](./extension-for-vscode.md#on-demand-evaluation-scan).
224+
218225
## How compliance works
219226

220227
In an assignment, a resource is **Non-compliant** if it doesn't follow policy or initiative rules

0 commit comments

Comments
 (0)