Bylaw

Gallery › General › Azure built-in policies

Users must authenticate with multi-factor authentication to delete resources

Doesn't convert yet Policy DenyAction Disabled Mode All Version 1.1.0

This policy definition blocks resource delete operations when the caller is not authenticated via MFA. For more information, visit https://aka.ms/mfaforazure.

ConvertTo-Bylaw can't convert this policy yet:

Azure Policy JSONMFA_DenyAction.json · 65 lines
{
  "properties": {
    "displayName": "Users must authenticate with multi-factor authentication to delete resources",
    "policyType": "BuiltIn",
    "mode": "All",
    "description": "This policy definition blocks resource delete operations when the caller is not authenticated via MFA. For more information, visit https://aka.ms/mfaforazure.",
    "metadata": {
      "version": "1.1.0",
      "category": "General"
    },
    "version": "1.1.0",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "The desired effect of the policy"
        },
        "allowedValues": [
          "AuditAction",
          "DenyAction",
          "Disabled"
        ],
        "defaultValue": "AuditAction"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "value": "[contains(requestContext().identity, 'idtyp')]",
            "equals": true
          },
          {
            "value": "[requestContext().identity.idtyp]",
            "equals": "user"
          },
          {
            "value": "mfa",
            "notIn": "[split(tryGet(requestContext().identity, 'http://schemas.microsoft.com/claims/authnmethodsreferences'), ',')]"
          },
          {
            "value": "p1",
            "notIn": "[split(requestContext().identity.acrs, ',')]"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "actionNames": [
            "delete"
          ]
        }
      }
    },
    "versions": [
      "1.1.0",
      "1.0.1",
      "1.0.0-PREVIEW"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/db4a9d17-db75-4f46-9fcb-9f9526604417",
  "name": "db4a9d17-db75-4f46-9fcb-9f9526604417"
}

Source: built-in-policies/policyDefinitions/General/MFA_DenyAction.json in Azure/azure-policy, under the MIT licence.