I am getting this below error when I am running my timer function app in Azure Cloud. It is just a basic code and I wanted the log to be shown in Insight.
public static class Function1
{
[FunctionName("Function1")]
public static void Run([TimerTrigger("0 * * * * *")]TimerInfo myTimer, ILogger log)
{
log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
}
}
CodePudding user response:
Here is the workaround I did to identify this issue cause:
- Created the Azure Function (Stack: .NET 3.1) of type Timer Trigger with your given timer
"0 * * * * *"
and the connection string given from the storage account created in Azure portal, which is running successfully (in local):
2. Deleted the Storage account from the Azure Portal and tried to run the function locally which gave me the error: The listener for function Function1 was unable to start.
Recovered the Storage Account and then deployed to the Azure Portal Function App and running successfully in cloud also:
In the Azure Cloud, Yes, as @Skin Said that it would be a Storage Account configuration issue.
Few of the steps to resolve this issue were:
- Check the
AzureWebJobsStorage
value contains correct the correct storage account connection string. - Check the Storage account is not deleted.
- Check the Networking Option in the Function App that might be the firewall is blocking/restricting the access to the associated storage account.
CodePudding user response:
It was a firewall issue. Added the appropriate Virtual Network and Subnet under Storage Account > Networking > Firewalls and Virtual Network