Bylaw

Gallery › Security Center › Azure built-in policies

[Deprecated]: MFA should be enabled for accounts with write permissions on your subscription

Converted Policy AuditIfNotExists Disabled Mode All Version 3.0.1-deprecated Deprecated

This policy definition is no longer the recommended way to achieve its intent. Instead of continuing to use this policy, we recommend you assign this replacement policy with policy ID 931e118d-50a1-4457-a5e4-78550e086c52. Learn more about policy definition deprecation at aka.ms/policydefdeprecation

ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.

Azure Policy JSONASC_EnableMFAForWritePermissions_Audit.json · 53 lines
{
  "properties": {
    "displayName": "[Deprecated]: MFA should be enabled for accounts with write permissions on your subscription",
    "policyType": "BuiltIn",
    "mode": "All",
    "description": "This policy definition is no longer the recommended way to achieve its intent. Instead of continuing to use this policy, we recommend you assign this replacement policy with policy ID 931e118d-50a1-4457-a5e4-78550e086c52. Learn more about policy definition deprecation at aka.ms/policydefdeprecation",
    "metadata": {
      "version": "3.0.1-deprecated",
      "category": "Security Center",
      "deprecated": true
    },
    "version": "3.0.1",
    "parameters": {
      "effect": {
        "type": "string",
        "defaultValue": "AuditIfNotExists",
        "allowedValues": [
          "AuditIfNotExists",
          "Disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        }
      }
    },
    "policyRule": {
      "if": {
        "field": "type",
        "equals": "Microsoft.Resources/subscriptions"
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "type": "Microsoft.Security/assessments",
          "name": "57e98606-6b1e-6193-0e3d-fe621387c16b",
          "existenceCondition": {
            "field": "Microsoft.Security/assessments/status.code",
            "in": [
              "NotApplicable",
              "Healthy"
            ]
          }
        }
      }
    },
    "versions": [
      "3.0.1"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/9297c21d-2ed6-4474-b48f-163f75654ce3",
  "name": "9297c21d-2ed6-4474-b48f-163f75654ce3"
}
Bylaw9297c21d-2ed6-4474-b48f-163f75654ce3.bylaw.ps1 · 29 lines
# Converted from ASC_EnableMFAForWritePermissions_Audit.json by ConvertTo-Bylaw.
Policy '9297c21d-2ed6-4474-b48f-163f75654ce3' {

    Properties @{
        DisplayName   = '[Deprecated]: MFA should be enabled for accounts with write permissions on your subscription'
        Description   = 'This policy definition is no longer the recommended way to achieve its intent. Instead of continuing to use this policy, we recommend you assign this replacement policy with policy ID 931e118d-50a1-4457-a5e4-78550e086c52. Learn more about policy definition deprecation at aka.ms/policydefdeprecation'
        Version       = '3.0.1-deprecated'
        Category      = 'Security Center'
        Deprecated    = $true
        PolicyVersion = '3.0.1'
        Mode          = 'All'
    }

    Parameter Effect @{
        Type          = 'string'
        AllowedValues = @('AuditIfNotExists', 'Disabled')
        Default       = 'AuditIfNotExists'
        DisplayName   = 'Effect'
        Description   = 'Enable or disable the execution of the policy'
    }

    Resource 'Microsoft.Resources/subscriptions'

    AuditIfNotExists 'Microsoft.Security/assessments' -Name '57e98606-6b1e-6193-0e3d-fe621387c16b' -Effect (Param Effect) {
        Require 'status.code is one of 2 values' {
            Field status.code | Must -BeIn @('NotApplicable', 'Healthy')
        }
    }
}

Source: built-in-policies/policyDefinitions/Security Center/ASC_EnableMFAForWritePermissions_Audit.json in Azure/azure-policy, under the MIT licence.