Terraform deployment fails when creating Azure Event Grid subscriptions for storage-based pipeline

Dimitrios Bardis 5 Reputation points
2026-06-07T14:14:08.56+00:00

We are deploying Azure infrastructure with Terraform for a document/RAG-style ingestion pipeline. The deployment fails during the phase where Event Grid subscriptions are created for blob-created events on a Storage Account.

Azure returned an error that included a request/correlation ID and suggested posting in the forums or opening a support ticket.

Request timestamp: 2026-06-07 14:02:51 UTC

What we are trying to do:

  • Create an Event Grid System Topic for an Azure Storage Account
  • Create Event Grid event subscriptions for Microsoft.Storage.BlobCreated
  • Deliver those events to Azure Storage Queues
  • Use a user-assigned managed identity for delivery/authentication
  • Provision everything through Terraform

Expected behavior: Terraform should successfully create the Event Grid subscriptions and connect blob-created events to the target storage queues.

Actual behavior: The deployment fails during Event Grid subscription creation. -> │ Message: "The operation failed due to an internal server error. The initial state of the impacted resources (if any) are restored. Please try again in few minutes. If error still persists, report 627374f5-9018-45a3-a05c-9f06ea5a600c:6/7/2026 2:02:51 PM (UTC) to our forums for assistance or raise a support ticket ."

The Azure error is not actionable enough for us to determine whether this is caused by:

  • managed identity/RBAC propagation timing,
  • Event Grid to Storage Queue delivery requirements,
  • Terraform/provider behavior,
  • or an Azure platform-side issue.

Relevant Terraform shape: We have:

  • a Storage Account
  • an Event Grid System Topic for that Storage Account
  • one or more Event Grid system topic event subscriptions
  • Storage Queue endpoints as delivery targets
  • a user-assigned managed identity with queue message sender permissions

High-level reproduction steps:

  1. Deploy the base infrastructure with Terraform.
  2. Enable the feature flag that creates Event Grid subscriptions.
  3. Run terraform apply.
  4. The apply fails while creating Event Grid subscriptions.

What we would like help with:

  1. What are the common causes of Event Grid subscription creation failing in this setup?
  2. Are there known timing issues with user-assigned identity or RBAC propagation for queue delivery?
  3. Are there additional Azure-side prerequisites for Event Grid delivery to Storage Queues using managed identity?
  4. Is this more likely to be a Terraform/provider issue or an Azure resource validation issue?We are deploying Azure infrastructure with Terraform for a document/RAG-style ingestion pipeline. The deployment fails during the phase where Event Grid subscriptions are created for blob-created events on a Storage Account.
Azure Event Grid
Azure Event Grid

An Azure event routing service designed for high availability, consistent performance, and dynamic scale.

0 comments No comments

2 answers

Sort by: Newest
  1. Siddhesh Desai 8,210 Reputation points Microsoft External Staff Moderator
    2026-06-08T08:49:30.2166667+00:00

    Hey @Dimitrios Bardis

    Thank you for reaching out to Microsoft Q&A.

    Based on what you shared, this looks like Terraform is successfully reaching Azure, but the Event Grid event subscription create call is returning a generic internal server error and rolling back the impacted resources.

    Because the provided docs don’t include Event Grid to Storage Queue specific “known causes” for subscription creation with managed identity, I can only map likely categories from the general troubleshooting guidance and the Terraform deployment failure guidance included below.

    What you can check (from the provided guidance)

    1) Validate storage/Event Grid trigger prerequisites (most common configuration blockers)

    Even though your error says “internal server error”, configuration issues can still surface as non-actionable ARM failures. The provided storage trigger guidance suggests checking:

    Storage account configuration

    Ensure required settings are correct, specifically network settings (e.g., storage firewall/VNet restrictions) and access keys availability where applicable.

    Event Grid subscription configuration

    Confirm the subscription includes the intended event types (for you: Microsoft.Storage.BlobCreated).

    Event subscription target expectations

    Ensure the destination is configured correctly in Event Grid (you’re using Storage Queue as the endpoint type).

    Additionally, there’s a related case note in the provided materials showing a similar Event Grid → Storage delivery scenario failing when:

    the storage account was effectively not reachable due to private networking, and

    the required queue message sender permission wasn’t present, until the role and connectivity were fixed.

    So, even for subscription creation, it’s worth confirming network reachability and queue permissions are fully in place (see RBAC questions below).

    2) Terraform race conditions / dependency ordering

    The Terraform deployment guidance provided is generic, but it directly calls out two things that often produce vague “internal server error” outcomes during creates:

    Avoid implicit dependencies: explicitly add depends_on where Event Grid subscriptions depend on:

    storage account readiness,

    event grid system topic readiness,

    queue destination readiness/permissions,

    any role assignments you apply for the managed identity.

    Reduce Terraform parallelism: run with reduced parallelism to avoid parallel create operations that depend on each other.

    (The guidance specifically suggests trying terraform apply parallelism =1.)

    This is especially relevant in your step-by-step flow where you “enable a feature flag” and then run terraform apply that’s a classic way to accidentally trigger parallel creation.

    3) Check whether you’re blocked by RBAC propagation / role assignment timing

    Your question mentions managed identity/RBAC timing, and the provided materials support the general concept that permissions/network readiness must be correct and present before delivery/creation proceeds.

    For your scenario, the minimum “shape” to verify is:

    The user-assigned managed identity used by Event Grid delivery has the necessary role on the Storage Queue.

    The provided related example explicitly references the need for Storage Queue Data Message Sender-type permissions for successful delivery.

    Role assignment is definitely completed before subscription creation.

    With Terraform, ensure it’s not created “in parallel” with the Event Grid subscription.

    Is it more likely a Terraform/provider issue or an Azure resource validation issue?

    From the provided docs alone:

    The guidance for Terraform failures strongly suggests race/dependency issues (use depends_on, lower parallelism) as a first remediation path.

    The storage trigger guidance suggests network/access configuration and event subscription correctness as another first path.

    So, based on the included documentation, the most likely buckets are:

    Dependency ordering / timing (Terraform creates Event Grid subscription before queue permissions/network assumptions are fully ready)

    Storage account network/firewall/VNet settings preventing Event Grid from being able to validate/connect

    Less likely (but possible): an Azure-side transient issue (“Please try again in a few minutes” is consistent with transient platform behavior)

    Practical next steps to suggest in the forum post

    Add explicit depends_on from each azurerm_eventgrid_event_subscription to:

    the Event Grid system topic resource,

    the storage account (and anything network/firewall-related),

    the storage queue resource,

    the role assignment granting queue message sender permissions to the managed identity.

    Try running Terraform with lower parallelism (per the provided doc).

    Re-try after a short wait (“few minutes”) to rule out transient platform issues.

    In the Azure portal, confirm:

    Event Grid subscription targets the correct Storage Queue endpoint configuration,

    the storage networking/firewall doesn’t block required access at the time of create,

    the managed identity has the right queue-level sender role.

    If it still fails after the above, the most helpful forum/support path is to collect more evidence:

    Terraform trace/debug output (the Terraform doc suggests using TF_LOG=DEBUG / TRACE),

    whether other resources created in the same run succeed,

    whether the issue correlates with private networking or storage firewall state.

    Event Grid eventSubscriptions Terraform property shapes (endpointType StorageQueue):

    https://learn.microsoft.com/azure/templates/microsoft.eventgrid/2019-01-01/eventsubscriptions

    https://learn.microsoft.com/azure/templates/microsoft.eventgrid/eventsubscriptions

    Was this answer helpful?


  2. AI answer

    2026-06-07T14:14:31.3133333+00:00

    From the provided information, only general behavior and deployment shapes for Event Grid subscriptions and some examples of platform-side issues are available, not detailed failure causes for this specific correlation ID. The following points are supported:

    1. Event Grid subscription deployment model

    Event Grid subscriptions can be deployed at several scopes and shapes, including:

    • Microsoft.EventGrid/systemTopics/eventSubscriptions (system topics bound to sources such as Storage Accounts).
    • Microsoft.EventGrid/eventSubscriptions at tenant, management group, subscription, or resource group scope.
    • Destinations can include Storage Queues via the StorageQueue endpoint type.

    The Terraform AzAPI resource definition for Event Grid subscriptions shows the supported destination types and required properties. For Storage Queue destinations, the shape is:

    {
      endpointType = "StorageQueue"
      properties = {
        queueMessageTimeToLiveInSeconds = int
        queueName = "string"
        resourceId = "string"
      }
    }
    

    This confirms that Storage Queue is a valid destination type and that the subscription resource is expected to be deployable via Terraform at resource-group scope for system topics.

    1. Platform-side issues and stuck Event Grid subscriptions

    There is a documented case where Event Grid topic subscriptions became stuck in Updating and then Deleting states when managed via ARM/EV2. Attempts to update or delete them resulted in conflicts (409 unable to update while resource is provisioning). Deleting the parent Event Grid System Topic in the portal appeared to succeed, but recreating it with the same name resurrected the stuck instance. The issue was ultimately resolved only after the Azure Event Grid team intervened on the platform side and removed the stuck subscriptions.

    This demonstrates that:

    • Event Grid subscription operations can fail due to internal platform issues that are not actionable from the customer side.
    • In such cases, the only resolution may be via Azure support/engineering intervention.
    1. Other examples of platform/region issues during deployment

    Additional Q&A cases in the context show deployments failing for reasons that turned out to be platform-side or region-specific, not template logic errors:

    • A deployment that consistently failed with an obscure error was resolved by switching to a different region, with no region-specific hint in the error message.
    • A Redis Cache instance stuck in Creating could not be deleted until the platform moved it to a failed state, after which deletion succeeded.
    • VM deployments blocked by quota issues where the portal quota blade would not load; workarounds involved using CLI/REST while the portal issue was investigated.
    • HDInsight cluster creation failures that were resolved by using a new subscription.

    These examples indicate that:

    • Internal server errors during deployment can be due to transient or regional platform issues.
    • Errors may not clearly indicate whether the problem is quota, region, or platform behavior.
    • Resolution sometimes requires either changing deployment parameters (region/subscription) or opening a support ticket.
    1. What can be concluded for this scenario from the context

    Given the context:

    • Event Grid system topic subscriptions are a supported, ARM/Terraform-deployable resource type.
    • Storage Queue is a supported destination type for Event Grid subscriptions, with a defined schema.
    • There is precedent for Event Grid subscriptions entering bad states or failing operations due to internal platform issues, requiring Azure engineering intervention.
    • There is precedent for deployments failing in specific regions or subscriptions with non-actionable error messages, where the root cause was platform-side.

    Based on this, the error message:

    "The operation failed due to an internal server error. The initial state of the impacted resources (if any) are restored. Please try again in few minutes. If error still persists, report [correlation ID] to our forums for assistance or raise a support ticket."

    is consistent with an Azure platform-side issue rather than a Terraform configuration error, especially when the resource type and destination shape are valid.

    The context does not provide:

    • Specific known timing issues for user-assigned managed identities or RBAC propagation for Event Grid → Storage Queue delivery.
    • Additional documented prerequisites for using managed identity with Storage Queue destinations beyond the standard destination shape.
    • Evidence that this class of error is caused by Terraform/provider behavior rather than Azure resource validation or internal errors.

    Therefore, from the available information, the most supported conclusion is that this type of failure is likely an Azure platform-side issue (potentially regional or transient) and should be investigated via Azure support using the provided correlation ID, similar to the prior Event Grid subscription and other deployment issues.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

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