Is there a way to share a Desktop Flow with an Application User in Power Automate?
I have written an Azure Function that uses the Dataverse API to trigger a desktop flow; however, when the code runs I get the following error: Operation returned an invalid status code 'Forbidden'. I am the owner of the flow and it has not been shared with any other users.
For authenticating with the Dataverse I have followed the steps in this post Use OAuth authentication with Microsoft Dataverse. I have created an App in Azure Active Directory, an Application User in Power Automate, and I am using the below code to authenticate.
Following these steps I am able to successfully connect to the Dataverse and query data in tables but I am unable to trigger a desktop flow.
Any feedback would be appreciated. I am open to changing my code and means of authenticating if it will enable me to trigger a desktop flow via Azure Function.
string SecretID = "00000000-0000-0000-0000-000000000000";
string AppID = "545ce4df-95a6-4115-ac2f-e8e5546e79af";
string InstanceUri = "https://yourorg.crm.dynamics.com";
string ConnectionStr = $@"AuthType=ClientSecret;
SkipDiscovery=true;url={InstanceUri};
Secret={SecretID};
ClientId={AppID};
RequireNewInstance=true";
using (ServiceClient svc = new ServiceClient(ConnectionStr))
{
if (svc.IsReady)
{
//your code goes here
}
}