Hi Guys,
Hope all is well.
I am having an issue with start/stop D365 environments via power automated scheduled flow.
My flow is simple.
Scheduled flow
Obtain Bearer token for authentication
Parse Json
Fetch environment metadata - to see the status of the environment
Parse Json
Condition
If VM is in deployed state skip
Else proceed
HTTP call to start the VM
It all works until here.
My problem is on the second part of the flow.
I have a delay of 8h
Afterwards i am obtaining the Bearer token again because it expires after 1h.
Parse Json
HTTP call to stop the VM - here i am receiving error that i am not authorized to perform this action.
What i suspect: It is not a permission issue because if i delay the /STOP VM/ call for 1m it all works fine.
I am using the second token to authenticate for the STOP VM call, but still i can't manage to build single flow for both of the actions start/stop.
Any ideas what could be wrong here ?