I am trying to provision Azure AD Domain Service
by executing an ARM template in terrafrom. To let terrafrom access Azure, I have created a service principal
using below script :
az ad sp create-for-rbac --role="Owner" --scopes="/subscriptions/xxxxxxxx-xxxxxfca38"
and then gave the Client ID and Secret to terrafrom.
The problem is, when I execute the script azure gives me an error saying :
code":"BadRequest", "message": "The user xxxxx-80b is not the tenant admin of tenant xxxxxx-xxxxxfca38.
However, when I login to Azure portal using my email and password, I can create AZ AD Domain Service
without any error.
How do I create a service principal with right privilege for performing such operation? I initially thought --role="Owner"
should be sufficient.
Alternatively, it is possible to get Client ID and Secret of the same account which I use to login to Azure portal?
P.S : I am using a personal account in azure which is not linked to any organization AD.
Owner
permission on the subscription and permission to create applications in Azure AD. I've never personally seen this error, so wouldn't be able to tell why it is being thrown or how to workaround this, but consider checking if you actually are an owner on that subscription, or grant yourselfUser Access Administrator
permissions over the subscription – 4c74356b41