Errors when adding a MQTT custom domain to an Event Grid Namespace

Andy 0 Reputation points
2025-10-16T03:29:32.44+00:00

An error is always received when using the Azure Management Portal to add a custom MQTT domain to an Event Grid Namespace using a Key Vault certificate with access granted through a System Managed Identity. I have set the System identity access for Event Grid Namespace to access the Key Vault. It happens even with new instances of an Event Grid Namespace and a new Key Vault. The first namespace the error references a previously deleted user assigned identity even though that is not selected in the add domain name request (System identity is chosen). In the second instance with a new Event Grid Namespace and new Key Vault the error is more generic:

Custom domain addition failed with error: "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 6a129a53-2c5e-49ee-992c-e8cd76ea3441 to our forums for assistance or raise a support ticket.

Azure Event Grid
Azure Event Grid
An Azure event routing service designed for high availability, consistent performance, and dynamic scale.
{count} votes

1 answer

Sort by: Most helpful
  1. Pravallika KV 580 Reputation points Microsoft External Staff Moderator
    2025-10-31T06:36:59.94+00:00

    Hi Andy,

    Thanks for reaching out to Microsoft Q&A.

    I have analyzed your Payload and tried to run the Az command you mentioned and got the same error.

    
    az resource create --resource-type Microsoft.EventGrid/namespaces --id /subscriptions/X/resourceGroups/X/providers/Microsoft.EventGrid/namespaces/X --is-full-object --properties NS.json
    
    
    
    Error parsing JSON.
    
    NS.json
    
    Expecting value: line 1 column 1 (char 0)
    
    

    To resolve this error, you need to enclose the parameters in double quotes and add @ before the file name NS.json as below:

    
    az resource create --resource-type "Microsoft.EventGrid/namespaces" --id "/subscriptions/SubscriptionID/resourceGroups/RGName/providers/Microsoft.EventGrid/namespaces/NamespaceName" --is-full-object --properties @"NS.json"
    
    
    • You can also use below commands to create the custom domain. The parameters available to create domain using AZ CLI are mentioned in MSDOC1 and MSDOC2:
    
    az eventgrid domain create --name
    
                               --resource-group
    
                               [--identity {noidentity, systemassigned}]
    
                               [--inbound-ip-rules]
    
                               [--input-mapping-default-values]
    
                               [--input-mapping-fields]
    
                               [--input-schema {cloudeventschemav1_0, customeventschema, eventgridschema}]
    
                               [--location]
    
                               [--mi-system-assigned]
    
                               [--mi-user-assigned]
    
                               [--public-network-access {disabled, enabled}]
    
                               [--sku {basic, premium}]
    
                               [--tags]
    
    
    
    az eventgrid domain topic create --domain-name
    
                                     --name
    
                                     --resource-group
    
    

    Follow below steps to avoids the stale identity metadata issues:

    • Create a new Event Grid namespace in the same region but don't attach a user-assigned identity.
    • Enable system-assigned identity only from the start.
    • Configure Key Vault and custom domain immediately after creation.

    Hope it helps!


    Please do not forget to click "Accept the answer” and Yes, this can be beneficial to other community members.

    User's image

    If you have any other questions, let me know in the "comments" and I would be happy to help you.

    0 comments No comments

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.