Search code examples
pythonazure-functionsazure-function-appazure-eventgrid

"Resource should pre-exist" error when adding Advanced Filters to EventGrid Subscription


Why is this happening and how do I get around it?

Issue:

  • Existing infrastructure
  • Python Azure Function triggered by EventGrid
  • EventGrid messages created upon BlobUpload to a Storage Account
  • When creating Advanced Filters for the EventGrid Subscription, I receive the error:
Deploying Event Subscription: my-eventgrid-sub-name
Deployment has failed with the following error: 
{
    code:"Endpoint validation",
    message:"Destination azure endpoint not found,
    Resource details: resourceId:/subscriptions/<redacted>/resourceGroups/<redacted>/providers/Microsoft.Web/sites/myFunctionAppName/functions/myFunctionName. 
    Resource should pre-exist before attempting this operation,
    Activity id:7e9c4817-5bbd-4772-a7b0-a4dbc70dbf04, 
    timestamp: 10/24/2020 7:01:39 PM (UTC)."
}

enter image description here

Of course myFucnctionName exists. Its existed and been operational for weeks now. It seems like EventGrid can't "see" the Function.

EDIT 1:

  • Updated the image above. I should have seen that the app was stopped. I guess this effects the ability to add EventGrid filters.
  • Started the app, all good now.

Solution

  • As the error message - Resource should pre-exist before attempting this operation says, there are two potential causes to this error:

    • You have not created Event Grid Trigger function app, which you are pointing in this subscription.
    • The artifact of function app is not correctly deployed and function app is not present.