Microsoft Entra ID Governance
Governance

Tutorial: Observe and enforce a built-in Microsoft Entra resource policy (preview)

In brief

The tutorial shows how to observe real requests, review evaluation audit events, enable enforcement, verify recovery, and remove a built-in resource policy assignment. It also documents prerequisites, roles, Graph permissions, and cleanup steps.

What Entra admins need to know

Administrators can use the tutorial to safely test policy behavior and understand the permissions and tenant setup required before a production rollout.

This editorial summary was generated by AI from the documentation changes. Verify important details in the full Microsoft Learn article.

Documentation change

The comparison below shows only the changed extract. Use the full-page view for complete context.

new file mode 100644

title: "Tutorial: Observe and enforce a built-in Microsoft Entra resource policy (preview)" description: Continue from the resource policy quickstart to observe real requests, inspect audit events, enforce a policy, verify recovery, and clean up. ms.topic: tutorial ms.date: 11/12/2026 ms.custom: msecd-doc-authoring-1030 ai-usage: ai-generated # Customer intent: As a tenant administrator, I want to observe, enforce, and recover a built-in policy so that I can understand its complete lifecycle before planning a production rollout.

Tutorial: Observe and enforce a built-in Microsoft Entra resource policy (preview)

Continue from Quickstart: Assign and test a built-in resource policy to see how the same assignment affects real Microsoft Graph requests. Use the Microsoft Entra admin center to manage the assignment and Microsoft Graph Explorer to create test applications and investigate evaluation audit events.

In this tutorial, you:

  • Compare compliant and noncompliant requests in report-only mode.
  • Inspect the corresponding evaluation audit events.
  • Enable enforcement and verify allowed and blocked requests.
  • Return to report-only mode and verify recovery.
  • Remove the assignment and test applications.

Unlike the quickstart's simulated evaluations, these tests create real application registrations when requests are allowed. Enforcement affects matching requests throughout the test tenant. Allow time between stages for assignment propagation and audit-event availability.

Prerequisites

  • Complete the built-in policy quickstart. Retain its assignment, version, and parameter values. If you already deleted the assignment, follow the recovery instructions in Confirm the starting assignment.
  • Keep the quickstart's Microsoft Entra ID Governance service plan to update or restore the assignment. See licensing requirements.
  • Use the same work or school account and test tenant in the Microsoft Entra admin center and Microsoft Graph Explorer throughout the tutorial, including cleanup.

Microsoft Entra roles for your account

RolePurpose in this tutorial
Resource Policy AdministratorUpdate, restore, and delete the assignment, and repeat simulated validation if needed.
Application DeveloperCreate the test app registrations and manage the apps you own, including deleting them during cleanup.
Reports ReaderRead the evaluation audit-log events.

Application Developer lets you create test apps even when Users can register applications is No. You don't need it if default user permissions already let you create and manage your own apps.

If a required role is eligible through Privileged Identity Management (PIM), activate it before starting.

Delegated permissions for Microsoft Graph Explorer

Before starting, have an administrator grant consent in the test tenant for the following delegated Microsoft Graph permissions for Microsoft Graph Explorer:

PermissionPurpose in this tutorial
AuditLog.Read.AllQuery evaluation audit events through /auditLogs/resourcePolicy.
Application.ReadWrite.AllCreate the test app registrations through /applications.
ResourcePolicyEvaluation.Read.AllRetain the quickstart's grant to repeat simulated validation if you restore or change the assignment.

Grant these permissions to Graph Explorer, not the test apps. Assignment changes and app cleanup use the Microsoft Entra admin center with your account's roles and app ownership.

1. Confirm the starting assignment

  1. Sign in to the Microsoft Entra admin center with the same account and tenant used in the quickstart.

  2. Browse to Tenant governance > Assignments and open enforce_application_name_prefix.

  3. Confirm the saved assignment settings:

    SettingExpected value
    Policy definitionRequire a department prefix for application names
    Policy version1.0.0
    StatusOn
    EnforcementReport-only
    allowed_departmentsEngineering-, Marketing-, IT-, HR-, Finance-, Sales-
    banned_word_listEmpty
    client_appid_exclusion_listEmpty
  4. Sign in to Graph Explorer with the same account and tenant. Confirm it has the delegated permissions listed in Prerequisites.

If the assignment isn't ready, use the matching recovery path:

Assignment stateAction
DeletedFind it under Tenant governance > Deleted items > Assignments. Verify its identity and saved On / Report-only settings before restoring it.
Settings differ from the table aboveEdit the assignment to restore those values.
Neither live nor restorableRepeat the quickstart. Don't create a second live assignment for the same policy version.

After restoring or correcting the assignment, repeat the quickstart's simulated validation before continuing.

2. Review real request impact

Wait for assignment changes to propagate, then test both names. This report-only assignment allows both requests, but other policies or service controls can still block them.

  1. In Graph Explorer, select POST and beta, and enter this request URL:

    https://graph.microsoft.com/beta/applications
    
  2. In Request Body, enter the noncompliant application name:

    {
      "displayName": "Inventory-Taker"
    }
    
  3. Select Run query and confirm 201 Created. Record the UTC time, response request-id, any returned client-request-id, and returned application's object id for cleanup.

  4. Repeat with displayName set to Sales-Inventory-Taker. Confirm 201 Created and record the time, request identifiers, and object id separately.

  5. Select GET and enter the following URL. Replace the placeholder with one recorded request ID and the timestamps with a UTC window that includes the request. The start and end times are inclusive:

    https://graph.microsoft.com/beta/auditLogs/resourcePolicy?$filter=requestId eq '{request-id-or-client-request-id}' and evaluatedDateTime ge 2026-11-06T09:00:00Z and evaluatedDateTime le 2026-11-06T18:00:00Z&$select=id,requestId,policyDecision,policyDetails
    
  6. Select Run query.

  7. Find enforce_application_name_prefix in policyDetails and confirm policyVersion is 1.0.0. If no event matches the response request-id, try the returned client-request-id. Allow for logging delay; no event isn't proof of compliance.

  8. Repeat the query for the other recorded request and compare the results below.

Application nameExpected assignment detail in report-only mode
Inventory-TakerisApplicable: true, isCompliant: false, isEnforced: false, and a naming explanation in policyMessage.
Sales-Inventory-TakerisApplicable: true, isCompliant: true, and isEnforced: false.

Check that policyLoadingError, applicabilityEvaluationError, and evaluationError are null or absent. Treat errors separately from a successfully evaluated violation.

These two requests don't measure the policy's impact on all production traffic. For a production rollout, assess representative traffic and follow safe deployment practices. The preview doesn't provide aggregated impact reports.

3. Enforce the policy

  1. Browse to Tenant governance > Assignments and open enforce_application_name_prefix.
  2. On Assignment details, select Edit.
  3. On Settings, keep Status set to On and change Enforcement from Report-only to Enforce.
  4. On Parameters, keep Engineering-, Marketing-, IT-, HR-, Finance-, and Sales- in allowed_departments. Leave banned_word_list and client_appid_exclusion_list empty.
  5. On Review, review the summary and select Save.
  6. Reopen Assignment details and confirm Status is On and Enforcement is Enforce.

Wait for assignment changes to propagate, then use Graph Explorer to test enforcement. The noncompliant name should be blocked; the compliant name should create an application.

Test a noncompliant request

Try to create an application with a name that doesn't start with an allowed prefix.

  1. In Graph Explorer, select POST and beta, and enter this request URL:

    https://graph.microsoft.com/beta/applications
    
  2. In Request Body, enter:

    {
      "displayName": "Inventory-Taker"
    }
    
  3. Select Run query.

  4. In Response preview, confirm 403 Forbidden with error.code set to DeniedByResourcePolicy. The error message identifies assignment enforce_application_name_prefix and explains that the application name needs an allowed department prefix.

Inspect the response body rather than relying on Graph Explorer's generic permissions message for a 403 response. The DeniedByResourcePolicy code, assignment identifier, and naming reason identify the policy denial in this example.

Test a compliant request

Use the same application-creation URL with a name that starts with an allowed prefix.

  1. Keep POST, beta, and the same request URL.

  2. In Request Body, enter:

    {
      "displayName": "Sales-Inventory-Taker"
    }
    
  3. Select Run query.

  4. In Response preview, confirm 201 Created and copy the returned application's id for cleanup. Use the object id, not the appId.

4. Return to report-only and verify recovery

To stop blocking requests without removing the assignment, return it to report-only mode.

  1. Open Assignment details for enforce_application_name_prefix and select Edit.
  2. On Settings, keep Status set to On and change Enforcement to Report-only. Leave the parameters unchanged.
  3. On Review, select Save.
  4. Reopen Assignment details and confirm On and Report-only.
  5. Wait for assignment changes to propagate.
  6. In Graph Explorer, repeat POST to https://graph.microsoft.com/beta/applications with displayName set to Inventory-Taker. Expect 201 Created unless another control blocks it, and record the returned object's id for cleanup.

Confirm recovery with the real request, not just the saved setting or a simulated evaluation. Report-only continues to evaluate the assignment but doesn't enforce its deny effect.

5. Clean up

Remove the assignment retained from the quickstart and clean up only the test resources you created.

Remove the assignment

Delete the assignment from the tenant-wide list.

  1. Browse to Tenant governance > Assignments.
  2. Select the checkbox for enforce_application_name_prefix. Confirm that only the intended assignment is selected, including any selections hidden by the current filter.
  3. Select Delete.
  4. In Remove assignment?, confirm Selected items: 1., then select Delete.

Deleting the assignment stops it from applying the policy and moves it to Deleted items. You can restore it for 30 days.

Remove the test applications

Remove every application created by the report-only, enforcement, and recovery tests. More than one application can have the same display name. Use each object's id returned by a successful creation request to identify the test resource, not its appId or display name alone.

  1. In the Microsoft Entra admin center, go to Entra ID > App registrations and select a test application.
  2. On the application's Overview page, confirm its object ID matches one recorded during this tutorial, then select Delete.
  3. In Delete app registration, review the warning that the app won't be able to sign in users or access protected resources, then select Delete.
  4. Open Notifications and confirm the deletion succeeded for that application.
  5. Repeat for each remaining test application whose object ID you recorded.

Next steps

For a production rollout, use Safely deploy resource policy assignments to plan representative observation, application-owner review, and recovery.

Related content

Daily Entra.News

Get daily email updates

Get a concise summary of the latest Microsoft Entra updates delivered straight to your inbox.

Loading the secure signup form…