Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
Tutorial: Apply MFA self-enforcement through Azure Policy
Azure Policy is a powerful governance tool that allows you to prepare your organization for upcoming enforcement of multifactor authentication (MFA) across Azure clients. This guide walks you through the process of applying Azure Policy assignments to self-enforce multifactor authentication across your organization.
Apply Azure Policy enforcement through Azure portal
1. Sign into Azure portal
Navigate to the Azure portal
2. Access Azure Policy Service
Select Policy under Azure services. If you don't see it, type 'Policy' in the search bar at the top and select it from the results.
π Screenshot of Azure Policy Assignment View.
3. Choose the Scope for Assignment
- Click 'Assignments' in the left pane of the Policy dashboard.
- Click 'Assign policy' at the top of the assignments page.
- Click 'Select scope' in the Scope section.
- Select the appropriate resource group, subscription, or management group where you want to apply the policy.
- Click 'Select' to confirm your choice.
4. Configure Selectors for gradual rollout of policy enforcement
Note
To enable safe rollout of policy enforcement, we recommend using Azure Policyβs resource selectors to gradually rollout policy enforcement across your resources.
Click 'Expand' on the 'Resource Selectors' section of the Basics tab.
Click 'Add a resource selector'
Add a name for your selector
Toggle resourceLocation to enable it.
Pick a few low-risk regions that youβd like to enforce on. The policy assignment will evaluate Azure resources in those regions.
You can update this assignment later to add more regions by adding more resourceLocation selectors or updating the existing resourceLocation selector to add more regions.
π Screenshot of Azure Policy Selector Creation View.
5. Select a Policy Definition
- Click on Policy definition under 'Basics'.
- Browse or search for the multifactor policy definition β there are 2 of them. Pick one for now:
- Select the policy definition from the list.
π Screenshot of Azure Policy Definition Search View.
6. Configure More Assignment Details
- Under 'Basics', enter a name for your policy assignment. Optionally, you may add a description to help others understand the purpose of this assignment.
- Under 'Basics', enforcement mode should be set to enabled (this mode is set by default, no action needed).
- Go to the 'Parameters' tab. Uncheck 'only show parameters that require input or review'. The parameter value should be at the preselected value 'AuditAction' or 'Audit' (depending on the definition chosen in step 4).
- Under the 'Non-compliance messages' tab, configure a custom message that any user sees if they're blocked from deleting a resource because of this enforcement:
Sample Text: To resolve this error, set up MFA at aka.ms/setupMFA. If you set up MFA and are still receiving this error, reach out to your Entra administrator to restore your Azure security default.
π Screenshot of Azure Policy Message Tab.
7. Review and Create Assignment
- Review your selections and settings on the 'Review + create' tab.
- If everything looks correct, click 'Create' to apply the policy assignment.
8. Roll out the policy assignment to all regions
- Update the policy assignment selector to evaluate resources in other regions.
- Repeat this step until the policy assignment is evaluating resources in all regions.
9. Verify existence of the policy assignment
- Under the 'Assignments' tab, confirm that the policy assignment was successfully created.
- You can use the search bar and scope bar to easily filter.
π Screenshot of Azure Policy Assignment List View.
Update the policy assignment to enforcement
You can enable enforcement by updating the 'Effect' of the policy assignment.
- Go to the policy assignment under Policy Assignments. Click 'Edit assignment'.
- In the 'Basics' tab, youβll see 'Overrides'. Click expand.
- Click 'Add a policy effect override'
- In the drop-down menu, update the
Override Valueto 'DenyAction' or 'Deny' (depending on the policy definition chosen at Step 4). - For
Selected Resources, pick a few low-risk regions that youβd like to enforce on. The policy assignment will only evaluate Azure resources in those regions. π Screenshot of Azure Policy Overrides Creation.
- Click 'Review + save', then 'Create'.
- Once you have confirmed no unexpected impact, you may update the existing override to add other regions.
Audit Mode
Discover audit events in your activity log when this policy assignment is applied in audit mode. Each event represents a resource create, update or delete that was performed by a user who did not authenticate with MFA.
You can view activity Log events in Azure portal and other supported clients. Here's a sample query that can be used in CLI:
az monitor activity-log list \ --query "[?operationName.value=='Microsoft.Authorization/policies/audit/action'].{ResourceId: resourceId, Policies: properties.policies}" \ --output json | \ jq -r '"ResourceName\tResourceId\tPolicyDefinitionDisplayName", (.[] as $event | ($event.Policies | fromjson[] | "\($event.ResourceId | split("/") | last)\t\($event.ResourceId)\t\(.policyDefinitionDisplayName)"))' | \ column -t -s $'\t'
Note
Audit events are seen only in Activity Logs with the Policy compliance list showing always 0 resources. This policy identifies non-compliant requests, not resources, which is why the resource compliance list is empty.
Enforcement Mode
Discover deny events in your activity log when this policy assignment is applied in enforcement mode. Each deny event represents a resource create, update or delete that was attempted by a user who did not authenticate with MFA.
The next section shows the experience from some select clients when the policy assignment is applied in enforcement mode and a user account attempts to create, update, or delete a resource without being authenticated with MFA.
Note
In preview timeframe, the error messages displayed to the user may differ depending on the client and command being run.
Azure portal
When you attempt to perform a create, update, or delete operation without an MFA-authenticated token, Azure portal may return:
π Screenshot of Azure portal view.
Azure CLI
When you attempt to perform a create, update, or delete operation without an MFA-authenticated token, Azure CLI may return:
π Screenshot of Azure CLI View When User Gets Blocked By Policy.
Azure PowerShell
When you attempt to perform a create, update, or delete operation without an MFA-authenticated token, Azure PowerShell may return:
π Screenshot of Azure PowerShell View When User Gets Blocked By Policy.
Feedback
Was this page helpful?
