How to Restore Azure Function Apps (Elastic Premium & Dedicated SKUs)

0
FunctionAppUndelete

Important Notes Before You Begin

  1. Supported SKUs:
    This guide applies only to Elastic Premium (EP) and Dedicated App Service Plan (ASP) SKUs. Consumption SKU apps cannot currently be restored. If your app was on a Consumption plan, you will need to redeploy the app and associated code manually.
  2. File Storage Check:
    If the storage account linked to your Function App still exists, and you were using file storage, check whether the fileshare is still present. The default naming convention follows this pattern:
    function app name and four random characters
    (e.g., myfunctionappz1b2)
  3. This guide is based on the official guide, if anything is out of date, please check there.

Restoring a Function App with File Storage (Elastic Premium)

If your Function App stored its code in a fileshare, it will contain the following application settings:

WEBSITE_CONTENTAZUREFILECONNECTIONSTRING and WEBSITE_CONTENTSHARE

We don’t need to know if the deleted app had these settings however it’s important to understand.

This is the Function app we will be restoring

After deletion, the associated file share usually remains intact in your storage account. You can use this to restore your app.

Steps to Restore

  1. Retrieve Connection Details
    • Navigate to your Storage Account.
    • Under Access Keys, copy the Connection String.
Here we can see where the storage connection string is located in the portal
  1. Locate Your Fileshare
    • Go to Storage Browser > File Shares.
    • Look for a share named similar to your old function app (e.g., OldFunctionAppName-a1b2).
Here we can see what a file share would look like in the portal
  1. Deploy a New Function App (EP SKU)
    • Create a new Function App using the Elastic Premium SKU.
    • Ensure that the language and OS match the original app.
  2. Update Environment Variables
    • Navigate to the new Function App > Configuration > Application Settings.
    • Update the following:
      • AzureWebJobsStorage
      • WEBSITE_CONTENTAZUREFILECONNECTIONSTRING
      • WEBSITE_CONTENTSHARE
      • Use the existing fileshare name and corresponding connection string from above.
These are the 3 settings that needs updated to point the function app to your old files

Once saved, the Function App will restart. After a few minutes, your original functions and triggers should reappear.

Here is our restored function app

Restoring a Function App on a Dedicated SKU (No File Storage)

Dedicated Function Apps do not use fileshare storage, but you can restore them using Azure PowerShell.

Here’s our starting app that we will be restoring

Steps to Restore

  1. Deploy a Replacement Function App
    • Create a new Function App with the same Dedicated App Service Plan (ASP).
    • Ensure that the OS and language match the original app.
    • This step is crucial — skipping it causes Azure to default to a standard Web App during restore, leading to a conflict error.
  2. Use PowerShell via Azure Cloud Shell
    • Launch Azure Cloud Shell with PowerShell.
  1. List Deleted Apps Get-AzDeletedWebApp -ResourceGroupName "FunctionAppRestore"
  2. Select the Deleted App $DeletedSites = Get-AzDeletedWebApp -ResourceGroupName "FunctionAppRestore" -Name "DedicatedSKUfunctionapp"
  3. Validate the Selection Write-Output $DeletedSites[0]
    • If you have multiple sites with the same name, you can select which one you want by modifying the number in that variable. AKA. Write-Output $DeletedSites[1]
  1. Restore the App Restore-AzDeletedWebApp -TargetResourceGroupName "FunctionAppRestore" -TargetName "RestoredFunctionApp" -TargetAppServicePlanName "DedicatedSKUASP" -InputObject $DeletedSites[0] -Debug
  2. From this point the Target App will stop, the files will be restored, and the function will be started again automatically.
From this point, your functions should show up after a few minutes

Important Note

Please note that restoring a dedicated Function app will only work if the platform has created at least 1 backup. So if you just created the app you deleted, deployed code, then deleted it to try out restoring. It might not work.

About Author

Leave a Reply

Your email address will not be published. Required fields are marked *