For some reason, I got hooked up on the custom connectors for the time being. It’s a bit of a learning curve for somebody who has not been doing a lot of development outside of the plugins/scripts/occasional .NET for a while, so, if nothing else, it’s a good exercise in re-building at least some of those development skills.
Interestingly, the learning here is not focused on the development only. Custom connectors are closely tied to PowerPlatform, and, besides, my Web API has to be hosted somewhere, so this involves building a Web API, but this also involves figuring out how to host it in Azure (in my case), and how to set up a connector in PowerPlatform.
Hence, in no particular order, here are some of the observations so far.
1. Creating a web API in the Visual Studio is very straightforward
Once you have a project, you may want to remove everything other than the Post method, and you may also want to update the route:
Then you just need to publish it somewhere, and, of course, publishing to Azure is easy:
You may want to look at the more detailed tutorial here, though:
2. Creating a swagger file (or OpenAPI file) is more involved
That file is, really, just a description of your API. While creating a custom connector in PowerAutomate/PowerApps, you can feed that file to the custom connector “wizard”, it will parse it, and you won’t have to do a thing manually at that point.
But, of course, you may actually want to create that file AFTER you have an API. Or you may even want to generate it automatically.
This is where a couple of tools might help.
a) The post below provides instructions on how to generate swagger files for your web api projects
However, once the file was generated, I still could not use it to create a custom connector since some of the information was missing from the file
b) Swagger editor might help at that point
I added a few tags to my files (“host”, “basePath”, “schemes”, “consumes”, “produces”). Not sure all of them would be required, but pretty sure PowerPlatform expects at least the “host” information to be there (since that’s where I was getting an error).
3. Enabling authentication for your web api (in Azure)
This turned out to be a more complicated story for some reason, and I’m still trying to figure it out. Web API would be hosted as an app service, and it was not that complicated to enable authentication there. What has proven to be more challenging is setting it up so that users from other Azure tenants could use my web api.
Firsrt of all, that requires a custom domain. And, if there is a custom domain, it needs an SSL. And, if there is an SSL, I need a more expensive app service hosting plan. But, even once I had done all of that, I was still getting an error when trying to utilize my Web API with an account from another tenant, since, somehow, I was still required to add that user as a guest first. Anyway, that’s the bulk of it, and, it seems I’ll need to get back to the authentication part.
For now, there is no authentication on my web api.
4. It’s the second time when I’m observing errors in make.powerapps.com while flows.powerapps.com is working fine
It happened with the UI Flows before: https://www.itaintboring.com/power-platform/ui-flow-in-power-automate-former-microsoft-flow/
And it also happened this time when I was trying to update my custom connector. Turned out there is a related recent community thread, so, it seems, it’s just my luck that I’ve started working with custom connectors just about the same time when this problem was reported: https://powerusers.microsoft.com/t5/Building-Power-Apps-Formerly/Can-t-update-or-create-a-custom-connector/td-p/428162
Anyway, in my case switching to canada.flow.microsoft.com has helped in both situations.
5. While in the “test” mode, custom connectors don’t seem to recognize arrays
There is an array parameter in my connector. It works fine when using “raw body” option to adjust json:
However, once in the “regular” mode, there seem to be no way to turn that parameter into an array – it would only accept one element no matter what:
Still, when using that connector in the actual Flow, I can set up an array:
And I can pass that array through the action parameter:
Either way, so far web api source code is on github:
There is a related swagger file you can use to create a custom connector in PowerPlatform:
The API is hosted in Azure on a shared plan – you can try it, but don’t expect much in terms of uptime/reliability:
Both methods will expect a post request.
Regex is, well, regex. More details here: https://www.itaintboring.com/dynamics-crm/custom-connector-where-powerautomate-finds-peace-with-logic-apps/
The other one (addbusinessdays) will take the starting date, an array of holidays (see screenshots above), and the number of business days to add to the starting date. It will, then, add those days to the starting date having accounted for Saturdays, Sundays, and all the holidays on the list.