Bylaw

Gallery › SRE Agent › Azure built-in policies

SRE Agents should not be configured in Autonomous mode

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0

Require human approval before SRE Agents perform write actions on Azure resources, reducing the risk of unintended autonomous changes.

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

Azure Policy JSONAgentAutonomousMode_Audit.json · 50 lines
{
  "properties": {
    "displayName": "SRE Agents should not be configured in Autonomous mode",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Require human approval before SRE Agents perform write actions on Azure resources, reducing the risk of unintended autonomous changes.",
    "metadata": {
      "version": "1.0.0",
      "category": "SRE Agent"
    },
    "version": "1.0.0",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable, deny, or disable the execution of the policy."
        },
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.App/agents"
          },
          {
            "field": "Microsoft.App/agents/actionConfiguration.mode",
            "equals": "Autonomous"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/b9f8555f-abee-4709-be6b-cc34789f6cc8",
  "name": "b9f8555f-abee-4709-be6b-cc34789f6cc8"
}
Bylawb9f8555f-abee-4709-be6b-cc34789f6cc8.bylaw.ps1 · 28 lines
# Converted from AgentAutonomousMode_Audit.json by ConvertTo-Bylaw.
Policy 'b9f8555f-abee-4709-be6b-cc34789f6cc8' {

    Properties @{
        DisplayName   = 'SRE Agents should not be configured in Autonomous mode'
        Description   = 'Require human approval before SRE Agents perform write actions on Azure resources, reducing the risk of unintended autonomous changes.'
        Version       = '1.0.0'
        Category      = 'SRE Agent'
        PolicyVersion = '1.0.0'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.App/agents' {

        Require 'actionConfiguration.mode is not Autonomous' {
            Field actionConfiguration.mode | Must -Not -Be 'Autonomous' -IfPresent
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/SRE Agent/AgentAutonomousMode_Audit.json in Azure/azure-policy, under the MIT licence.