Hi @MrFlinstone,
Based on your query, I understand that you would like to automate PIM role activation for groups.
I see you have followed proper documents from Entra which helps you in managing PIM role activation using Graph or PowerShell Commands. These documents have suggested how you can do that with a manual interaction itself but there is no automation which would actually make the complete process automated.
However, if you would like to work with any of the automation the best option would be Azure functions. But in order to achieve you may need to contact any cloud solution architect who could help you in achieving it.
At this level of support, Microsoft do not support any script or automation from our end. As I suggested you can check with any cloud solution architect and if you would like to check with Microsoft, you can contact your customer success account manager if you have any paid support.
In the meantime, I would like to share one of the third-party documents for you which might help you in achieving your end goal: Automating Azure Privileged Identity Management
Note: We do not own any ownership on third party documents, I have shared this document just to provide you an idea in performing the actions.
I hope this information is helpful. Please feel free to reach out if you have any further questions.
If the answer is helpful, please click "Accept Answer" and kindly "upvote it". If you have extra questions about this answer, please click "Comment".