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
+4-11Lines changed: 4 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: 'Quickstart: New policy assignment with Terraform'
3
-
description: In this quickstart, you use Terraform and Hashicorp Configuration Language (HCL) syntax to create a policy assignment to identify non-compliant resources.
3
+
description: In this quickstart, you use Terraform and Hashicorp Configuration Language (HCL) syntax to create a policy assignment to identify noncompliant resources.
4
4
ms.date: 03/26/2025
5
5
ms.topic: quickstart
6
6
ms.custom: devx-track-terraform
@@ -10,10 +10,10 @@ content_well_notification:
10
10
- AI-contribution
11
11
---
12
12
13
-
# Quickstart: Create a policy assignment to identify non-compliant resources using Terraform
13
+
# Quickstart: Create a policy assignment to identify noncompliant resources using Terraform
14
14
15
15
The first step in understanding compliance in Azure is to identify the status of your resources. This quickstart steps you through the process of creating a policy assignment to identify virtual
16
-
machines that aren't using managed disks. At the end of this process, you identify virtual machines that aren't using managed disks across subscription. They're _non-compliant_ with the policy assignment.
> If you are using the 4.x azurerm provider, you must [explicitly specify the Azure subscription ID](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/4.0-upgrade-guide#specifying-subscription-id-is-now-mandatory) to authenticate to Azure before running the Terraform commands.
55
-
>
56
-
> One way to specify the Azure subscription ID without putting it in the `providers` block is to specify the subscription ID in an environment variable named `ARM_SUBSCRIPTION_ID`.
57
-
>
58
-
> For more information, see the [Azure provider reference documentation](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs#argument-reference).
59
-
60
53
## Specify scope
61
54
62
55
A scope determines what resources or grouping of resources the policy assignment gets enforced on. It could range from a management group to an individual resource. To use any of the following scopes, update the `scope` variable in the `variables.tf` file. If you leave the `scope` variable value blank, the "subscription" scope is used.
@@ -94,7 +87,7 @@ A scope determines what resources or grouping of resources the policy assignment
94
87
armclient post "/subscriptions/<subscription_id>/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>
95
88
```
96
89
97
-
1. The results are comparable to what you see listed under **Non-compliant resources** in the Azure portal view.
90
+
1. The results are comparable to what you see listed under **Noncompliant resources** in the Azure portal view.
#customer intent: As a Terraform user, I want to see how to create a storage task using Terraform.
12
12
content_well_notification:
13
13
- AI-contribution
@@ -17,7 +17,7 @@ content_well_notification:
17
17
18
18
A storage task can perform operations on blobs in an Azure Storage account. As you create a task, you can define the conditions that must be met by each object (container or blob), and the operations to perform on the object. You can also identify one or more Azure Storage account targets. See [What are Azure Storage Actions?](../overview.md).
19
19
20
-
In this how-to article, you'll learn how to create a storage task using Terraform.
20
+
In this how-to article, you learn how to create a storage task using Terraform.
21
21
22
22
> [!IMPORTANT]
23
23
> Azure Storage Actions is currently in PREVIEW and is available in these [regions](../overview.md#supported-regions).
@@ -61,15 +61,15 @@ The sample code for this article is located in the [Azure Terraform GitHub repo]
61
61
1. Create a file named `outputs.tf` and insert the following code.
> If you are using the 4.x azurerm provider, you must [explicitly specify the Azure subscription ID](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/4.0-upgrade-guide#specifying-subscription-id-is-now-mandatory) to authenticate to Azure before running the Terraform commands.
66
68
>
67
69
> One way to specify the Azure subscription ID without putting it in the `providers` block is to specify the subscription ID in an environment variable named `ARM_SUBSCRIPTION_ID`.
68
70
>
69
71
> For more information, see the [Azure provider reference documentation](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs#argument-reference).
0 commit comments