List all Power Virtual Agents
In this article I am going to show you how to list all Power Virtual Agents in the current environment. I will use a Power Automate flow to create an overview of this.
The original idea comes again from the Power Users community 🙂
Power Virtual Agent Governance – how to get all agents extracted/listed
Power Users Community thread: Power Virtual Agent Governance – how to get all agents extracted/listed.
I was also interested if this was possible. And since I haven’t seen any specific PowerShell cmdlets for this my first attempt was to get the information with a Power Automate flow.
This example will show you how you can list the Power Virtual Agents of your current environment, including their last activity date. This list will be converted into a styled HTML table which will be e-mailed.
The styling comes from Ryan Maclean his great post Power Automate HTML table styling.
The most challenging bit was to find the data. Luckily Microsoft Dataverse is both storing the Power Virtual Agents and the conversations we are having with this Power Virtual Agents.
The flow steps
1. Add the Manually trigger a flow action.
2. Add initialize variable action. Use RowNumber as the name. The type should be integer. The value should be 0.
4. Add a List rows action. Select the Chatbots table. Also sort by name ascending.
5. Add an Apply to each action. Use the value field of the List rows – Chatbots action in the Select an output from previous steps field.
6. Add an Increment Variable action within the Apply to each action. Increment the RowNumber integer with a value of 1.
7. Add a Get a row by ID action within the Apply to each action. Select the Users table for the Table Name field. Use the Owner (Value) in the Row ID field.
8. Add a List rows action within the Apply to each action. Select ConversationTranscripts table in the Table name field. Use a filter on the _bot_conversationtranscriptid_value field. Sort by ConversationStartTime descending. Make sure you only retrieve 1 row.
9. Add an Append to string variable action within the Apply to each action. Use the value below to append to the TableHTML variable.In this action the Bot name is retrieved from the List rows of Chatbots, the name and e-mail address of the owner are retrieved from the Get a Row by ID and the last conversationstarttime row is retrieved from the List rows of ConversationTranscripts.
10. Add an Append to string variable action outside the Apply to each action. Use the value below to append to the TableHTML variable.
11. Add a Send an email (V2) action. Use the TableHTML variable in the body of this e-mail.
The end result