Boston O365 User Group: OpenAI Solution

I had a great time last month at the Boston Office User Group (video recording can be found here) where we created a Power Virtual Agent Bot that connects to OpenAI’s ChatGPT and Dall-E services, which allows users to chat as well as create images.

Key components of the bot:

  • This bot utilizes OpenAI; it would be fairly easy to replace that with an Azure OpenAI resource by updating the url of the HTTP calls in Power Automate and the authentication method (api-key Header instead of the Authorization / Bearer Header)
  • By default, the Fallback topic is setup to take what a user types and submit it to ChatGPT (the chat capability)
  • Users can type ‘bogimage‘ to switch to the image generation feature
  • At anytime, users can type ‘restart‘ to go back to the chat conversation
  • To keep the solution as close to the presentation as possible, only a few small updates have been made:
    • Small updates to text for more clarification on how to navigate between chat and image capabilities
    • Cleaned up code to determine location of ending comma since it’s not needed because we always at minimum have a system message, and so commas in the history can be added before each additional message

How to Setup Bot:

  1. Create an OpenAI account and a related API Key
  2. Create an Azure Key Vault in your related Azure environment or utilize an existing key vault
    • Create a key called “openaikey” and enter your personal OpenAI api key from above step
    • Ensure the account you’ll be using to import the solution has been added to the key vault with “Key Vault Administrator” role (it’s possible to user a lower level of access if needed but the account you’ll create the connection with below must be able to read the key)
  3. Download the Solution file
  4. Go to your preferred Power Platform environment’s “Solutions” section (
  5. Click “Import Solution” and select the downloaded file from above
  6. When prompted to select or create an Azure Key Vault connection, select “Default Azure AD application for OAuth” and type in the name of your key vault created in step 2 above. Ensure you complete the sign-in process to authorize the connection
  7. After the solution has finished importing, go to your environment’s chatbot environment, find the Bogbot, and begin chatting with your new bot!


Matt Jimison

Microsoft 365 Geek - Husband, father, lover of basketball, football, smoking / grilling, music, movies, video games, and craft beer!

Leave a Reply

Your email address will not be published. Required fields are marked *