Security with Service Principals in Azure

Posted by terminal-admin@reddit | sysadmin | View on Reddit | 4 comments

As an organization we have been moving more and more towards Github and automated deployments of our web applications we host in Azure.

Previously we would have employees elevate through PIM for a short period of time, run a deployment script, and then be back to their default least privilege roles. Now that we have moved more of this automation into Github, these scripts run as Github actions through the context of Service Principals.

I don't fully like the idea of service principals having something like permanent contributor over a subscription, but I have not been able to find a solution for service principal's that is similar to a user elevating with PIM. I may just be overthinking this due to a lack of knowledge of different attack vectors that could be used with a service principal, but I would rather be safe than sorry.

So is anyone using some type of elevation with Service Principals or is the standard when running scripts from Github to give the SP the least privileges it needs (which unfortunately for us is still pretty privileged) over the subscription/ resources?

Any help or ridicule is appreciated.