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
+
manager: scottpolly
6
+
ms.service: azure-ai-foundry
7
+
ms.topic: how-to #Don't change
8
+
ms.date: 02/11/2025
5
9
author: Blackmist
6
10
ms.author: larryfr
7
-
ms.service: azure-ai-studio
8
-
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.
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:
Copy file name to clipboardExpand all lines: articles/ai-foundry/model-inference/how-to/quickstart-ai-project.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -125,10 +125,10 @@ You can use any of the supported SDKs to get predictions out from the endpoint.
125
125
126
126
* OpenAI SDK
127
127
* Azure OpenAI SDK
128
-
* Azure AI Inference SDK
129
-
* Azure AI Foundry SDK
128
+
* Azure AI Inference package
129
+
* Azure AI Projects package
130
130
131
-
See the [supported languages and SDKs](../supported-languages.md) section for more details and examples. The following example shows how to use the Azure AI model inference SDK with the newly deployed model:
131
+
See the [supported languages and SDKs](../supported-languages.md) section for more details and examples. The following example shows how to use the Azure AI Inference package with the newly deployed model:
Copy file name to clipboardExpand all lines: articles/ai-foundry/model-inference/how-to/quickstart-github-models.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,7 @@ To obtain the key and endpoint:
47
47
48
48
5. If your existing account is a free account, you first have to upgrade to a Pay as you go plan. Once you upgrade, go back to the playground and select **Get API key** again, then sign in with your upgraded account.
49
49
50
-
6. Once you've signed in to your Azure account, you're taken to [Azure AI Studio > GitHub](https://ai-azure.com/GitHub). It might take one or two minutes to load your initial model details in AI Studio.
50
+
6. Once you've signed in to your Azure account, you're taken to [Azure AI Studio > GitHub](https://ai.azure.com/GitHub). It might take one or two minutes to load your initial model details in AI Studio.
51
51
52
52
7. The page is loaded with your model's details. Select the **Deploy** button to deploy the model to your account.
Copy file name to clipboardExpand all lines: articles/ai-foundry/model-inference/includes/create-resources/bicep.md
+9-2Lines changed: 9 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,8 @@ The tutorial helps you create:
40
40
> * (Optionally) An Azure AI project and hub.
41
41
> * (Optionally) A connection between the hub and the models in Azure AI Services.
42
42
43
+
Notice that **you have to deploy an Azure AI project and hub** if you plan to use the Azure AI Foundry portal for managing the resource, using playground, or any other feature from the portal.
44
+
43
45
You are using the following assets to create those resources:
44
46
45
47
1. Use the template `modules/ai-services-template.bicep` to describe your Azure AI Services resource:
@@ -54,7 +56,7 @@ You are using the following assets to create those resources:
3. For convenience, we define the model we want to have available in the service using a JSON file. The file [__infra/models.json__](https://github.com/Azure-Samples/azureai-model-inference-bicep/blob/main/infra/models.json) contains a list of JSON object with keys `name`,`version`, `provider`, and `sku`, which defines the models the deployment will provision. Since the models support pay-as-you-go, adding model deployments doesn't incur on extra cost. Modify the file removing/adding the model entries you want to have available. The following example **shows only the first 7 lines** of the JSON file:
59
+
3. For convenience, we define the model we want to have available in the service using a JSON file. The file [__infra/models.json__](https://github.com/Azure-Samples/azureai-model-inference-bicep/blob/main/infra/models.json) contains a list of JSON object with keys `name`,`version`, `provider`, and `sku`, which defines the models the deployment will provision. Since the models support pay-as-you-go, adding model deployments doesn't incur on extra cost. Modify the file by **removing/adding the model entries you want to have available**. The following example **shows only the first 7 lines** of the JSON file:
58
60
59
61
__models.json__
60
62
@@ -118,4 +120,9 @@ In your console, follow these steps:
118
120
--template-file deploy.bicep
119
121
```
120
122
121
-
7. The template outputs the Azure AI model inference endpoint that you can use to consume any of the model deployments you have created.
123
+
7. The template outputs the Azure AI model inference endpoint that you can use to consume any of the model deployments you have created.
124
+
125
+
## Next steps
126
+
127
+
> [!div class="nextstepaction"]
128
+
> [Use the inference endpoint](../../how-to/inference.md)
Reasoning models can reach higher levels of performance in domains like math, coding, science, strategy, and logistics. The way these models produces outputs is by explicitly using chain of thought to explore all possible paths before generating an answer. They verify their answers as they produce them which helps them to arrive to better more accurate conclusions. This means that reasoning models may require less context in prompting in order to produce effective results.
13
+
14
+
Such way of scaling model's performance is referred as *inference compute time* as it trades performance against higher latency and cost. It contrasts to other approaches that scale through *training compute time*.
15
+
16
+
Reasoning models then produce two types of outputs:
17
+
18
+
> [!div class="checklist"]
19
+
> * Reasoning completions
20
+
> * Output completions
21
+
22
+
Both of these completions count towards content generated from the model and hence, towards the token limits and costs associated with the model. Some models may output the reasoning content, like `DeepSeek-R1`. Some others, like `o1`, only outputs the output piece of the completions.
0 commit comments