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/governance/policy/assign-policy-terraform.md
+9-5Lines changed: 9 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ This quickstart steps you through the process of creating a policy assignment to
12
12
machines that aren't using managed disks.
13
13
14
14
At the end of this process, you'll successfully identify virtual machines that aren't using managed
15
-
disks. They're _non-compliant_ with the policy assignment.
15
+
disks across subscription. They're _non-compliant_ with the policy assignment.
16
16
17
17
## Prerequisites
18
18
@@ -38,6 +38,10 @@ for Azure Policy use the
38
38
1. Create a new folder named `policy-assignment` and change directories into it.
39
39
40
40
1. Create `main.tf` with the following code:
41
+
42
+
> [!NOTE]
43
+
> To create a Policy Assignment at a Management Group use the [azurerm_management_group_policy_assignment](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/management_group_policy_assignment) resource, for a Resource Group use the [azurerm_resource_group_policy_assignment](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group_policy_assignment) and for a Subscription use the [azurerm_subscription_policy_assignment](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/subscription_policy_assignment) resource.
@@ -144,7 +148,7 @@ returned by `terraform apply`. With it, run the following command to get the res
144
148
non-compliant resources that are output into a JSON file:
145
149
146
150
```console
147
-
armclient post "/subscriptions/<subscriptionID>/resourceGroups/<rgName>/providers/Microsoft.PolicyInsights/policyStates/latest/queryResults?api-version=2019-10-01&$filter=IsCompliant eq false and PolicyAssignmentId eq '<policyAssignmentID>'&$apply=groupby((ResourceId))" > <json file to direct the output with the resource IDs into>
151
+
armclient post "/subscriptions/<subscriptionID>/providers/Microsoft.PolicyInsights/policyStates/latest/queryResults?api-version=2019-10-01&$filter=IsCompliant eq false and PolicyAssignmentId eq '<policyAssignmentID>'&$apply=groupby((ResourceId))" > <json file to direct the output with the resource IDs into>
0 commit comments