Skip to content

Commit e640650

Browse files
authored
Merge pull request #212040 from timwarner-msft/timwarner-addmanualpolicy
Add manual policy to effects and assignment structure articles
2 parents b75b724 + 4f7cb5a commit e640650

File tree

3 files changed

+133
-14
lines changed

3 files changed

+133
-14
lines changed

articles/governance/policy/concepts/assignment-structure.md

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Details of the policy assignment structure
33
description: Describes the policy assignment definition used by Azure Policy to relate policy definitions and parameters to resources for evaluation.
4-
ms.date: 05/12/2022
4+
ms.date: 09/21/2022
55
ms.topic: conceptual
66
ms.author: timwarner
77
author: timwarner-msft
@@ -87,7 +87,7 @@ _common_ properties used by Azure Policy. Each `metadata` property has a limit o
8787
value. However, the scope isn't locked to the value and it can be changed to another scope.
8888

8989
The following example of `parameterScopes` is for a _strongType_ parameter named
90-
**backupPolicyId** that sets a scope for resource selection when the assignment is edited in the
90+
`backupPolicyId` that sets a scope for resource selection when the assignment is edited in the
9191
Portal.
9292

9393
```json
@@ -102,12 +102,33 @@ _common_ properties used by Azure Policy. Each `metadata` property has a limit o
102102
any.
103103
- `updatedOn` (string): The Universal ISO 8601 DateTime format of the assignment update time, if
104104
any.
105+
- `evidenceStorages` (object): An array of storage containers that holds attestation evidence for policy assignments with a `manual` effect. The `displayName` property is the name of the storage account. The `evidenceStorageAccountID` property is the resource ID of the storage account. The `evidenceBlobContainer` property is the blob container name in which you plan to store the evidence.
105106

106-
## Enforcement Mode
107+
```json
108+
{
109+
"properties": {
110+
"displayName": "A contingency plan should be in place to ensure operational continuity for each Azure subscription."
111+
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/{definitionId}",
112+
"metadata": {
113+
"evidenceStorages": [
114+
{
115+
"displayName": "Default evidence storage",
116+
"evidenceStorageAccountId": "/subscriptions/{subscriptionId}/resourceGroups/{rg-name}/providers/Microsoft.Storage/storageAccounts/{storage-account-name}",
117+
"evidenceBlobContainer": "evidence-container"
118+
}
119+
]
120+
}
121+
}
122+
}
123+
```
124+
125+
## Enforcement mode
107126

108127
The **enforcementMode** property provides customers the ability to test the outcome of a policy on
109128
existing resources without initiating the policy effect or triggering entries in the
110-
[Azure Activity log](../../../azure-monitor/essentials/platform-logs-overview.md). This scenario is
129+
[Azure Activity log](../../../azure-monitor/essentials/platform-logs-overview.md).
130+
131+
This scenario is
111132
commonly referred to as "What If" and aligns to safe deployment practices. **enforcementMode** is
112133
different from the [Disabled](./effects.md#disabled) effect, as that effect prevents resource
113134
evaluation from happening at all.
@@ -204,7 +225,8 @@ same policy definition is reusable with a different set of parameters for a diff
204225
reducing the duplication and complexity of policy definitions while providing flexibility.
205226

206227
## Identity
207-
For policy assignments with effect set to **deployIfNotExisit** or **modify**, it is required to have an identity property to do remediation on non-compliant resources. When using identity, the user must also specify a location for the assignment.
228+
229+
For policy assignments with effect set to **deployIfNotExist** or **modify**, it is required to have an identity property to do remediation on non-compliant resources. When using identity, the user must also specify a location for the assignment.
208230

209231
> [!NOTE]
210232
> A single policy assignment can be associated with only one system- or user-assigned managed identity. However, that identity can be assigned more than one role if necessary.
@@ -231,4 +253,3 @@ For policy assignments with effect set to **deployIfNotExisit** or **modify**, i
231253
- Learn how to [remediate non-compliant resources](../how-to/remediate-resources.md).
232254
- Review what a management group is with
233255
[Organize your resources with Azure management groups](../../management-groups/overview.md).
234-

articles/governance/policy/concepts/effects.md

Lines changed: 106 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
---
22
title: Understand how effects work
33
description: Azure Policy definitions have various effects that determine how compliance is managed and reported.
4-
ms.date: 09/01/2021
4+
author: timwarner-msft
5+
ms.date: 09/21/2022
56
ms.topic: conceptual
7+
ms.author: timwarner
68
---
79
# Understand Azure Policy effects
810

@@ -18,6 +20,7 @@ These effects are currently supported in a policy definition:
1820
- [Deny](#deny)
1921
- [DeployIfNotExists](#deployifnotexists)
2022
- [Disabled](#disabled)
23+
- [Manual (preview)](#manual-preview)
2124
- [Modify](#modify)
2225

2326
The following effects are _deprecated_:
@@ -154,7 +157,7 @@ definitions as `constraintTemplate` is deprecated.
154157
location must be publicly accessible.
155158

156159
> [!WARNING]
157-
> Don't use SAS URIs or tokens in `url` or anything else that could expose a secret.
160+
> Don't use SAS URIs, URL tokens, or or anything else that could expose secrets in plain text.
158161
159162
- If _Base64Encoded_, paired with property `content` to provide the base 64 encoded constraint
160163
template. See
@@ -193,7 +196,7 @@ definitions as `constraintTemplate` is deprecated.
193196
- An _array_ that includes the
194197
[kind](https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/#required-fields)
195198
of Kubernetes object to limit evaluation to.
196-
- Defining `["*"]` for _kinds_ is disallowed.
199+
- Defining `["*"]` for _kinds_ is disallowed.
197200
- **values** (optional)
198201
- Defines any parameters and values to pass to the Constraint. Each value must exist in the
199202
Constraint template CRD.
@@ -275,7 +278,7 @@ related resources to match.
275278
- Doesn't apply if **type** is a resource that would be underneath the **if** condition resource.
276279
- For _ResourceGroup_, would limit to the **if** condition resource's resource group or the
277280
resource group specified in **ResourceGroupName**.
278-
- For _Subscription_, queries the entire subscription for the related resource. Assignment scope should be set at subscription or higher for proper evaluation.
281+
- For _Subscription_, queries the entire subscription for the related resource. Assignment scope should be set at subscription or higher for proper evaluation.
279282
- Default is _ResourceGroup_.
280283
- **EvaluationDelay** (optional)
281284
- Specifies when the existence of the related resources should be evaluated. The delay is only
@@ -451,7 +454,7 @@ location of the Constraint template to use in Kubernetes to limit the allowed co
451454
## DeployIfNotExists
452455

453456
Similar to AuditIfNotExists, a DeployIfNotExists policy definition executes a template deployment
454-
when the condition is met. Policy assignments with effect set as DeployIfNotExists require a [managed identity](../how-to/remediate-resources.md) to do remediation.
457+
when the condition is met. Policy assignments with effect set as DeployIfNotExists require a [managed identity](../how-to/remediate-resources.md) to do remediation.
455458

456459
> [!NOTE]
457460
> [Nested templates](../../../azure-resource-manager/templates/linked-templates.md#nested-template)
@@ -497,7 +500,7 @@ related resources to match and the template deployment to execute.
497500
- Doesn't apply if **type** is a resource that would be underneath the **if** condition resource.
498501
- For _ResourceGroup_, would limit to the **if** condition resource's resource group or the
499502
resource group specified in **ResourceGroupName**.
500-
- For _Subscription_, queries the entire subscription for the related resource. Assignment scope should be set at subscription or higher for proper evaluation.
503+
- For _Subscription_, queries the entire subscription for the related resource. Assignment scope should be set at subscription or higher for proper evaluation.
501504
- Default is _ResourceGroup_.
502505
- **EvaluationDelay** (optional)
503506
- Specifies when the existence of the related resources should be evaluated. The delay is only
@@ -742,13 +745,108 @@ Example: Gatekeeper v2 admission control rule to allow only the specified contai
742745
}
743746
```
744747

748+
## Manual (preview)
749+
750+
The new `manual` (preview) effect enables you to define and track your own custom attestation
751+
resources. Unlike other Policy definitions that actively scan for evaluation, the Manual effect
752+
allows for manual changes to the compliance state. To change the compliance for a manual policy,
753+
you'll need to create an attestation for that compliance state.
754+
755+
> [!NOTE]
756+
> During Public Preview, support for manual policy is available through various Microsoft Defender
757+
> for Cloud regulatory compliance initiatives. If you are a Microsoft Defender for Cloud [Premium tier](https://azure.microsoft.com/pricing/details/defender-for-cloud/) customer, refer to their experience overview.
758+
759+
The following example targets Azure subscriptions and sets the initial compliance state to `Unknown`.
760+
761+
```json
762+
{
763+
"if": {
764+
"field": "type",
765+
"equals": "Microsoft.Resources/subscriptions"
766+
},
767+
"then": {
768+
"effect": "manual",
769+
"details": {
770+
"defaultState": "Unknown"
771+
}
772+
}
773+
}
774+
```
775+
776+
The `defaultState` property has three possible values:
777+
778+
- **Unknown**: The initial, default state of the targeted resources.
779+
- **Compliant**: Resource is compliant according to your manual policy standards
780+
- **Non-compliant**: Resource is non-compliant according to your manual policy standards
781+
782+
The Azure Policy compliance engine evaluates all applicable resources to the default state specified
783+
in the definition (`Unknown` if not specified). An `Unknown` compliance state indicates that you
784+
must manually attest the resource compliance state. If the effect state is unspecified, it defaults
785+
to `Unknown`. The `Unknown` compliance state indicates that you must attest the compliance state yourself.
786+
787+
The following screenshot shows how a manual policy assignment with the `Unknown`
788+
state appears in the Azure portal:
789+
790+
![Resource compliance table in the Azure portal showing an assigned manual policy with a compliance reason of 'unknown.'](./manual-policy-portal.png)
791+
792+
When a policy definition with `manual` effect is assigned, you have the option to include **evidence**, which refers to optional supplemental information which supports the custom compliance attestation. Evidence itself is stored in Azure Storage, and you can specify the storage blob container in the [policy assignment's metadata](../concepts/assignment-structure.md#metadata) under the property `evidenceStorages`. Further details of the evidence file are described in the attestation JSON resource.
793+
794+
### Attestations
795+
796+
`Microsoft.PolicyInsights/attestations`, called an Attestation resource, is a new proxy resource type
797+
that sets the compliance states for targeted resources in a manual policy. You can only have one
798+
attestation on one resource for an individual policy. In preview, Attestations are available
799+
only through the Azure Resource Manager (ARM) API.
800+
801+
Below is an example of creating a new attestation resource:
802+
803+
```http
804+
PUT http://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/attestations/{name}?api-version=2019-10-01
805+
```
806+
807+
#### Request body
808+
809+
Below is a sample attestation resource JSON object:
810+
811+
```json
812+
"properties": {
813+
"policyAssignmentId": "/subscriptions/{subscriptionID}/providers/microsoft.authorization/policyassignments/{assignmentID}",
814+
"policyDefinitionReferenceId": "{definitionReferenceID}",
815+
"complianceState": "Compliant",
816+
"expiresOn": "2023-07-14T00:00:00Z",
817+
"owner": "{AADObjectID}",
818+
"comments": "This subscription has passed a security audit. See attached details for evidence",
819+
"evidence": [
820+
{
821+
"description": "The results of the security audit.",
822+
"sourceUri": "https://gist.github.com/contoso/9573e238762c60166c090ae16b814011"
823+
},
824+
{
825+
"description": "Description of the attached evidence document.",
826+
"sourceUri": "https://storagesamples.blob.core.windows.net/sample-container/contingency_evidence_adendum.docx"
827+
},
828+
],
829+
}
830+
```
831+
832+
|Property |Description |
833+
|---------|---------|
834+
|policyAssignmentId |Required assignment ID for which the state is being set. |
835+
|policyDefinitionReferenceId |Optional definition reference ID, if within a policy initiative. |
836+
|complianceState |Desired state of the resources. Allowed values are `Compliant`, `NonCompliant`, and `Unknown`. |
837+
|owner |Optional Azure AD object ID of responsible party. |
838+
|comments |Optional description of why state is being set. |
839+
|evidence |Optional link array for attestation evidence. |
840+
841+
Because attestations are a separate resource from policy assignments, they have their own lifecycle. You can PUT, GET and DELETE attestations by using the ARM API. See the [Policy REST API Reference](/rest/api/policy) for more details.
842+
745843
## Modify
746844

747845
Modify is used to add, update, or remove properties or tags on a subscription or resource during
748846
creation or update. A common example is updating tags on resources such as costCenter. Existing
749847
non-compliant resources can be remediated with a
750848
[remediation task](../how-to/remediate-resources.md). A single Modify rule can have any number of
751-
operations. Policy assignments with effect set as Modify require a [managed identity](../how-to/remediate-resources.md) to do remediation.
849+
operations. Policy assignments with effect set as Modify require a [managed identity](../how-to/remediate-resources.md) to do remediation.
752850

753851
The following operations are supported by Modify:
754852

@@ -772,7 +870,7 @@ The following operations are supported by Modify:
772870
Modify evaluates before the request gets processed by a Resource Provider during the creation or
773871
updating of a resource. The Modify operations are applied to the request content when the **if**
774872
condition of the policy rule is met. Each Modify operation can specify a condition that determines
775-
when it's applied. Operations with conditions that are evaluated to _false_ are skipped.
873+
when it's applied. Operations with _false_ condition evaluations are skipped.
776874

777875
When an alias is specified, the following additional checks are performed to ensure that the Modify
778876
operation doesn't change the request content in a way that causes the resource provider to reject
110 KB
Loading

0 commit comments

Comments
 (0)