Azure OpenAI Assistance for Power Virtual Agents
Published Apr 27 2023 10:56 AM 5,002 Views

Recently Greg Beaumont posted to the HLS Tech Community blog Azure OpenAI ChatGPT Solves Cryptic Error Codes from Power BI, SQL Server, Power Apps, and more!. He highlighted in the post (and video) some advantageous ways to leverage Azure OpenAI’s Chat GPT playground to respond to odd error codes. He asked at the end of the post about enabling this through a Power App, bot, or something else.

Challenge accepted!Challenge accepted!


I had a few ideas come to mind, but from a user experience perspective, a bot seemed to be the most approachable for end users to interact with. I may experiment with other interfaces, but I picked chat because:

  • It’s familiar to people who have used general ChatGPT directly
  • It is easy to securely expose through Teams and other channels
  • Power Virtual Agents (PVA) offers the ability to have curated responses to specific questions, before falling back to ChatGPT

Read on to find out:

  • The approach to combine these capabilities
  • How to get the sample solution GitHub


The approach

I chatted with Greg to land on a specific use case to target for the bot, which guided the system message portion of the prompt: You are an AI chatbot in charge of helping people solve error messages for Microsoft tools such as SQL Server, SharePoint, Teams, Power BI, Power Apps, Power Automate, the Office suite, and Azure.


In PVA, I leveraged the Fallback topic (which is used when an authored/AI-assisted topic isn’t relevant) to call Azure OpenAI.


Screenshot of the Power Virtual Agent calling Azure OpenAIScreenshot of the Power Virtual Agent calling Azure OpenAI


To do this, I utilized the out of the box Power Platform automation capability (Power Automate cloud flow). The user’s message is passed in, along with chat history (for context) and the system message.


Screenshot of the underlying workflow steps in Power AutomateScreenshot of the underlying workflow steps in Power Automate


The flow processes builds a message body, uses an HTTPS call to Azure OpenAI, and parses the relevant portions of the response, which are passed back to PVA.


The Power Virtual Agents authoring canvas displaying the Azure OpenAI Chat responseThe Power Virtual Agents authoring canvas displaying the Azure OpenAI Chat response


Finally, PVA responds to the user and updates the chat history. The latter is helpful when they have a follow-up question, making the conversation more natural.

Sample solution available on GitHub

I posted a zipped solution and the raw source to GitHub:


mathyousee/power-platform-chatGPT: Samples for using ChatGPT with the Power Platform (


In the repository are the assets along with instructions for deploying to your own development environment. The process is only a few short steps.


Final thoughts

Those familiar with PVA may be aware of several AI-powered features, like the Conversation Boost, Topic Copilot, language understanding, and others. It wouldn’t be surprising to see the solution described above become more of a native feature, but until it does this is a nice low-barrier way to bridge the gap.


I love how quickly these solutions can come together “in the wild” and start providing context-specific assistance. So what do you think should be next? Should I try Greg’s other idea of a Power App? Something else? Let me know!

1 Comment
Version history
Last update:
‎Apr 27 2023 10:56 AM
Updated by: