azureopenai-apiazure-webappsazure-openai

Allow anonymous access to my Azure OpenAI chat bot


I have an Azure OpenAI chat bot using my own data (I configured an OpenAI resource and chose Deploy as Web App) . Members of my domain can access it by logging in. Now I want it to be accessible anonymously or for other domains I define - whatever is easier to configure.

In the Azure Web App Authentication settings I could do two things:

See this screenshot:

settings

When I disable authentication or when I allow unauthenticated access I get in both cases the same error message when opening the chat bot:

Authentication Not Configured

I also tried to allow not only my single domain but multiple account types of the Identity Provider. But when I login with a different domain I still the an error messge:

AADSTS50020: User account 'myuser@otherdomain' from identity provider 'https://sts.windows.net/....../' does not exist in tenant 'MyDomain' and cannot access the application 'MyChatBot') in that tenant.

How to do it properly?


Solution

  • Context

    You have to understand that the "Deploy to Web App" button in Azure OpenAI Studio is only an accelerator for the "all-in-one" deployment of a project which is in fact open-sourced by Microsoft.

    It's this one: https://github.com/microsoft/sample-app-aoai-chatGPT

    So the Authentication Not Configured message you are facing is implemented inside this project, here: https://github.com/microsoft/sample-app-aoai-chatGPT/blob/af9d06b4ba153523fed366d3f8b1b19d1fc5f5e8/frontend/src/pages/chat/Chat.tsx#L573

    Possible solution

    The README of the project explains that you can remove it if you want, here

    To remove this restriction, you can add AUTH_ENABLED=False to the environment variables. This will disable authentication and allow anyone to access the chat functionality of your app. This is not recommended for production apps.
    

    As said, "This is not recommended for production apps.".

    Especially as the frontend is calling itself for the conversation (POST to /conversation) so if you remove the authentication, I guess that someone could use this endpoint directly to consume your OpenAI resource which is behind (ok, they can't modify your system message etc. but it's still an issue)