Create service principle before creating the resource

71 views Asked by At

A service principle can be created to control the access to a specific resource in azure. For example azure ACR's service principle can be created in according to the official page

My question is that can I create the service principle before the azure ACR has been created. I'm asking because I need to create a azure ACR by Terraform, and I would like to add service principle and assign role to it. But at that moment I don't even have a ACR, it would be a chicken and eggs question. Can I already created the service principle before the provisioning of the ACR resource by Terraform?

1

There are 1 answers

4
Charles Xu On BEST ANSWER

Of course, you can. You can pre-create the service principal for the things that will use the service principal in the future and then use it. So when you create the ACR, it means you need to use an existing service principal. Just follow the steps.