Skip to main content

Azure Policy - Deny the creation of Azure OpenAI Studio

· 3 min read

Custom policy definition to deny the creation of Azure OpenAI Studio Hubs, which will stop the creation of an Azure OpenAI Studio.

This custom Azure Policy that denies the creation of Azure OpenAI Studio hubs. Here's a breakdown of its components:

KeyDescription
policyTypeSpecifies that this is a custom policy.
modeIndicates that the policy is indexed, meaning it can be evaluated against existing resources.
displayNameA human-readable name for the policy.
descriptionA brief description of what the policy does.
metadataContains additional information about the policy:
versionThe version of the policy.
categoryThe category under which this policy falls.
sourceA URL for more information.
alzCloudEnvironmentsSpecifies the cloud environments where this policy is applicable.
createdByThe creator of the policy.
lastUpdatedThe date when the policy was last updated.
parametersDefines parameters that can be used within the policy:
effectA parameter that determines the action to take (Audit, Disabled, or Deny).
typeThe type of the parameter (String).
metadataAdditional information about the parameter:
displayNameA human-readable name for the parameter.
descriptionA brief description of the parameter.
allowedValuesThe allowed values for this parameter.
defaultValueThe default value for this parameter (Deny).
policyRuleDefines the rule that the policy enforces:
ifSpecifies the conditions to check:
allOfAn array of conditions that must all be true.
fieldThe field to check (type and kind).
equalsThe expected value for the field.
thenSpecifies the action to take if the conditions are met:
effectThe action to take, which is determined by the value of the effect parameter.

This policy checks if a resource is of type Microsoft.MachineLearningServices/workspaces and kind Hub. If both conditions are met, the policy enforces the action specified by the effect parameter, which defaults to "Deny".

Azure Policy - Deny the creation of Azure OpenAI Studio

{
"policyType": "Custom",
"mode": "Indexed",
"displayName": "Deny Azure OpenAI Studio creation",
"description": "Deny Azure OpenAI Studio hub creation.",
"metadata": {
"version": "1.0.0",
"category": "Machine Learning",
"source": "https://luke.geek.nz",
"alzCloudEnvironments": [
"AzureCloud"
],
"createdBy": "Luke",
"lastUpdated": "2024-10-01"
},
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"Audit",
"Disabled",
"Deny"
],
"defaultValue": "Deny"
}

},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.MachineLearningServices/workspaces"
},
{
"field": "kind",
"equals": "Hub"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
}

Azure Policy - Deny the creation of Azure OpenAI Studio