Hi everyone,
I hope you're all doing well. I'm currently developing a flow in Power Automate to manage virtual machines (VMs) in a machine group based on the presence of items in a queue. The intended functionality of the flow is as follows:
- Check Queue: Verify if there are any items in the queue of a machine group.
- Power Management:
- If there are no items in the queue: Turn off all VMs in the machine group.
- If there are items in the queue: Turn on the VMs in the machine group.
During the development of this flow, I'm encountering an "Authentication failed" error when trying to authenticate and retrieve data from the Power Automate API. Here’s a brief outline of the steps and configurations I have implemented:
- Azure Automation: Created a runbook to generate an authentication token using client credentials (tenant ID, client ID, and client secret). The runbook successfully generates a token.
- Power Automate Flow: Use the generated token to make an HTTP GET request to the Power Automate API to check the queue status. I encounter the "Authentication failed" error during this HTTP request.
I have ensured that the client credentials are correct and have sufficient permissions.
Maybe there is another way to do this on a easier way, I just wanted to reduce costs of my VMs that sometimes, just stay "idle" for a while.
Could anyone help me resolve this issue? Any guidance or suggestions to troubleshoot this authentication error would be greatly appreciated.
Thanks for your support!