Bylaw

Gallery › Security Center › Azure built-in policies

There should be more than one owner assigned to your subscription

Converted Policy AuditIfNotExists Disabled Mode All Version 3.0.0

It is recommended to designate more than one subscription owner in order to have administrator access redundancy.

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

Azure Policy JSONASC_DesignateMoreThanOneOwner_Audit.json · 52 lines
{
  "properties": {
    "displayName": "There should be more than one owner assigned to your subscription",
    "policyType": "BuiltIn",
    "mode": "All",
    "description": "It is recommended to designate more than one subscription owner in order to have administrator access redundancy.",
    "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": "2c79b4af-f830-b61e-92b9-63dfa30f16e4",
          "existenceCondition": {
            "field": "Microsoft.Security/assessments/status.code",
            "in": [
              "NotApplicable",
              "Healthy"
            ]
          }
        }
      }
    },
    "versions": [
      "3.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/09024ccc-0c5f-475e-9457-b7c0d9ed487b",
  "name": "09024ccc-0c5f-475e-9457-b7c0d9ed487b"
}
Bylaw09024ccc-0c5f-475e-9457-b7c0d9ed487b.bylaw.ps1 · 28 lines
# Converted from ASC_DesignateMoreThanOneOwner_Audit.json by ConvertTo-Bylaw.
Policy '09024ccc-0c5f-475e-9457-b7c0d9ed487b' {

    Properties @{
        DisplayName   = 'There should be more than one owner assigned to your subscription'
        Description   = 'It is recommended to designate more than one subscription owner in order to have administrator access redundancy.'
        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 '2c79b4af-f830-b61e-92b9-63dfa30f16e4' -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_DesignateMoreThanOneOwner_Audit.json in Azure/azure-policy, under the MIT licence.