Is it possible to recover a function that disappeared after attempting to delete its trigger?

Nate 96 Reputation points
2020-12-29T21:49:36.407+00:00

Hello,

I had an Azure Function that was using an Event Grid Trigger. I noticed that the app wasn't triggered recently despite events being generated that should trigger it, so I decided to delete the trigger and re-create it to see if that would help.

In the Azure Portal, I went into the Function, selected Integration, clicked on the Trigger, and then clicked Delete.

That threw an InternalServerError in Azure for the Update Web Apps Functions operation and the Function disappeared from the portal.

I didn't realize that deleting the trigger would also remove the function from the Azure portal. Is there any way to restore it? Will the function still attempt to execute if it doesn't show up in the portal? The function's files are included in the zip file created when I used "Download app content" from the function app, so I can recreate it if necessary.

JSON of the error message:

{
"authorization": {
"action": "Microsoft.Web/sites/functions/write",
"scope": "/subscriptions/bab6f0ef-6aca-4894-9942-2e50f7cc2b43/resourceGroups/support-admin/providers/Microsoft.Web/sites/supportadmin/functions/autoTag"
},
"caller": "xxx",
"channels": "Operation",
"claims": {
"aud": "https://management.core.windows.net/",
"iss": "https://sts.windows.net/b124ed85-f72c-46ff-b40d-edafa5f708f4/",
"iat": "1609274216",
"nbf": "1609274216",
"exp": "1609278116",
"http://schemas.microsoft.com/claims/authnclassreference": "1",
"aio": "AVQAq/8SAAAAvrkrY5kKd369paGt5SEJF4/9/t8ihmLbQXEtU83jdqsOpjbjDrXnoX4Y0Rwf2eIbNYQhRlgvYbHdQbG0ixE2AmKL0CkksPUwhjTGTct2OQ8=",
"http://schemas.microsoft.com/claims/authnmethodsreferences": "pwd,mfa",
"appid": "c44b4083-3bb0-49c1-b47d-974e53cbdf3c",
"appidacr": "2",
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname": "xxx",
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname": "xxx",
"groups": "91fae75d-527f-4782-9639-66bc5b18dbde,0212658d-8604-4aa1-9ced-1e0f6ffe8c10",
"ipaddr": "xxx",
"name": "xxx",
"http://schemas.microsoft.com/identity/claims/objectidentifier": "9ca9585d-dad3-4fc7-9a88-a626bf9dc325",
"puid": "10032000CAA00FC5",
"rh": "0.AAAAhe0ksSz3_0a0De2vpfcI9INAS8SwO8FJtH2XTlPL3zxdAKI.",
"http://schemas.microsoft.com/identity/claims/scope": "user_impersonation",
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier": "sT7IwJTePpsdtEvAt0G9YYRW2fvmhVDGWjTNL-rDzyk",
"http://schemas.microsoft.com/identity/claims/tenantid": "b124ed85-f72c-46ff-b40d-edafa5f708f4",
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name": "xxx",
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn": "xxx",
"uti": "wOJVgUmn10CzW7tz6hkEAA",
"ver": "1.0",
"xms_tcdt": "1592206877"
},
"correlationId": "83088063-860e-486a-be97-6d211e4810ac",
"description": "",
"eventDataId": "7132fbf6-c6dc-4b95-803f-307f0c004e7a",
"eventName": {
"value": "EndRequest",
"localizedValue": "End request"
},
"category": {
"value": "Administrative",
"localizedValue": "Administrative"
},
"eventTimestamp": "2020-12-29T20:51:48.2437692Z",
"id": "/subscriptions/bab6f0ef-6aca-4894-9942-2e50f7cc2b43/resourceGroups/support-admin/providers/Microsoft.Web/sites/supportadmin/functions/autoTag/events/7132fbf6-c6dc-4b95-803f-307f0c004e7a/ticks/637448719082437692",
"level": "Error",
"operationId": "86367617-6b6a-47b8-88a0-462266034d28",
"operationName": {
"value": "Microsoft.Web/sites/functions/write",
"localizedValue": "Update Web Apps Functions"
},
"resourceGroupName": "support-admin",
"resourceProviderName": {
"value": "Microsoft.Web",
"localizedValue": "Azure Web Sites"
},
"resourceType": {
"value": "Microsoft.Web/sites/functions",
"localizedValue": "Microsoft.Web/sites/functions"
},
"resourceId": "/subscriptions/bab6f0ef-6aca-4894-9942-2e50f7cc2b43/resourceGroups/support-admin/providers/Microsoft.Web/sites/supportadmin/functions/autoTag",
"status": {
"value": "Failed",
"localizedValue": "Failed"
},
"subStatus": {
"value": "BadRequest",
"localizedValue": "Bad Request (HTTP Status Code: 400)"
},
"submissionTimestamp": "2020-12-29T20:52:48.1592518Z",
"subscriptionId": "bab6f0ef-6aca-4894-9942-2e50f7cc2b43",
"tenantId": "b124ed85-f72c-46ff-b40d-edafa5f708f4",
"properties": {
"statusCode": "BadRequest",
"serviceRequestId": null,
"statusMessage": "{\"Code\":\"BadRequest\",\"Message\":\"Encountered an error (InternalServerError) from host runtime.\",\"Target\":null,\"Details\":[{\"Message\":\"Encountered an error (InternalServerError) from host runtime.\"},{\"Code\":\"BadRequest\"},{\"ErrorEntity\":{\"Code\":\"BadRequest\",\"Message\":\"Encountered an error (InternalServerError) from host runtime.\"}}],\"Innererror\":null}",
"eventCategory": "Administrative",
"entity": "/subscriptions/bab6f0ef-6aca-4894-9942-2e50f7cc2b43/resourceGroups/support-admin/providers/Microsoft.Web/sites/supportadmin/functions/autoTag",
"message": "Microsoft.Web/sites/functions/write",
"hierarchy": "bab6f0ef-6aca-4894-9942-2e50f7cc2b43"
},
"relatedEvents": []
}

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,301 questions
Azure Event Grid
Azure Event Grid
An Azure event routing service designed for high availability, consistent performance, and dynamic scale.
319 questions
0 comments No comments
{count} votes

Accepted answer
  1. Nate 96 Reputation points
    2020-12-29T22:26:38.177+00:00

    I was able to fix this by logging into the Console in the Function App. The function that disappeared from the portal was still in the /home/site/wwwroot directory. Inside was a function.json file that only contained an empty bindings array. I checked the function.json file for another one of my functions and copied it to the function.json by running the following command:

    printf '{\n "bindings": [\n  {\n    "name": "Timer",\n    "schedule": "0 0 * * * *",\n    "direction": "in",\n    "type": "timerTrigger"\n  }\n ]\n}' > function.json
    

    (I couldn't use vi or nano to edit the file which is why I went with printf. I'm not sure if the Console allows any text editors).

    This is obviously a timer trigger and not the original Event Grid trigger assigned to the function, but after restarting the function app, the missing function is now visible in the portal.

    0 comments No comments

0 additional answers

Sort by: Most helpful