I understand that you're trying to create an Azure AD B2C resource using Terraform with a Managed Identity, but you're encountering the following error:
"Error: performing Create: unexpected status 401 (401 Unauthorized) with response: You do not have permission to view this directory or page."
No, it is not possible to create an Azure B2C tenant using a Managed Identity as the authentication method for Terraform. The reason is that whoever creates the tenant will automatically receive a global administrator account. If we attempt to create the tenant through a service principal or managed identities, it won't be able to create users.
We have feature requests in our feature portal, which are open for the user community to upvote and comment on. This allows our product teams to effectively prioritize your request against our existing feature backlog and provides insight into the potential impact of implementing the suggested feature.
Add support for Service Principal to create an Azure AD B2C · Community
Azure AD B2C tenant creation with service principal · Community
Hope this helps. Do let us know if you any further queries.
If this answers your query, do click Accept Answer
and Yes
for was this answer helpful. And, if you have any further query do let us know.