You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Control AI model deployment with custom policies
2
+
title: Control model deployment with custom policies
3
3
titleSuffix: Azure AI Foundry
4
4
description: "Learn how to use custom Azure Policies to control Azure AI services and Azure OpenAI model deployment with Azure AI Foundry."
5
-
author: Blackmist
6
-
ms.author: larryfr
5
+
manager: scottpolly
7
6
ms.service: azure-ai-foundry
8
7
ms.topic: how-to #Don't change
9
-
ms.date: 10/25/2024
10
-
11
-
#customer intent: As an admin, I want control what Azure AI services and Azure OpenAI models can be deployed by my developers.
8
+
ms.date: 02/11/2025
9
+
author: Blackmist
10
+
ms.author: larryfr
11
+
reviewer: santiagxf
12
+
ms.reviewer: fasantia
12
13
13
14
---
14
15
15
-
# Control AI model deployment with custom policies in Azure AI Foundry portal
16
+
# Control model deployment with custom policies
16
17
17
-
When using models from Azure AI services and Azure OpenAI with Azure AI Foundry, you might need to use custom policies to control what models your developers can deploy. Custom Azure Policies allow you to create policy definitions that meet your organization's unique requirements. This article shows you how to create and assign an example custom policy to control model deployment.
18
+
When using models from Azure AI Services and Azure OpenAI with Azure AI Foundry, you might need to use custom policies to control which [type of deployment](../concepts/deployment-types.md) options are available to users or which specific models users can deploy. This article guides you on how to create policies to control model deployments using Azure Policies.
18
19
19
20
## Prerequisites
20
21
@@ -24,71 +25,125 @@ When using models from Azure AI services and Azure OpenAI with Azure AI Foundry,
24
25
25
26
## Create a custom policy
26
27
28
+
Follow these steps to create and assign an example custom policy to control model deployments:
29
+
27
30
1. From the [Azure portal](https://portal.azure.com), select **Policy** from the left side of the page. You can also search for **Policy** in the search bar at the top of the page.
28
-
1. From the left side of the Azure Policy Dashboard, select **Authoring**, **Definitions**, and then select **+ Policy definition** from the top of the page.
29
-
1. In the **Policy Definition** form, use the following values:
31
+
32
+
2. From the left side of the Azure Policy Dashboard, select **Authoring**, **Definitions**, and then select **+ Policy definition** from the top of the page.
33
+
34
+
:::image type="content" source="../media/configure-deployment-policies/create-new-policy.png" alt-text="An screenshot showing how to create a new policy definition in Azure Policies." lightbox="../media/configure-deployment-policies/create-new-policy.png":::
35
+
36
+
3. In the **Policy Definition** form, use the following values:
30
37
31
38
-**Definition location**: Select the subscription or management group where you want to store the policy definition.
32
39
-**Name**: Enter a unique name for the policy definition. For example, `Custom allowed Azure AI services and Azure OpenAI models`.
33
40
-**Description**: Enter a description for the policy definition.
34
41
-**Category**: You can either create a new category or use an existing one. For example, "AI model governance."
35
-
-**Policy rule**: Enter the policy rule in JSON format. The following example shows a policy rule that allows the deployment of specific Azure AI services and Azure OpenAI models:
36
42
37
-
> [!TIP]
38
-
> Azure AI services was originally named Azure Cognitive Services. This name is still used internally by Azure, such as this custom policy where you see a value of `Microsoft.CognitiveServices`. Azure OpenAI is part of Azure AI services, so this policy also applies to Azure OpenAI models.
43
+
4. On **Policy rule**, enter the policy rule details in JSON format. Select the scenario that applies to your case better:
The following policy allows you to control which specific models and versions are available for deployment. You can enforce this policy at different levels depending on your needs.
"description": "The list of allowed models to be deployed."
70
77
}
78
+
}
71
79
}
72
-
```
80
+
}
81
+
```
82
+
83
+
# [Enforce specific deployment types](#tab/deployments)
73
84
74
-
1. Select **Save** to save the policy definition. After saving, you arrive at the policy definition's overview page.
75
-
1. From the policy definition's overview page, select **Assign policy** to assign the policy definition.
76
-
1. From the **Assign policy** page, use the following values on the **Basics** tab:
85
+
The following policy allows you to control which types of deployments are allowed in the Azure AI Services or Azure OpenAI Resources. For example, you might want to prevent developers from creating deployments that result in data processed in a different region. Follow these steps to create a policy that denies creating global processing deployment types.
> Azure AI services was originally named Azure Cognitive Services. This name is still used internally by Azure, such as this custom policy where you see a value of `Microsoft.CognitiveServices`. Azure OpenAI is part of Azure AI services, so this policy also applies to Azure OpenAI models.
114
+
115
+
5. Select **Save** to save the policy definition. After saving, you arrive at the policy definition's overview page.
116
+
117
+
6. From the policy definition's overview page, select **Assign policy** to assign the policy definition.
118
+
119
+
7. From the **Assign policy** page, use the following values on the **Basics** tab:
77
120
78
121
- **Scope**: Select the scope where you want to assign the policy. The scope can be a management group, subscription, or resource group.
79
122
- **Policy definition**: This field is prepopulated with the title of policy definition you created previously.
80
123
- **Assignment name**: Enter a unique name for the assignment.
81
124
- **Policy enforcement**: Make sure that the **Policy enforcement** field is set to **Enabled**. If it isn't enabled, the policy isn't enforced.
82
125
83
126
Select **Next** at the bottom of the page, or the **Parameters** tab at the top of the page.
84
-
1. From the **Parameters** tab, set **Allowed AI models** to the list of models that you want to allow. The list should be a comma-separated list of model names and approved versions, surrounded by square brackets. For example, `["gpt-4,0613", "gpt-35-turbo,0613"]`.
127
+
128
+
8. Configure the parameters for the policy (if any):
129
+
130
+
# [Enforce specific models](#tab/models)
131
+
132
+
From the **Parameters** tab, set **Allowed AI models** to the list of models that you want to allow. The list should be a comma-separated list of model names and approved versions, surrounded by square brackets. For example, `["gpt-4,0613", "gpt-35-turbo,0613"]`.
85
133
86
134
> [!TIP]
87
135
> You can find the model names and their versions in the [Azure AI Foundry Model Catalog](https://ai.azure.com/explore/models). Select the model to view the details, and then copy the model name and their version in the title.
88
136
89
-
1. Optionally, select the **Non-compliance messages** tab at the top of the page and set a custom message for noncompliance.
90
-
1. Select **Review + create** tab and verify that the policy assignment is correct. When ready, select **Create** to assign the policy.
91
-
1. Notify your developers that the policy is in place. They receive an error message if they try to deploy a model that isn't in the list of allowed models.
137
+
# [Enforce specific deployment types](#tab/deployments)
138
+
139
+
This policy doesn't require parameters.
140
+
141
+
9. Optionally, select the **Non-compliance messages** tab at the top of the page and set a custom message for noncompliance.
142
+
143
+
10. Select **Review + create** tab and verify that the policy assignment is correct. When ready, select **Create** to assign the policy.
144
+
145
+
11. Notify your developers that the policy is in place. They receive an error message if they try to deploy a model that isn't in the list of allowed models.
146
+
92
147
93
148
## Verify policy assignment
94
149
@@ -99,7 +154,10 @@ To verify that the policy is assigned, navigate to **Policy** in the Azure porta
99
154
To monitor compliance with the policy, follow these steps:
100
155
101
156
1. From the [Azure portal](https://portal.azure.com), select **Policy** from the left side of the page. You can also search for **Policy** in the search bar at the top of the page.
102
-
1. From the left side of the Azure Policy Dashboard, select **Compliance**. Each policy assignment is listed with the compliance status. To view more details, select the policy assignment.
157
+
158
+
1. From the left side of the Azure Policy Dashboard, select **Compliance**. Each policy assignment is listed with the compliance status. To view more details, select the policy assignment. The following example shows the compliance report for a policy that blocks deployments of type *Global standard*.
159
+
160
+
:::image type="content" source="../media/configure-deployment-policies/policy-compliance.png" alt-text="An screenshot showing an example of a policy compliance report for a policy that blocks Global standard deployment SKUs." lightbox="../media/configure-deployment-policies/policy-compliance.png":::
103
161
104
162
## Update the policy assignment
105
163
@@ -112,7 +170,6 @@ To update an existing policy assignment with new models, follow these steps:
112
170
113
171
## Best practices
114
172
115
-
- **Obtaining model names**: Use the [Azure AI Foundry Model Catalog](https://ai.azure.com/explore/models), then select the model to view details. Use the model name in the title with the policy.
116
173
- **Granular scoping**: Assign policies at the appropriate scope to balance control and flexibility. For example, apply at the subscription level to control all resources in the subscription, or apply at the resource group level to control resources in a specific group.
117
174
- **Policy naming**: Use a consistent naming convention for policy assignments to make it easier to identify the purpose of the policy. Include information such as the purpose and scope in the name.
118
175
- **Documentation**: Keep records of policy assignments and configurations for auditing purposes. Document any changes made to the policy over time.
@@ -123,6 +180,5 @@ To update an existing policy assignment with new models, follow these steps:
0 commit comments