I have created a basic Azure ‘Custom Question Answering’ bot (https://learn.microsoft.com/en-us/azure/cognitive-services/language-service/question-answering/quickstart/sdk?pivots=studio). I created the bot through Language Studio:
bot creation through language studio
I want to add authentication so that only users with who are part of my Azure AD are able to interact with the bot. I’ve tried following the tutorials listed below:
- https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-authentication?view=azure-bot-service-4.0&tabs=singletenant%2Caadv2%2Ccsharp
- https://learn.microsoft.com/en-us/microsoftteams/platform/bots/how-to/authentication/add-authentication?tabs=dotnet%2Cdotnet-sample
I’ve not been able to follow these tutorials, as they assume the bot is built from either of the following code bases:
Whereas the bot that I deployed through Language Studio looks like it is built from the following framework:
How can I add authentication to the custom question answering bot I deployed through Azure Language Studio (Cognitive services)? Currently anyone would be bale to interact with my bot.
Thanks
2
Answers
To add authentication, there is a need to install a library supportive with Python Programming.
Add the above library to start authentication process.
Authenticate with Client
Get an API key from Azure Cognitive Services.
To Instantiate QuestioningAnswerClient
For further reference, Check the below link:
https://pypi.org/project/azure-ai-language-questionanswering/
https://learn.microsoft.com/en-us/azure/cognitive-services/authentication?tabs=powershell
Since these are all samples, they’re all designed to do one thing for simplicity’s sake. What you need to do is actually straightforward (in concept, if not always in practice). You should look at the code and docs of the auth samples and integrate the authentication sections with your CQA bot. Alternatively, you could integrate the CQA sections with an auth bot. Regardless of which base you start with, the goal is the same. Combine the two.