Bylaw

Gallery › Security Center › Azure built-in policies

A maximum of 3 owners should be designated for your subscription

Converted Policy AuditIfNotExists Disabled Mode All Version 3.0.0

It is recommended to designate up to 3 subscription owners in order to reduce the potential for breach by a compromised owner.

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

Azure Policy JSONASC_DesignateLessThanXOwners_Audit.json · 52 lines
{
  "properties": {
    "displayName": "A maximum of 3 owners should be designated for your subscription",
    "policyType": "BuiltIn",
    "mode": "All",
    "description": "It is recommended to designate up to 3 subscription owners in order to reduce the potential for breach by a compromised owner.",
    "metadata": {
      "version": "3.0.0",
      "category": "Security Center"
    },
    "version": "3.0.0",
    "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": "6f90a6d6-d4d6-0794-0ec1-98fa77878c2e",
          "existenceCondition": {
            "field": "Microsoft.Security/assessments/status.code",
            "in": [
              "NotApplicable",
              "Healthy"
            ]
          }
        }
      }
    },
    "versions": [
      "3.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/4f11b553-d42e-4e3a-89be-32ca364cad4c",
  "name": "4f11b553-d42e-4e3a-89be-32ca364cad4c"
}
Bylaw4f11b553-d42e-4e3a-89be-32ca364cad4c.bylaw.ps1 · 28 lines
# Converted from ASC_DesignateLessThanXOwners_Audit.json by ConvertTo-Bylaw.
Policy '4f11b553-d42e-4e3a-89be-32ca364cad4c' {

    Properties @{
        DisplayName   = 'A maximum of 3 owners should be designated for your subscription'
        Description   = 'It is recommended to designate up to 3 subscription owners in order to reduce the potential for breach by a compromised owner.'
        Version       = '3.0.0'
        Category      = 'Security Center'
        PolicyVersion = '3.0.0'
        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 '6f90a6d6-d4d6-0794-0ec1-98fa77878c2e' -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_DesignateLessThanXOwners_Audit.json in Azure/azure-policy, under the MIT licence.