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.
Original request
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.
Microsoft Dataverse
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.
For listing the Power Virtual Agents you can use the bot table.If you want to find information about the conversations you can use the conversationtranscript table.
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.
3. Add another initialize variable action. Use TableHTML as the name. The type should be string. You can use the HTML from below as a value.
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
When you run the flow you should get a result like below. As you can see you will have an overview of your Power Virtual Agents.
Happy testing!
Hey Mr Power Automate!
good busy with all your M$ Posts!
do you happen to know that when you work in the Power Automate environment that the UI/designer is in one language (language) and other parts in another (dutch)?
E.g. my interface is in English but l the selectable power actions are in Dutch.
For me the dataverse users table is Gebruikers 🙂
Anyways keep up the good work!
greetings,
Yours sincerely,
Bart