Skip to content

Commit ff0f51f

Browse files
committed
Add docs for managed identity settings in the AOAI sample webapp
1 parent 6c77ed0 commit ff0f51f

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

articles/ai-services/openai/how-to/use-web-app.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,53 @@ After you turn on chat history, your users can show and hide it in the upper-rig
8484

8585
Deleting your web app does not delete your Cosmos DB instance automatically. To delete your Cosmos DB instance along with all stored chats, you need to go to the associated resource in the [Azure portal](https://portal.azure.com) and delete it. If you delete the Cosmos DB resource but keep the chat history option turned on in the studio, your users are notified of a connection error but can continue to use the web app without access to the chat history.
8686

87+
## Enabling Entra ID authentication between services
88+
89+
To enable Entra ID for intra-service authentication for your web app, please follow these steps.
90+
91+
### Enable managed identity on your Azure OpenAI resource and Azure App Service
92+
93+
You can enable managed identity for the Azure OpenAI resource and the Azure App Service by navigating to "Identity" and turning on the system assigned managed identity in the Azure Portal for each resource.
94+
95+
96+
![Screenshot that shows the application identity configuration in the Azure Portal](../media/use-your-data/openai-managed-identity.png)
97+
98+
Note: If you are using an embedding model deployed to the same resource used for inference, you only need to enable managed identity on one Azure OpenAI resource. If using an embedding model on a different resource from the one used for inference, you will also need to enable managed identity on the Azure OpenAI resource used to deploy your embedding model as well.
99+
100+
### Enable role-based access control on your Azure Search resource (optional)
101+
102+
If using On Your Data with Azure Search you should follow this step.
103+
104+
To enable authentication to an Azure Search resource, you will need to enable role-based access control on the resource. See the documentation [here](https://learn.microsoft.com/en-us/azure/search/search-security-enable-roles?tabs=config-svc-portal%2Cdisable-keys-portal) for detailed instructions.
105+
106+
### Assign RBAC roles to enable intra-service communication
107+
108+
The following table summarizes the RBAC role assignments needed for the Azure OpenAI resource used for inference, the Azure OpenAI resource used for embeddings (if using a separate resource for this purpose), Azure Search resource (if using) and the Azure App Service.
109+
110+
| Role | Assignee | Resource |
111+
| -------------------------------- | ------------------------ | ------------------------- |
112+
| `Search Index Data Reader` | Azure OpenAI (Inference) | Azure AI Search |
113+
| `Search Service Contributor` | Azure OpenAI (Inference) | Azure AI Search |
114+
| `Cognitive Services OpenAI User` | Web app | Azure OpenAI (Inference) |
115+
| `Cognitive Services OpenAI User` | Azure OpenAI (Inference) | Azure OpenAI (Embeddings) |
116+
117+
To assign these roles, follow the documentation [here](https://learn.microsoft.com/en-us/azure/role-based-access-control/role-assignments-portal) to create the needed role assignments.
118+
119+
### App Settings Changes
120+
121+
In the webapp application settings, navigate to "Environment Variables" and make the following changes:
122+
123+
* Remove the environment variable `AZURE_OPENAI_KEY`, as it is no longer needed.
124+
* If using On Your Data with Azure Search and are using Entra ID authentication between Azure OpenAI and Azure Search, you should also delete the `AZURE_SEARCH_KEY` environment variables for the data source access keys as well.
125+
126+
If using an embedding model deployed to the same resource as your model used for inference, there are no additional settings changes required.
127+
128+
However, if you're using an embedding model deployed to the same resource, please make the following additional changes to your app's environment variables:
129+
* Set `AZURE_OPENAI_EMBEDDING_ENDPOINT` variable to the full API path of the embedding API, e.g. `https://<your AOAI resource name>.openai.azure.com/openai/deployments/<your embedding deployment name>/embeddings?api-version=2023-03-15-preview`
130+
* Delete the `AZURE_OPENAI_EMBEDDING_KEY` variable to use Entra ID authentication.
131+
132+
Once all of the environment variable changes are completed, restart the webapp to begin using Entra ID authentication between services in the webapp.
133+
87134
## Related content
88135

89136
- [Prompt engineering](../concepts/prompt-engineering.md)

0 commit comments

Comments
 (0)