I am trying to provision a user in Azure Active Directory using Terraform's AzureAD provider. At the top of the azuread_user
documentation, it states:
NOTE: If you're authenticating using a Service Principal then it must have permissions to
Directory.ReadWrite.All
within theWindows Azure Active Directory API
.
I have created the Azure Active Directory User using the az
command line:
az ad sp create-for-rbac --role="Owner" --scopes=$SubscriptionUrl --name $PrincipalName
However, this doesn't have Directory.ReadWrite.All
permissions, as that would be a fairly insane security risk.
How can I add the Directory.*
permissions to the Service Principal using the az
command line (by preference) or even the Azure Powershell Cmdlets, I would even be willing to craft a WebRequest if that would help me solve the problem!