I have a Function app that gets deployed via an ARM template. As part of the deployment, it creates an Action Group pointing to one of the HTTP trigger functions in the app. This has worked fine for a year or so now.
I am currently in the process of updating the app from a .NET 6.0 in-process model to a .NET 8.0 isolated worker. After some updates, I was able to get the app working as normal in my local environment and in Azure. However, I am unable to create the Action Group via an ARM template.
When I try to create the Action Group I get the error message:
System.IO.FileNotFoundException: Function (MyFunction) does not exist
at Kudu.Core.Functions.FunctionManager.GetFuncPathAndCheckExistence(String name)
at Kudu.Core.Functions.FunctionManager.<GetFunctionSecretsAsync>d__12.MoveNext()
The code for the ARM template (below) shows it is using the listsecrets to get the URL of the function.
{
"type": "Microsoft.Insights/actionGroups",
"apiVersion": "2021-09-01",
"name": "MyFunction-AG",
"location": "global",
"tags": {
"displayName": "MyFunction-AG"
},
"properties": {
"groupShortName": "MyFunctionAG",
"enabled": true,
"azureFunctionReceivers": [
{
"name": "MyFunction",
"functionAppResourceId": "[resourceId('Microsoft.Web/sites', parameters('functionAppResource'))]",
"functionName": "MyFunction",
"httpTriggerUrl": "[listsecrets(resourceId('Microsoft.Web/sites/functions', parameters('functionAppResource'), 'MyFunction'), '2024-04-01').trigger_url]",
"useCommonAlertSchema": true
}
]
}
}
If I run this command via the Invoke-AzRestMethod, I get the same error.
$path = '/subscriptions/mysubscriont/resourceGroups/myrg/providers/Microsoft.Web/sites/MyFunctionApp/functions/MyFunction/listsecrets?api-version=2024-04-01'
$az = Invoke-AzRestMethod -Path $path -Method Post
However, I am able to get this URL just fine through the portal. I can create the Action Group and point it to the function in the portal as well. Even the listkeys API works. It is just the listsecrets that does not work.
To eliminate the possibility of a code issue or something caused by the ARM template, I tested creating a new function app project, with just the built-in HTTP trigger function. I created a brand new app and storage account in Azure and published via Visual Studio.
I confirmed via the PowerShell below that the listsecrets API still does not work. I tested deploying to both East US 2 and South Central US, and received the same error in both.
$path = '/subscriptions/<GUID>/resourceGroups/functionapp8test/providers/Microsoft.Web/sites/FunctionApp120241015141026/functions?api-version=2024-04-01'
$appRest = Invoke-AzRestMethod -Path $path -Method Get
$function = ($appRest.Content | ConvertFrom-Json).value | Where-Object{ $_.name -match 'Function1' }
$function # Returns the function as expected
$funcPath = "$($function.id)?api-version=2024-04-01"
$funcRest = Invoke-AzRestMethod -Path $funcPath -Method Get
$funcRest # Return the details of the function as expected
$funcListPath = "$($function.id)/listsecrets?api-version=2024-04-01"
$listRest = Invoke-AzRestMethod -Path $funcListPath -Method Post
$listRest # Returns System.IO.FileNotFoundException: Function (Function1) does not exist error
Is there something special I need to do to get the listsecrets API working for a .NET 8.0 isolated app?