sample-app-aoai-chatGPT icon indicating copy to clipboard operation
sample-app-aoai-chatGPT copied to clipboard

[feature] Adding RBAC use for Azure OpenAI calls (as already done for Cosmos)

Open nrobert opened this issue 1 year ago • 1 comments

The current solution should allow using Azure services with both options: key or RBAC.

It has been partly done:

  • for CosmosDB, you can use key (AZURE_COSMOSDB_ACCOUNT_KEY setting) or it will fallback with DefaultAzureCredential() if not provided (see here: https://github.com/microsoft/sample-app-aoai-chatGPT/blob/654953b63eb693aa2ca7d72c146c1e2e7b53e555/app.py#L134)
  • for Azure OpenAI, RBAC setup has been implemented in the infra folder (see bicep file here: https://github.com/microsoft/sample-app-aoai-chatGPT/blob/654953b63eb693aa2ca7d72c146c1e2e7b53e555/infra/main.bicep#L254) but it is not used in the main code

This pull request adds the same behavior as for CosmosDB:

  • if the Azure OpenAI key setting (AZURE_OPENAI_KEY) has a value, it will be used
  • else, it will try to use DefaultAzureCredential()

nrobert avatar Jan 25 '24 22:01 nrobert

Hi @sarah-widder and @iseabock ,

I hope this pull request will be helpful to add features to this great sample. Can you confirm that you don't need additional details to be able to validate / merge this PR?

Thanks

Nicolas R. Microsoft AI MVP

nrobert avatar Jan 29 '24 21:01 nrobert

Closing it, as this feature has been implemented in another PR

nrobert avatar Feb 02 '24 19:02 nrobert