Bylaw

Gallery › Security Center › Azure built-in policies

[Deprecated]: Accounts with write permissions on Azure resources should be MFA enabled

Converted Policy AuditIfNotExists Disabled Mode All Version 1.1.0-deprecated Deprecated

This policy definition is deprecated. 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_EnableMFAForAccountsWithWritePermissions_Audit.json · 54 lines
{
  "properties": {
    "displayName": "[Deprecated]: Accounts with write permissions on Azure resources should be MFA enabled",
    "policyType": "BuiltIn",
    "mode": "All",
    "description": "This policy definition is deprecated. Learn more about policy definition deprecation at aka.ms/policydefdeprecation",
    "metadata": {
      "version": "1.1.0-deprecated",
      "category": "Security Center",
      "deprecated": true
    },
    "version": "1.1.0",
    "parameters": {
      "effect": {
        "type": "string",
        "defaultValue": "Disabled",
        "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": "c0cb17b2-0607-48a7-b0e0-903ed22de39b",
          "existenceCondition": {
            "field": "Microsoft.Security/assessments/status.code",
            "in": [
              "NotApplicable",
              "Healthy"
            ]
          }
        }
      }
    },
    "versions": [
      "1.1.0",
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/931e118d-50a1-4457-a5e4-78550e086c52",
  "name": "931e118d-50a1-4457-a5e4-78550e086c52"
}
Bylaw931e118d-50a1-4457-a5e4-78550e086c52.bylaw.ps1 · 29 lines
# Converted from ASC_EnableMFAForAccountsWithWritePermissions_Audit.json by ConvertTo-Bylaw.
Policy '931e118d-50a1-4457-a5e4-78550e086c52' {

    Properties @{
        DisplayName   = '[Deprecated]: Accounts with write permissions on Azure resources should be MFA enabled'
        Description   = 'This policy definition is deprecated. Learn more about policy definition deprecation at aka.ms/policydefdeprecation'
        Version       = '1.1.0-deprecated'
        Category      = 'Security Center'
        Deprecated    = $true
        PolicyVersion = '1.1.0'
        Mode          = 'All'
    }

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

    Resource 'Microsoft.Resources/subscriptions'

    AuditIfNotExists 'Microsoft.Security/assessments' -Name 'c0cb17b2-0607-48a7-b0e0-903ed22de39b' -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_EnableMFAForAccountsWithWritePermissions_Audit.json in Azure/azure-policy, under the MIT licence.