Bylaw

Gallery › General › Azure Community Policy

SRE Agent should use only approved AI model providers

Converted Policy Audit Deny Disabled Mode All Version 1.0.0

Audits or denies Microsoft.App/agents resources without an explicitly configured approved default AI model provider. Assign Audit first to inventory existing agents before enforcing Deny.

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

Azure Policy JSONazurepolicy.json · 64 lines
{
  "$schema": "https://schema.management.azure.com/schemas/2020-10-01/policyDefinition.json#",
  "name": "d56cddda-67d5-41d1-9b2d-4d9269e5c675",
  "type": "Microsoft.Authorization/policyDefinitions",
  "properties": {
    "displayName": "SRE Agent should use only approved AI model providers",
    "description": "Audits or denies Microsoft.App/agents resources without an explicitly configured approved default AI model provider. Assign Audit first to inventory existing agents before enforcing Deny.",
    "mode": "All",
    "metadata": {
      "category": "General",
      "version": "1.0.0"
    },
    "parameters": {
      "allowedModelProviders": {
        "type": "Array",
        "metadata": {
          "displayName": "Allowed AI model providers",
          "description": "The SRE Agent default model providers that are permitted. The control plane currently represents Azure AI Foundry as MicrosoftFoundry."
        },
        "defaultValue": [
          "MicrosoftFoundry"
        ]
      },
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Audit, Deny, or disable the policy."
        },
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.App/agents"
          },
          {
            "anyOf": [
              {
                "field": "Microsoft.App/agents/defaultModel.provider",
                "exists": "false"
              },
              {
                "field": "Microsoft.App/agents/defaultModel.provider",
                "notIn": "[parameters('allowedModelProviders')]"
              }
            ]
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    }
  }
}
Bylawd56cddda-67d5-41d1-9b2d-4d9269e5c675.bylaw.ps1 · 36 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy 'd56cddda-67d5-41d1-9b2d-4d9269e5c675' {

    Properties @{
        DisplayName = 'SRE Agent should use only approved AI model providers'
        Description = 'Audits or denies Microsoft.App/agents resources without an explicitly configured approved default AI model provider. Assign Audit first to inventory existing agents before enforcing Deny.'
        Category    = 'General'
        Version     = '1.0.0'
        Mode        = 'All'
    }

    Parameter AllowedModelProviders @{
        Type        = 'Array'
        Default     = @('MicrosoftFoundry')
        DisplayName = 'Allowed AI model providers'
        Description = 'The SRE Agent default model providers that are permitted. The control plane currently represents Azure AI Foundry as MicrosoftFoundry.'
    }
    Parameter Effect @{
        AllowedValues = @('Audit', 'Deny', 'Disabled')
        Default       = 'Audit'
        Description   = 'Audit, Deny, or disable the policy.'
    }

    Resource 'Microsoft.App/agents' {

        Require 'defaultModel.provider exists' {
            Field defaultModel.provider | Must -Exist
        }

        Require 'defaultModel.provider is one of the AllowedModelProviders parameter' {
            Field defaultModel.provider | Must -BeIn (Param AllowedModelProviders)
        }
    }

    Effect (Param Effect)
}

Source: policyDefinitions/General/sre-agent-should-use-only-approved-ai-model-providers/azurepolicy.json in Azure/Community-Policy, under the MIT licence.