Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Note
This document refers to the Microsoft Foundry (classic) portal.
🔍 View the Microsoft Foundry (new) documentation to learn about the new portal.
Azure Policy provides built-in policy definitions that help you govern the deployment of AI models in Managed Foundry Tools (serverless API deployment) and Model-as-a-Platform (MaaP). Use these policies to control what models your developers can deploy in Microsoft Foundry portal.
Tip
The steps in this article govern the deployment of MaaS and MaaP models for both a Foundry project and hub-based project.
Prerequisites
- An Azure account with an active subscription. If you don't have one, create a free Azure account, which includes a free trial subscription.
- Permissions to create and assign policies. To create and assign policies, you must be an Owner or Resource Policy Contributor at the Azure subscription or resource group level.
- Familiarity with Azure Policy. To learn more, see What is Azure Policy?.
- Azure CLI and the Bicep CLI installed.
Enable the policy
You can assign the policy using Bicep or the Azure portal.
Use the following Bicep template to assign the policy to a resource group. This example allows only the gpt-35-turbo model from the azure-openai registry.
Save the following code as
main.bicep.targetScope = 'resourceGroup' param policyAssignmentName string = 'allowed-models-assignment' param allowedModelPublishers array = [] param allowedAssetIds array = [ 'azureml://registries/azure-openai/models/gpt-35-turbo/versions/3' ] // Policy Definition ID for "[Preview]: Azure Machine Learning Deployments should only use approved Registry Models" var policyDefinitionId = '/providers/Microsoft.Authorization/policyDefinitions/12e5dd16-d201-47ff-849b-8454061c293d' resource policyAssignment 'Microsoft.Authorization/policyAssignments@2024-04-01' = { name: policyAssignmentName properties: { policyDefinitionId: policyDefinitionId parameters: { allowedModelPublishers: { value: allowedModelPublishers } allowedAssetIds: { value: allowedAssetIds } } displayName: 'Allow specific AI models' description: 'This policy assignment restricts AI model deployments to the specified list.' } }Deploy the Bicep file using the Azure CLI.
az deployment group create --resource-group <your-resource-group> --template-file main.bicepReplace
<your-resource-group>with the name of your resource group.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.
- 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.
Monitor compliance
To monitor compliance with the policy, follow these steps:
- From the Azure portal, 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.
- 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.
Update the policy assignment
To update an existing policy assignment with new models, follow these steps:
- From the Azure portal, 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.
- From the left side of the Azure Policy Dashboard, select Assignments and find the existing policy assignment. Select the ellipsis (...) next to the assignment and select Edit assignment.
- From the Parameters tab, update the Allowed models parameter with the new model IDs.
- From the Review + Save tab, select Save to update the policy assignment.
Best practices
- 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.
- 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.
- Documentation: Keep records of policy assignments and configurations for auditing purposes. Document any changes made to the policy over time.
- Regular reviews: Periodically review policy assignments to ensure they align with your organization's requirements.
- Testing: Test policies in a nonproduction environment before applying them to production resources.
- Communication: Make sure developers are aware of the policies in place and understand the implications for their work.