0

Event Grid deployment is failing for below ARM template with internal server error.

Tried steps that mentioned in this link Event subscription by ARM template for topic with EndpointType as AzureFunction

But still facing the same issue.

ARM Template:

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {

        "appName": {
            "type": "string",
            "defaultValue": "harshitk-FA",
            "metadata": {
                "description": "The name of the function app that you wish to create."
            }
        },
        "eventTopicName": {
            "type": "String",
            "defaultValue": "harshitTopic",
            "metadata": {
                "description": "Name for the system topic."
            }
        },
        "eventSubName": {
            "type": "string",
            "defaultValue": "devharshitktest123sub",
            "metadata": {
                "description": "Name for the Event Grid subscription."
            }
        },
      "functionName": {
        "type": "string",
        "defaultValue": "ArmFunctionApp",
        "metadata": {
          "description": "Function to be triggered by event grid topic"
        }
      },
      "location": {
        "defaultValue": "[resourceGroup().location]",
        "metadata": {
          "description": "Location for all resources."
        },
        "type": "string"
      },
      "storageAccountName": {
        "defaultValue": "harshitarmtest",
        "type": "string"
      }
    },
    
    "variables": {
        "functionAppName": "[parameters('appName')]",
        "eventTopicName": "[parameters('eventTopicName')]",
        "eventSubscriptionName": "[parameters('eventSubName')]",
        "eventHandler": "[parameters('functionName')]",
        "storageAccountName": "[parameters('storageAccountName')]"

    },
    "resources": [


 {
            "type": "Microsoft.EventGrid/systemTopics",
            "apiVersion": "2020-04-01-preview",
            "name": "[variables('eventTopicName')]",
            "location": "[parameters('location')]",
            "properties": {
                "source": "[resourceId('Microsoft.Storage/storageAccounts',variables('storageAccountName'))]",
                "topicType": "Microsoft.Storage.StorageAccounts"
            }
        },
        {
            "type": "Microsoft.EventGrid/systemTopics/eventSubscriptions",
            "apiVersion": "2020-04-01-preview",
            "name": "[concat(variables('eventTopicName'), '/', variables('eventSubscriptionName'))]",
            "dependsOn": [
                "[resourceId('Microsoft.EventGrid/systemTopics', variables('eventTopicName'))]"
            ],
            "properties": {
                "destination": {
                    "endpointType": "AzureFunction",
                  "properties": {
                    //"resourceId": "[concat('/subscriptions/',subscription().subscriptionId,'/resourceGroups/',resourceGroup().name,'/providers/Microsoft.Web/sites/',variables('functionAppName'),'/functions/',variables('eventHandler'))]",
                    "resourceId": "[resourceId('Microsoft.Web/sites/functions/', variables('functionAppName'), variables('eventHandler'))]",
                    "maxEventsPerBatch": 10,
                    "preferredBatchSizeInKilobytes": 64
                  }
                },
                "filter": {
                    "includedEventTypes": [
                        "Microsoft.Storage.BlobCreated"
                                        ]
                },
                "eventDeliverySchema": "EventGridSchema"
            }
        }
    enter code here
    ],
    "outputs": {}
}

Error Message in powershell:

 "error": {
      "code": "DeploymentFailed",
      "message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.",
      "details": [
        {
          "code": "Internal 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 XXXXXXXXXXXXXXXXX`enter code here`:11/26/2020 6:01:09 PM (UTC) to our forums for assistance or raise a support ticket ."
        }
      ]
    }
  • Check your resource group deployment, it might have more information where it failed exactly. – Bassam Gamal Nov 26 '20 at 20:26
  • I see same error message in resource group deployment. – harshit kanjilal Nov 27 '20 at 03:32
  • Have you retried the deployment since then? It may have been a transient issue within the MS network. I believe I've seen that before, and all I did was wait then try again later. – String.Empty Nov 27 '20 at 21:27
  • COuld you please add `-debug` at your powershell command to get detailed message? – Jim Xu Nov 30 '20 at 03:04
  • DEBUG: AzureQoSEvent: CommandName - New-AzResourceGroupDeployment; IsSuccess - False; Duration - 00:01:02.8848983;; Exception - System.Exception: 5:47:32 PM - The deployment 'eventgrid' failed with error(s). Showing 1 out of 1 error(s). Status 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 XXXXXXXXXXXXXXXXXXXXXX:11/30/2020 12:17:05 PM (UTC) to our forums for assistance or raise a support ticket . (Code:Internal error) – harshit kanjilal Nov 30 '20 at 12:22
  • @harshitkanjilal Are you still blocked here? I see the text `enter code here` in your template above that seems out of place. Is that a typo? Also try running [Test-AzResourceGroupDeployment](https://learn.microsoft.com/en-us/powershell/module/az.resources/test-azresourcegroupdeployment?view=azps-5.1.0) with your template to validate the deployment. – Bhargavi Annadevara Dec 06 '20 at 11:52

0 Answers0