|
| 1 | +--- |
| 2 | +title: Evaluate the impact of a new Azure policy |
| 3 | +description: Understand the process to follow when introducing a new policy into your Azure environment. |
| 4 | +author: DCtheGeek |
| 5 | +ms.author: dacoulte |
| 6 | +ms.date: 09/23/2019 |
| 7 | +ms.topic: conceptual |
| 8 | +ms.service: azure-policy |
| 9 | +manager: carmonm |
| 10 | +--- |
| 11 | +# Evaluate the impact of a new Azure policy |
| 12 | + |
| 13 | +Azure Policy is a powerful tool for managing your Azure resources to business standards and to meet |
| 14 | +compliance needs. When people, processes, or pipelines create or update resources, Azure Policy |
| 15 | +reviews the request. When the policy definition effect is [Append](./effects.md#deny) or [DeployIfNotExists](./effects.md#deployifnotexists), |
| 16 | +Policy alters the request or adds to it. When the policy definition effect is [Audit](./effects.md#audit) |
| 17 | +or [AuditIfNotExists](./effects.md#auditifnotexists), Policy causes an Activity log entry to be |
| 18 | +created. And when the policy definition effect is [Deny](./effects.md#deny), Policy stops the |
| 19 | +creation or alteration of the request. |
| 20 | + |
| 21 | +These outcomes are exactly as desired when you know the policy is defined correctly. However, it's |
| 22 | +important to validate a new policy works as intended before allowing it to change or block work. The |
| 23 | +validation must ensure only the intended resources are determined to be non-compliant and no |
| 24 | +compliant resources are incorrectly included (known as a _false positive_) in the results. |
| 25 | + |
| 26 | +The recommended approach to validating a new policy definition is by following these steps: |
| 27 | + |
| 28 | +- Tightly define your policy |
| 29 | +- Audit your existing resources |
| 30 | +- Audit new or updated resource requests |
| 31 | +- Deploy your policy to resources |
| 32 | +- Continuous monitoring |
| 33 | + |
| 34 | +## Tightly define your policy |
| 35 | + |
| 36 | +It's important to understand how the business policy is implemented as a policy definition and the |
| 37 | +relationship of Azure resources with other Azure services. This step is accomplished by |
| 38 | +[identifying the requirements](../tutorials/create-custom-policy-definition.md#identify-requirements) |
| 39 | +and |
| 40 | +[determining the resource properties](../tutorials/create-custom-policy-definition.md#determine-resource-properties). |
| 41 | +But it's also important to see beyond the narrow definition of your business policy. Does your |
| 42 | +policy state for example "All Virtual Machines must..."? What about other Azure services that make |
| 43 | +use of VMs, such as HDInsight or AKS? When defining a policy, we must consider how this policy |
| 44 | +impacts resources that are used by other services. |
| 45 | + |
| 46 | +For this reason, your policy definitions should be as tightly defined and focused on the resources |
| 47 | +and the properties you need to evaluate for compliance as possible. |
| 48 | + |
| 49 | +## Audit existing resources |
| 50 | + |
| 51 | +Before looking to manage new or updated resources with your new policy definition, it's best to see |
| 52 | +how it evaluates a limited subset of existing resources, such as a test resource group. Use the [enforcement mode](./assignment-structure.md#enforcement-mode) |
| 53 | +_Disabled_ (DoNotEnforce) on your policy assignment to prevent the [effect](./effects.md) from |
| 54 | +triggering or activity log entries from being created. |
| 55 | + |
| 56 | +This step gives you a chance to evaluate the compliance results of the new policy on existing |
| 57 | +resources without impacting work flow. Check that no compliant resources are marked as non-compliant |
| 58 | +(_false positive_) and that all the resources you expect to be non-compliant are marked correctly. |
| 59 | +After the initial subset of resources validates as expected, slowly expand the evaluation to all |
| 60 | +existing resources. |
| 61 | + |
| 62 | +Evaluating existing resources in this way also provides an opportunity to remediate non-compliant |
| 63 | +resources before full implementation of the new policy. This cleanup can be done manually or through |
| 64 | +a [remediation task](../how-to/remediate-resources.md) if the policy definition effect is |
| 65 | +_DeployIfNotExists_. |
| 66 | + |
| 67 | +## Audit new or updated resources |
| 68 | + |
| 69 | +Once you've validated your new policy definition is reporting correctly on existing resources, it's |
| 70 | +time to look at the impact of the policy when resources get created or updated. If the policy |
| 71 | +definition supports effect parameterization, use [Audit](./effects.md#audit). This configuration |
| 72 | +allows you to monitor the creation and updating of resources to see if the new policy definition |
| 73 | +triggers an entry in Azure Activity log for a resource that is non-compliant without impacting |
| 74 | +existing work or requests. |
| 75 | + |
| 76 | +It's recommended to both update and create new resources that match your policy definition to see |
| 77 | +that the _Audit_ effect is correctly being triggered when expected. Be on the lookout for resource |
| 78 | +requests that shouldn't be impacted by the new policy definition that trigger the _Audit_ effect. |
| 79 | +These impacted resources are another example of _false positives_ and must be fixed in the policy |
| 80 | +definition before full implementation. |
| 81 | + |
| 82 | +In the event the policy definition is changed at this stage of testing, it's recommended to begin |
| 83 | +the validation process over with the auditing of existing resources. A change to the policy |
| 84 | +definition for a _false positive_ on new or updated resources is likely to also have an impact on |
| 85 | +existing resources. |
| 86 | + |
| 87 | +## Deploy your policy to resources |
| 88 | + |
| 89 | +After completing validation of your new policy definition with both existing resources and new or |
| 90 | +updated resource requests, you begin the process of implementing the policy. It's recommended to |
| 91 | +create the policy assignment for the new policy definition to a subset of all resources first, such |
| 92 | +as a resource group. After validating initial deployment, extend the scope of the policy to broader |
| 93 | +and broader levels, such as subscriptions and management groups. This expansion is achieved by |
| 94 | +removing the assignment and creating a new one at the target scopes until it's assigned to the full |
| 95 | +scope of resources intended to be covered by your new policy definition. |
| 96 | + |
| 97 | +During rollout, if resources are located that should be exempt from your new policy definition, |
| 98 | +address them in one of the following ways: |
| 99 | + |
| 100 | +- Update the policy definition to be more explicit to reduce unintended impact |
| 101 | +- Change the scope of the policy assignment (by removing and creating a new assignment) |
| 102 | +- Add the group of resources to the exclusion list for the policy assignment |
| 103 | + |
| 104 | +Any changes to the scope (level or exclusions) should be fully validated and communicated with your |
| 105 | +security and compliance organizations to ensure there are no gaps in coverage. |
| 106 | + |
| 107 | +## Monitor your policy and compliance |
| 108 | + |
| 109 | +Implementing and assigning your policy definition isn't the final step. Continuously monitor the [compliance](../how-to/get-compliance-data.md) |
| 110 | +level of resources to your new policy definition and setup appropriate [Azure Monitor alerts and notifications](../../../azure-monitor/platform/alerts-overview.md) |
| 111 | +for when non-compliant devices are identified. It's also recommended to evaluate the policy |
| 112 | +definition and related assignments on a scheduled basis to validate the policy definition is meeting |
| 113 | +business policy and compliance needs. Policies should be removed if no longer needed. Policies also |
| 114 | +need updating from time to time as the underlying Azure resources evolve and add new properties and |
| 115 | +capabilities. |
| 116 | + |
| 117 | +## Next steps |
| 118 | + |
| 119 | +- Learn about the [policy definition structure](./definition-structure.md). |
| 120 | +- Learn about the [policy assignment structure](./assignment-structure.md). |
| 121 | +- Understand how to [programmatically create policies](../how-to/programmatically-create.md). |
| 122 | +- Learn how to [get compliance data](../how-to/getting-compliance-data.md). |
| 123 | +- Learn how to [remediate non-compliant resources](../how-to/remediate-resources.md). |
| 124 | +- Review what a management group is with [Organize your resources with Azure management groups](../../management-groups/overview.md). |
0 commit comments