When creating a custom policy assignment, the name must be no more than 24 characters long.
It could be helpful if this can be validated within the provider so that the error can be picked up during plan rather than at apply.
│ Error: Failed to create/update resource
│
│ with module.alz.module.alz_global.module.policy_assignment["global/Audit-OpenAI-ContentLogging"].azapi_resource.this,
│ on .terraform/modules/alz.alz_global/modules/azapi_helper/main.tf line 1, in resource "azapi_resource" "this":
│ 1: resource "azapi_resource" "this" {
│
│ creating/updating Resource: (ResourceId
│ "/providers/Microsoft.Management/managementGroups/global/providers/Microsoft.Authorization/policyAssignments/Audit-OpenAI-ContentLogging-MB"
│ / Api Version "2024-04-01"): PUT
│ https://management.azure.com/providers/Microsoft.Management/managementGroups/global/providers/Microsoft.Authorization/policyAssignments/Audit-OpenAI-ContentLogging
│ --------------------------------------------------------------------------------
│ RESPONSE 400: 400 Bad Request
│ ERROR CODE: InvalidPolicyAssignmentName
│ --------------------------------------------------------------------------------
│ {
│ "error": {
│ "code": "InvalidPolicyAssignmentName",
│ "message": "The policy assignment name 'Audit-OpenAI-ContentLogging' is invalid. The policy assignment name length must not exceed '24' characters."
│ }
│ }
│ --------------------------------------------------------------------------------
│
When creating a custom policy assignment, the name must be no more than 24 characters long. It could be helpful if this can be validated within the provider so that the error can be picked up during plan rather than at apply.