I'm using PowerAutomate, and I'm following this guide to trigger a desktop flow run using web apis, I can successfully run most GET calls in the guide, but when I trigger a desktop flow run, I get this error:
{\"error\":{\"code\":\"DesktopFlowsConnectionAccessFailedForDesktopFlowConnector\",\"message\":\"User with object identifier 'xxxx' does not have access to the connection 'yyyy' for the Desktop Flows connector.\"}
I couldn't figure out how to solve this issue, or establish this access.
To resolve the error, try generating access token using delegated flows like username password flow, authorization code flow or interactive flows.
I registered one Azure AD application and added same API permissions as below:
In my case, I used username password flow to generate access token via Postman with below parameters:
POST https://login.microsoftonline.com/tenantId/oauth2/token
grant_type:password
client_id:appId
client_secret:secret
resource: https://orga9xxxxx.crm.dynamics.com/
username: admin@xxxxxxx.onmicrosoft.com
password:xxxxxxxx
Response:
You can decode the above access token in jwt.ms website to check aud
and scp
claims like this:
Now, you can use this access token generated by username password flow to trigger a desktop flow.