An Azure service that provides an event-driven serverless compute platform.
Update: resolved
I was finally able to recreate the production Function App with the same name on Flex Consumption.
In my case, the root cause appears to have been orphaned Function host/function-key secret blobs left in the storage account after deleting the original Linux Consumption app. These blobs were stored under the exact prefix:
azure-webjobs-secrets/<function-app-name>/
Deleting the Function App did not remove those blobs because the storage account remained. When the app was recreated with the same name, the new Flex instance found secrets encrypted by the previous app and could not decrypt them.
The symptoms included:
- SCM returning HTTP 404 after recreating the app.
-
az functionapp keys listreturningBad Request. - The portal showing
InternalServerErrorwhile loading host keys. - Host and function keys not being restored correctly.
The process that worked was:
- Back up the application settings, site configuration, deployment package, host keys and every function-level key.
- Enumerate and back up all blobs under the exact
azure-webjobs-secrets/<function-app-name>/prefix. - Delete the original Function App.
- Delete only the orphaned blobs belonging to that exact app prefix and verify that none remain. Be careful not to delete prefixes belonging to slots or similarly named apps.
- Recreate the Function App on Flex Consumption and wait until its SCM endpoint returns HTTP 200.
- Restore only the application settings supported by Flex Consumption; deprecated Consumption settings should not be restored.
- Deploy the package and restore the host and function-level keys.
- Verify that every expected function is registered and run real requests.
After cleaning the stale secret blobs, SCM became available, all keys could be restored, and the five functions were registered successfully. I tested user validation, invoice stamping and cancellation in production; all returned HTTP 200. Application Insights also showed no exceptions or high-severity traces.
Therefore, if an app is deleted and recreated with the same name but SCM or the Functions key APIs behave unexpectedly, I recommend checking whether stale secrets from the previous app still exist in the storage account.
Thanks for the assistance. The migration is now completed successfully.