Hi @wang jialu ,
Can you share the complete runbook so it helps to diagnose and troubleshoot the issue in a better way?
Looking at the error 'long running operation failed', for long running Azure Automation tasks, it's recommended to use a Hybrid Runbook Worker. For more information, please refer this document. For illustration, added a screenshot below from the document.
On the other hand, hope you have already reviewed this document. If not, I would recommend you to please read through it to learn about ForEach -Parallel construct which processes commands for each item in a collection concurrently. The items in the collection are processed in parallel while the commands in the script block run sequentially. For illustration, added a screenshot below from the document.