how to export and import Azure Function's "application settings"

You have few options here:

Manually

You can do it manually by:

  1. Go to https://resources.azure.com
  2. Search for your app where your app settings are.
  3. go to the "App Settings" view and copy all the JSON there in properties

enter image description here

  1. go to your new app, and navigate to 'App settings' and click edit, and put all that in the properties collection.

Automated:

You can use either the azure-cli, powershell, or azure-functions-core-tools to achieve the same thing.

Powershell:

Using the Azure Powershell modules https://docs.microsoft.com/en-us/powershell/azure/overview?view=azurermps-5.4.0

# get the app settings from app1
$resource = Invoke-AzureRmResourceAction -ResourceGroupName <yourResourceGroupName> -ResourceType Microsoft.Web/sites/config -ResourceName "<yourFunctionAppName>/appsettings" -Action list -ApiVersion 2016-08-01 -Force

# update the other app with $resource.Properties
New-AzureRmResource -PropertyObject $resource.Properties -ResourceGroupName <targetResourceGroupName> -ResourceType Microsoft.Web/sites/config -ResourceName "<targetAppName>/appsettings" -ApiVersion 2016-08-01 -Force

azure-functions-core-tools:

The documentation for that tool is here https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local

You can do the same by running

az login
func init myFunctionApp
cd myFunctionApp
# this will fetch your settings and put them in local.settings.json
func azure functionapp fetch-app-settings <yourAppName>
func azure functionapp publish <yourTargetApp> --publish-settings-only

the last switch --publish-settings-only is important to not overwrite the files if you only want to publish the settings.

azure-cli:

https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest

This page should have some documentation about how to retrieve and set app settings using the cli https://docs.microsoft.com/en-us/azure/app-service/scripts/app-service-cli-app-service-storage?toc=%2fcli%2fazure%2ftoc.json


Currently, it is impossible. You could check this feedback.

One solution, you could clone your web app, see this link. When you clone a app, application settings are also cloned.

Another solution, you could use Power Shell to import application setting and copy the application to a new web app, using following example:

try{
    $acct = Get-AzureRmSubscription
}
catch{
    Login-AzureRmAccount
}

$myResourceGroup = '<your resource group>'
$mySite = '<your web app>'
$myResourceGroup2 = '<another resource group>'
$mySite2 = '<another web app>'

$props = (Invoke-AzureRmResourceAction -ResourceGroupName $myResourceGroup `
        -ResourceType Microsoft.Web/sites/Config -Name $mySite/appsettings `
        -Action list -ApiVersion 2015-08-01 -Force).Properties

$hash = @{}
$props | Get-Member -MemberType NoteProperty | % { $hash[$_.Name] = $props.($_.Name) }

Set-AzureRMWebApp -ResourceGroupName $myResourceGroup2 `
        -Name $mySite2 -AppSettings $hash

More information about this please check this answer