Bylaw

Gallery › Service Fabric › Azure built-in policies

Service Fabric clusters should only use Azure Active Directory for client authentication

Converted Policy Audit Deny Disabled Mode Indexed Version 1.1.0

Audit usage of client authentication only via Azure Active Directory in Service Fabric

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

Azure Policy JSONAuditADAuth_Audit.json · 58 lines
{
  "properties": {
    "displayName": "Service Fabric clusters should only use Azure Active Directory for client authentication",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Audit usage of client authentication only via Azure Active Directory in Service Fabric",
    "metadata": {
      "version": "1.1.0",
      "category": "Service Fabric"
    },
    "version": "1.1.0",
    "parameters": {
      "effect": {
        "type": "string",
        "defaultValue": "Audit",
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "The effect determines what happens when the policy rule is evaluated to match"
        }
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.ServiceFabric/clusters"
          },
          {
            "anyOf": [
              {
                "field": "Microsoft.ServiceFabric/clusters/azureActiveDirectory.tenantId",
                "exists": "false"
              },
              {
                "field": "Microsoft.ServiceFabric/clusters/azureActiveDirectory.tenantId",
                "equals": ""
              }
            ]
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.1.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/b54ed75b-3e1a-44ac-a333-05ba39b99ff0",
  "name": "b54ed75b-3e1a-44ac-a333-05ba39b99ff0"
}
Bylawb54ed75b-3e1a-44ac-a333-05ba39b99ff0.bylaw.ps1 · 33 lines
# Converted from AuditADAuth_Audit.json by ConvertTo-Bylaw.
Policy 'b54ed75b-3e1a-44ac-a333-05ba39b99ff0' {

    Properties @{
        DisplayName   = 'Service Fabric clusters should only use Azure Active Directory for client authentication'
        Description   = 'Audit usage of client authentication only via Azure Active Directory in Service Fabric'
        Version       = '1.1.0'
        Category      = 'Service Fabric'
        PolicyVersion = '1.1.0'
        Mode          = 'Indexed'
    }

    Parameter Effect @{
        Type          = 'string'
        AllowedValues = @('Audit', 'Deny', 'Disabled')
        Default       = 'Audit'
        DisplayName   = 'Effect'
        Description   = 'The effect determines what happens when the policy rule is evaluated to match'
    }

    Resource 'Microsoft.ServiceFabric/clusters' {

        Require 'azureActiveDirectory.tenantId exists' {
            Field azureActiveDirectory.tenantId | Must -Exist
        }

        Require 'azureActiveDirectory.tenantId is not' {
            Field azureActiveDirectory.tenantId | Must -Not -Be '' -IfPresent
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Service Fabric/AuditADAuth_Audit.json in Azure/azure-policy, under the MIT licence.