Bylaw

Gallery › App Platform › Azure built-in policies

[Preview]: Audit Azure Spring Cloud instances where distributed tracing is not enabled

Converted Policy Audit Disabled Mode Indexed Version 1.0.0-preview Preview

Distributed tracing tools in Azure Spring Cloud allow debugging and monitoring the complex interconnections between microservices in an application. Distributed tracing tools should be enabled and in a healthy state.

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

Azure Policy JSONSpring_DistributedTracing_Audit.json · 58 lines
{
  "properties": {
    "displayName": "[Preview]: Audit Azure Spring Cloud instances where distributed tracing is not enabled",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Distributed tracing tools in Azure Spring Cloud allow debugging and monitoring the complex interconnections between microservices in an application. Distributed tracing tools should be enabled and in a healthy state.",
    "metadata": {
      "version": "1.0.0-preview",
      "category": "App Platform",
      "preview": true
    },
    "version": "1.0.0-preview",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "Audit",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.AppPlatform/Spring"
          },
          {
            "anyOf": [
              {
                "field": "Microsoft.AppPlatform/Spring/trace.enabled",
                "notEquals": "true"
              },
              {
                "field": "Microsoft.AppPlatform/Spring/trace.state",
                "notEquals": "Succeeded"
              }
            ]
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0-PREVIEW"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/0f2d8593-4667-4932-acca-6a9f187af109",
  "name": "0f2d8593-4667-4932-acca-6a9f187af109"
}
Bylaw0f2d8593-4667-4932-acca-6a9f187af109.bylaw.ps1 · 33 lines
# Converted from Spring_DistributedTracing_Audit.json by ConvertTo-Bylaw.
Policy '0f2d8593-4667-4932-acca-6a9f187af109' {

    Properties @{
        DisplayName   = '[Preview]: Audit Azure Spring Cloud instances where distributed tracing is not enabled'
        Description   = 'Distributed tracing tools in Azure Spring Cloud allow debugging and monitoring the complex interconnections between microservices in an application. Distributed tracing tools should be enabled and in a healthy state.'
        Version       = '1.0.0-preview'
        Category      = 'App Platform'
        Preview       = $true
        PolicyVersion = '1.0.0-preview'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.AppPlatform/Spring' {

        Require 'trace.enabled is true' {
            Field trace.enabled | Must -Be 'true'
        }

        Require 'trace.state is Succeeded' {
            Field trace.state | Must -Be 'Succeeded'
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/App Platform/Spring_DistributedTracing_Audit.json in Azure/azure-policy, under the MIT licence.