Create role assignement with terraform gets stuck in and endless loop and no errors

Salam ELIAS 187 Reputation points
2025-07-29T11:08:03.6466667+00:00

I have a terraform that creates a RG, Vnet, 2 subnets a role definition and role assignement. Running terraform apply does not indicate any error, almost all items are created except the process gets stck as follows in assigning the role process

User's imageUser's image

and never ends and no errors.

How can this be figured out? Thanks for your help

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
{count} vote

1 answer

Sort by: Most helpful
  1. Naveena Patlolla 4,805 Reputation points Microsoft External Staff Moderator
    2025-07-31T18:08:05.0166667+00:00

    Hi Salam ELIAS

    You might be using the App Registration Object ID, which could be causing the issue. To resolve it, please use the Enterprise Application Object ID instead, as both are different.

    User's image

    image.png

    The below code is for reference, here it assigns the Contributor role to a specific Azure AD principal (ObjectID) on a Storage Account resource, ensuring the role assignment only occurs after the storage account is created.

    resource "azurerm_role_assignment" "role-assignment" {
        depends_on = [ azurerm_storage_account.synapseStoarge-name]
      scope                = azurerm_storage_account.synapseStoarge-name.id
      role_definition_name = "contributor"
      principal_id         = "ObectID"
    }
    

    Please let me know if you face any challenge here, I can help you to resolve this issue further

    Provide your valuable Comments.

    Please do not forget to "Accept the answer” and “upvote it” wherever the information provided helps you, this can be beneficial to other community members.it would be greatly appreciated and helpful to others.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.