Copilot for Power Automate
Tags: development, githubcopilot, flow, powerautomate
Published: 2024-01-25 20:25:15

---
title: Copilot for Power Automate
published: true
date: 2023-11-29 15:00:00 UTC
tags: Development,Copilot,flow,PowerAutomate
canonical_url: https://barretblake.dev/2023/11/copilot-for-power-automate/?utm_source=rss&utm_medium=rss&utm_campaign=copilot-for-power-automate
---

Tis the season of copilots! Everybody gets a copilot!

![Multiethnic team of pilots using control panel in cockpit to fly airplane, pushing power switch and dashboard command buttons to takeoff. International airways service with aircrew in cabin.](https://barretblake.dev/wp-content/uploads/2023/11/multiethnic-team-pilots-using-control-panel-cockpit-fly-airplane-pushing-power-switch-dashboard-command-buttons-takeoff-international-airways-service-with-aircrew-cabin-1024x683.jpg)
_Image by DCStudio on Freepik_

No, not that kind of copilot. I’m talking about the kind of copilot that runs off of AI and helps you to do some kind of task. You know, all the copilots that Microsoft has recently announced that are getting added to literally EVERYTHING.

#### ANNOUNCING: Naughty list copilot for Santa Claus!!

![Santa Claus using Microsoft copilot on his computer to check his naughty and nice list](https://barretblake.dev/wp-content/uploads/2023/11/123a82ef-4d7a-47da-8f6c-ac35e1837353.jpg)
_Santa image generated by Bing Image Creator_

See, even Santa is getting his own copilot. Hey, it could happen. Microsoft has released far weirder products over the years.

What I want to delve in to this time around is copilot for Power Automate. It’s been fully available for a couple months now and we’ve had some time to really play around with it and see just what it’s capable of doing.

## GENERATING FLOWS

Copilot provides a couple of capabilities to you. The first and most obvious capability is that it can create a starting flow based on a scenario you provide to it. Let’s start with an example. I’ll enter the following prompt into the copilot window:

> Create a flow that runs every day at 10 am to check a OneDrive folder for new Excel files and import their data into a SQL Server database

Copilot will think for a minute or two and then it spits out the following suggest flow:

![Sample Power Automate flow showing several steps as described in next paragraph](https://barretblake.dev/wp-content/uploads/2023/11/SampleFlow1.png)

As we can see from this image, it has created a flow that runs on a schedule, lists the files in a folder, iterates through each, checks if it’s an Excel spreadsheet, gets the data from the table in the spreadsheet, and inserts it into a SQL Server database. All of the needed actions are there, including the flow control actions for iteration. All you need to do, is check through each action and add a little configuration to make it work.

Power Automate was already capable of making your life much easier. Copilot for Power Automate, makes it even better.

Let’s look at another example. In this scenario, I want to:

> Create a flow that runs when I receive a new email, checks that email for attachments and saves those attachments to my OneDrive folder

![Power Automate flow suggestion showing 3 steps: A trigger, a for-each loop and a create file step in the loop](https://barretblake.dev/wp-content/uploads/2023/11/SampleFlow2-FirstPass.png)

Here you can see it’s a simple flow. When a new email arrives, it saves each of the attachments. But what if I’m not happy with the suggested offering. Copilot provides you with a “Show a different suggestion” button below the generated output. If I click that, it gives me a little bit different version.

![A Power Automate flow suggestion showing the same as the previous image with added condition before the for-each](https://barretblake.dev/wp-content/uploads/2023/11/SampleFlow2-SecondPass-1024x790.png)

This version has added a condition, letting me check something before deciding to save the files. Oh, yeah, I only wanted to save files if the email came from a certain person. Sometimes copilot can suggest things you hadn’t thought of. That may or may not be of help to you.

You can also see that at the bottom there’s now a pager control that will let you go back and forth between the various versions.

Another thing to note. At the top of the suggested flow page, you will see a textbox with your current prompt already in it. Here, you can change your prompt to something else if you’re not happy with the suggestions you’re getting. We only want to save files if they are .ZIP files, so let’s add that to our prompt.

> Create a flow that runs when I receive a new email from a certain email address, checks that email for attachments and saves those attachments to my OneDrive folder if they are .ZIP files

![A power Automate flow suggestion similar to the first version, except a condition has been added inside the loop to check for file type](https://barretblake.dev/wp-content/uploads/2023/11/SampleFlow2-ThirdPass.png)

We see here that it has added a condition that will let use check the file extension before deciding to save the file. Note one important thing. If you change the prompt, you can’t go back and select previous versions of the flow. You can always change the prompt back to what it was (if you remember your wording) and it will probably generate the same version as previously, but not always. Sometimes it does provide different suggestions. Something important to keep in mind.

Your prompts can get pretty detailed, and copilot will do its best to create a flow from that prompt. Let’s look at another example:

> A daily flow that runs at 11:30 AM Eastern time and gets all the new records in a SQL Server table from the previous 24 hours, copies them to a SharePoint list, checks them against a second SharePoint list for duplicates, and then creates a record in the Dataverse customers table.

This produced the following suggested flow.

![A Power Automate flow suggestion that tries to accomplish what the prompt suggests, but which is not quite right
](https://barretblake.dev/wp-content/uploads/2023/11/SampleFlow3-877x1024.png)

Logically, in your head, you can see what that prompt is trying to accomplish. The flow that copilot suggests… not so much. That’s not to say the generated flow is a waste. It’s not. A lot of the grunt work has been taken care of by setting up the data retrieval and loops. But it doesn’t quite get the point of checking for duplication and it’s adding a SharePoint record in the wrong place. With a few changes, this suggested flow could accomplish what we’re trying to achieve and we’ve still saved a bit of time.

What I’ve found is that the more complicated your prompt, the more you’ll need to scrutinize the result to make sure it actually does what you’re trying to accomplish. More often than not, it gets things right, or pretty close. It’s only been on a couple of occasions that I’ve seen it go completely off the rails and generate something that was utterly useless.

## ASKING ABOUT EXISTING FLOWS

The second feature of copilot I want to touch on is that it can help you understand an existing flow. Let’s take an example flow that I have in place that runs daily and picks a random row from an Excel spreadsheet table and generates a LinkedIn post for that record.

![Power Automate interface with example did you know flow in edit mode and copilot window on the right](https://barretblake.dev/wp-content/uploads/2023/11/DidYouKnowOriginal-1024x734.png)

As you can see, when you open an existing flow in the editor now, by default you get a sidebar open for copilot interaction (If the sidebar isn’t showing, you can click the “Copilot” button at the top right to show it). Here you can ask a question about the flow in general or about a specific action in that flow. Let’s ask it to summarize the flow first.

> “What does this flow do?”

![Copilot prompt asking what the flow does and flow summarizing in response
](https://barretblake.dev/wp-content/uploads/2023/11/DidYouKnow-WhatDoesItDo.png)

Copilot has summarized the flow in much the same way I did above. In fact, it included a detail I left out: that it updates the Excel table record to indicate the last time a row was used for a post. Because my ListRows steps grabs only the 300 oldest records out of roughly 1100 rows, that helps make sure I’m not duplicating posts too quickly.

You can also ask about specific steps in your flow.

![Copilot prompt asking what specific step does and the response](https://barretblake.dev/wp-content/uploads/2023/11/DidYouKnow-Postanarticle.png)

Here you can see it providing details on a specific step. While this can occasionally be useful, I tend to find it’s easier to just open the details of that specific step and see for myself than it is to type out “What does the X step do?” in the text box. But the capability is there. And if it’s a type of action you’re not familiar with, it can sometimes provide some useful insights that aren’t obvious from the configuration details of the step.

## UPDATING AN EXISTING FLOW

The next feature I want to touch on is updating an existing flow. Here in lies one of copilot’s flaws. Let’s say I want to update my flow to also make a post to Twitter after it posts to LinkedIn. You’re supposed to be able to enter a prompt like:

![Copilot prompt asking to add an action to the flow. Instead of updating the flow, copilot explains how to add the step](https://barretblake.dev/wp-content/uploads/2023/11/DidYouKnow-AddAnAction.png)

It’s supposed to actually add the action to the flow you are editing. Instead, it provides instructions on how you can add the action. 9 times out of 10, this is the response I get instead of it actually editing my flow. I’m not sure what’s going on here, but clearly there’s an issue that needs addressed.

## GENERAL QUESTIONS

The last capability I want to touch on is that you can ask copilot questions that aren’t directly related to the flow you’re editing or about creating a new flow. For instance, you can ask “How do I create a custom connector” or “How many AI Builder credits do I have?”

It can’t always give you a direct answer. For instance, copilot doesn’t have access to your account information, so it can’t actually answer a question like “How many AI Builder credits do I have?”. What it can do is tell you where to find the answer. In this case:

![Copilot prompt asking question on credits and the response](https://barretblake.dev/wp-content/uploads/2023/11/AIBuilderCredits.png)

It’s a good security feature, but still provides you with a helpful answer. And that’s a good thing.

## CONCLUSION

Copilot for Power Automate is amazingly useful. It takes a product that is already a tremendous productivity booster and makes it even more efficient. It’s not without its flaws, but it continues to improve and will only get better over time.

The post [Copilot for Power Automate](https://barretblake.dev/2023/11/copilot-for-power-automate/) first appeared on [Barret Codes](https://barretblake.dev).