PVA Series – User Context in Power Virtual Agent

In my previous post you were able to learn how to authenticate user in Power Virtual Agent. This post is about getting and using context of the authenticated user.

Authentication in PVA

Authentication in PVA is quite simple. It is built out of the below steps basically.

  1. User enters communication with the Bot
  2. Bot display button to log in
  3. User provides credentials
  4. After is logged in, authentication provider (AAD in this case) returns validation code
  5. Validation code, once provided back in a chat window, generates and stores bearer token in the AuthToken variable.
User Context in Power Virtual Agent

Using the user’s context

To use now context of the user in your Power Automate, you have to use obtained bearer token as the authorization method.

Important! Power Automate flows having actions with a defined connection, authorized for different user, will not be executed using the context of the user from bot conversation.

To use context of a user you have to choose actions, that will authenticate on-the-go, for example HTTP (Premium). Then provide the token as the parameter in “Action” calling Power Automate:


And finally use the passed token from PVA as the “Raw” authentication method:

User Context in Power Virtual Agent
HTTP received

In result you will be able (in this example) to call Graph API using context of a user who is authenticated in the conversation with a bot.

User Context in Power Virtual Agent
Try the chatbot

And that’s it. I hope this will help you benefit from calling action with user context and therefore personalize user experience in your Power Virtual Agents conversations.

ESPC call for speakers 2024
About the Author:

I’m Tomasz Poszytek, Microsoft Business Applications MVP. From more than 8 years now I’m being involved in projects, which aim is production of various applications using SharePoint as a platform. My adventure started absolutely without a purpose, when in the beginning of 2000 I was given FrontPage installation disc and started experimenting with this WYSWIG tool.  

Currently I’m focusing on self development in “cloud” area, where I’m trying to get acquainted with Office 365 features and applications. I’m professionally and personally very much interested in automation of processes, digital transformation, digital workplaces and all tools that helps employees in that area.

From more than a year I’m working with the platform for processes automation – Nintex. I’m also the Nintex Certified Partner and Nintex Virtual Technical Evangelist (Nintex vTE).


Poszytek, T. (2020). PVA Series – User Context in Power Virtual Agent. Available at: https://poszytek.eu/en/microsoft-en/office-365-en/pva-en/pva-series-user-context-in-power-virtual-agent/ [Accessed: 10th April 2020].

Find more great Power Platform content here.

Share this on...

Rate this Post: