Scale Power Automate Desktop (PAD) using multiple Machines
Whether you should use Power Automate Desktop or not has been described by my colleague in the community Reza Dorrani in his excellent video about this topic (https://www.youtube.com/watch?v=z19CAWq1tK8).
However, since the practical application of this topic is relatively rare we cannot cover all uses cases. So we will show how to scale a small solution to multiple machines. One thing in advance: The solution shown here should only be used as a last "resort" if you can't or don't want to replace the corresponding solution with a newer application that has an API (e.g. due to budget restrictions).
Power Automate Desktop (PAD), at least in the context of Power Automate cloud flows, is a bridging technology for applications without API. It does this very well, without question. However, it should by no means be seen as a long-term solution. A clearly better solution is to scrap the old software and replace it with a modern solution, for example based on the Power Platform. But anyways, lets go now. Keep in mind the following scenario is very much simplified to keep this article within reading span of most people.
In the following scenario we have a VM with Power Automate Desktop and a corresponding flow. Next to it we have a second VM on which nothing else is currently happening:
In our use case, to keep the example simple, we have an Excel file that stores contact information. Two flows exist for this purpose: 1x a Power Automate Desktop flow that fetches the data from the Excel file and 1x a cloudflow that checks if there is a duplicate when creating a contact. So far so good:
When the users enters a name which is in the Excelfile s/he gets flag telling her/him that this user might be a duplicate. However, this solution is not so good for two main reasons:
- If the mentioned VM has unplanned downtime, the described mechanism is not available and the cloudflow would time out.
- This approach also has disadvantages with a high workload, i.e. many users creating contacts. There may be long waiting times.
To prevent such problems, Microsoft offers the possibility to combine several VMs in a machine group. How this works is shown in the following steps. What we need to do is:
- Start a new VM (this we have already done)
- Install PAD, launch the portal and add the new VM to the machine group
- Update cloud flow connection if needed
To go one, first thing is create a new machine group:
Once you have created a machine group, or you already had one, you can go to step 2 (installing PAD and launching the portal). How to get PAD is described by an in detail MS Learn article: https://learn.microsoft.com/en-us/power-automate/desktop-flows/install . After installation is done you can log in with your account to the Power Automate Desktop Portal on the second VM. Here you should see something like this:
At this point the password of the Machine Group has to be entered, i.e. not the password of the admin account of the Power Platform or the local admin. The password of the Machine Group can be set as often as you like. So last we need to change the connection of the Cloud Flow to the connection of the Machine Group. This is done so that the Cloud Flow can also use the full power of the, now two, machines. For starters I would advise you to go to make.powerautomate.com which is the cloud portal for all power automate related activities. There you have more options than in the classical power platform portal:
So now you need to open your cloud flow and update the connection to the machine group instead of the single machine. You click on the three dots of the action and select "New connection reference", then you should see something like this:
It is recommended to login at every machine inside your machine group with the same user. Most solutions that are displayed in the internet recommend this. This makes it easier giving the connection one username and one password. For simplicity I just use my personal user, but in practice you would create an AAD Admin user that has admin rights on all the machines.
Once you are done, you should see something like this:
Once all this is done you should make sure to log in to all the machines you want to us, or if you run your flows in unattended mode you have to log out. Now its time to test the machine group. To do that I will create multiple contacts shortly after another, knowing that the flow will take a while to start PAD, read the excel file, give results back and loop over it to check the results:
Now there is only one thing left to do. We want to check if the flows are really executed on different VMs. To check this we first need the "hostnames" of the two machines. This can be displayed on every Windows with the command "hostname". In my case the first hostname ends with: (...) VMPA and the second one ends on (...) U0Q4.
Now we have to check where the flow run was executed. For this we open a flow run and click on the details of the connector:
After this you should see a screen like the following:
So lets check out another run now:
If you made it that far & could reproduce: congratulations! Now you are ready to scale as many VMs as you want using Power Automate Desktop using machine groups. This piece was only a glimpse of things you can/should do. Stuff like automatic checks if your machines are running, and respective actions if not, would have been too much for such a piece. If you are interested in such content comment below and we might publish it in the future (using Power Automate of course :-)
Add new comment