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
### Options for credential when using Microsoft Entra ID
2
+
3
+
`DefaultAzureCredential` is an opinionated, ordered sequence of mechanisms for authenticating to Microsoft Entra ID. Each authentication mechanism is a class derived from the `TokenCredential` class and is known as a credential. At runtime, `DefaultAzureCredential` attempts to authenticate using the first credential. If that credential fails to acquire an access token, the next credential in the sequence is attempted, and so on, until an access token is successfully obtained. In this way, your app can use different credentials in different environments without writing environment-specific code.
4
+
5
+
When the preceding code runs on your local development workstation, it looks in the environment variables for an application service principal or at locally installed developer tools, such as Visual Studio, for a set of developer credentials. Either approach can be used to authenticate the app to Azure resources during local development.
6
+
7
+
When deployed to Azure, this same code can also authenticate your app to other Azure resources. `DefaultAzureCredential` can retrieve environment settings and managed identity configurations to authenticate to other services automatically.
8
+
9
+
### Best practices
10
+
11
+
* Use deterministic credentials in production environments: Strongly consider moving from `DefaultAzureCredential` to one of the following deterministic solutions on production environments:
12
+
13
+
* A specific `TokenCredential` implementation, such as `ManagedIdentityCredential`. See the [Derived list for options](/dotnet/api/azure.core.tokencredential#definition).
14
+
* A pared-down `ChainedTokenCredential` implementation optimized for the Azure environment in which your app runs. `ChainedTokenCredential` essentially creates a specific allow-list of acceptable credential options, such as `ManagedIdentity` for production and `VisualStudioCredential` for development.
15
+
16
+
* If your application in running on Azure, configure system-assigned or user-assigned managed identities to the resources where your code is running and configure Microsoft Entra ID access to those specific identities.
Copy file name to clipboardExpand all lines: articles/ai-foundry/model-inference/includes/configure-entra-id/bicep.md
+16-1Lines changed: 16 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -89,4 +89,19 @@ In your console, follow these steps:
89
89
--template-file deploy-entra-id.bicep
90
90
```
91
91
92
-
7. The template outputs the Azure AI model inference endpoint that you can use to consume any of the model deployments you have created.
92
+
7. The template outputs the Azure AI model inference endpoint that you can use to consume any of the model deployments you have created.
93
+
94
+
95
+
## Use Microsoft Entra ID in your code
96
+
97
+
Once you configured Microsoft Entra ID in your resource, you need to update your code to use it when consuming the inference endpoint. The following example shows how to use a chat completions model:
## Disable key-based authentication in the resource
106
+
107
+
Disabling key-based authentication is advisable when you implemented Microsoft Entra ID and fully addressed compatibility or fallback concerns in all the applications that consume the service.
Copy file name to clipboardExpand all lines: articles/ai-foundry/model-inference/includes/configure-entra-id/cli.md
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,19 +53,19 @@ Follow these steps to configure Microsoft Entra ID for inference in you Azure AI
53
53
54
54
5. Get the object ID of the security principal you want to assign permissions to. The following example shows how to get the object ID associated with:
55
55
56
-
__Your own logged in account__
56
+
__Your own logged in account:__
57
57
58
58
```azurecli
59
59
OBJECT_ID=$(az ad signed-in-user show --query id --output tsv)
60
60
```
61
61
62
-
__A security group__
62
+
__A security group:__
63
63
64
64
```azurecli
65
65
OBJECT_ID=$(az ad group show --group "<group-name>" --query id --output tsv)
66
66
```
67
67
68
-
__A service principal__
68
+
__A service principal:__
69
69
70
70
```azurecli
71
71
OBJECT_ID=$(az ad sp show --id "<service-principal-guid>" --query id --output tsv)
@@ -87,4 +87,6 @@ Follow these steps to configure Microsoft Entra ID for inference in you Azure AI
87
87
88
88
Once Microsoft Entra ID has been configured in your resource, you need to update your code to use it when consuming the inference endpoint. The following example shows how to use a chat completions model:
Models deployed to Azure AI model inference in Azure AI Services support key-less authorization using Microsoft Entra ID. It enhances security, simplifies the user experience, reduces operational complexity, and provides robust compliance support for modern development. It makes it a strong choice for organizations adopting secure and scalable identity management solutions. You can configure Microsoft Entra ID authorization in the resource and, optionally, **disable key-based authentication** to prevent any user to still use keys to access the service.
3
+
Models deployed to Azure AI model inference in Azure AI Services support key-less authorization using Microsoft Entra ID. Key-less authorization enhances security, simplifies the user experience, reduces operational complexity, and provides robust compliance support for modern development. It makes it a strong choice for organizations adopting secure and scalable identity management solutions.
4
4
5
5
This article explains how to configure Microsoft Entra ID for inference in Azure AI model inference.
6
6
@@ -12,8 +12,9 @@ When you assign a role, you specify the security principal, the role definition,
12
12
13
13
You identify two different types of access to the resources:
14
14
15
-
***Administration access**: The actions that are related with the administration of the resources. They usually change the state of the resource and its configuration. In Azure, those operations are control-plane operations and can be executed using the Azure portal, the Azure CLI, or with infrastructure as code. Examples of includes creating a new model deployments, changing content filtering configurations, changing the version of the model served, or changing SKU of a deployment.
16
-
***Developer access**: The actions that are related with the consumption of the resources. They consumes the capabilities of the resource. For example, invoking the chat completions API. However, the user can't change the state of the resource and its configuration.
15
+
***Administration access**: The actions that are related with the administration of the resource. They usually change the state of the resource and its configuration. In Azure, those operations are control-plane operations and can be executed using the Azure portal, the Azure CLI, or with infrastructure as code. Examples of includes creating a new model deployments, changing content filtering configurations, changing the version of the model served, or changing SKU of a deployment.
16
+
17
+
***Developer access**: The actions that are related with the consumption of the resources. For example, invoking the chat completions API. However, the user can't change the state of the resource and its configuration.
17
18
18
19
In Azure, administration operations are always performed using Microsoft Entra ID. Roles like **Cognitive Services Contributor** allow you to perform those operations. On the other hand, developer operations can be performed using either access keys or/and Microsoft Entra ID. Roles like **Cognitive Services User** allow you to perform those operations.
19
20
@@ -30,4 +31,10 @@ To complete this article, you need:
30
31
31
32
* An Azure AI services resource. For more information, see [Create an Azure AI Services resource](/articles/ai-foundry/model-inference/how-to/quickstart-create-resources).
32
33
33
-
* Administrator roles for the scope of the Azure AI Services resource or the resource group.
34
+
* An account with `Microsoft.Authorization/roleAssignments/write` and `Microsoft.Authorization/roleAssignments/delete` permissions, such as the **Administrator** role-based access control.
35
+
36
+
* To assign a role, you must specify three elements:
37
+
38
+
* Security principal: e.g. your user account.
39
+
* Role definition: the *Cognitive Services User* role.
Even when your resource has Microsoft Entra ID configured, your projects may still be using keys to consume predictions from the resource. To change this behavior, you have to update the connections from your projects to use Microsoft Entra ID. Follow these steps:
62
+
Even when your resource has Microsoft Entra ID configured, your projects may still be using keys to consume predictions from the resource. When using the Azure AI Foundry playground, the credentials associated with the connection your project has are used.
63
+
64
+
To change this behavior, you have to update the connections from your projects to use Microsoft Entra ID. Follow these steps:
62
65
63
66
1. Go to [Azure AI Foundry portal](https://ai.azure.com).
0 commit comments