Is there a way to use ARM Template to create an Azure Service Principal?

Viewed 3368

I am trying to write an ARM template that can create a service principal on Azure with all the specified permissions. The end goal is to automate this process and create n number of service principals using the template. Is there a way to do this? Any help is much appreciated, thanks!

3 Answers

As @silent said is it not possible to add it via ARM templates.

BUT this is a very common case to use a combination of ARM templates and Powershell or CLI. This will give you more flexibility when creating resources, you should consider that. Mixing ARM templates with the script will solve your problem.

Refs:

https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/deploy-cli https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/deploy-powershell https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-authenticate-service-principal-powershell

ARM Template wont be able to create a service principal. What You can do is write a PowerShell script to create a single service principal and then parameterize it to use it as a function to create multiple Service Principals by passing different parameters to the same function.

Related