Getting the following error in function app on azure portal:
The username or password incorrect: C:hostLogFilesApplicationFunctionHost
We had created a function app which was on consumption plan, but we switched it to dedicated host – P3V2 in order to use MSI based auth with storage account.
We have deleted the variables AzureWebJobsStorage, WEBSITE_CONTENTSHARE and WEBSITE_CONTENTAZUREFILECONNECTIONSTRING and instead added AzureWebJobsStorage__accountName containing the name of the storage account.
We have given the following permissions in the storage account:
And getting the following error:
What am i missing here?
Instead of manually doing all the changes, I made changes to the artifacts (ARM Templates) and deployed all the resources again, after which this issue was gone, but another issue surfaced.
We deployed the following bicep file for azure function:
param functionAppName string
@description('Packaged build')
param servicePackageLink string = ''
@description('App service hosting plan id')
param hostingPlanId string
@description('Allows user to target a region other than the resource group region.')
param location string = resourceGroup().location
@description('Additional configs to be set in the function enviroment variable')
param configs array = []
param storageAccountName string
param storageAccountId string
@secure()
param appInsightsInstrumentationKey string
// Service Configurations
// -----------------------------------------------------------------------------------------------
var defaultAzureFunctionsConfigs = [
{
name: 'APPINSIGHTS_INSTRUMENTATIONKEY'
value: appInsightsInstrumentationKey
}
{
name: 'AzureWebJobsStorage__accountName'
value: '${storageAccountName}'
}
{
name: 'FUNCTIONS_EXTENSION_VERSION'
value: '~4'
}
{
name: 'FUNCTIONS_WORKER_RUNTIME'
value: 'dotnet'
}
{
name: 'WEBSITE_RUN_FROM_PACKAGE'
value: '0'
}
{
name: 'WEBSITE_FIRST_PARTY_ID'
value: 'AntMDS'
}
{
name: 'WEBSITE_LOAD_USER_PROFILE'
value: '1'
}
// WEBSITE_CONTENTSHARE will also be auto-generated - https://docs.microsoft.com/en-us/azure/azure-functions/functions-app-settings#website_contentshare
// WEBSITE_RUN_FROM_PACKAGE will be set to 1 by func azure functionapp publish
]
// Resources
// -----------------------------------------------------------------------------------------------
resource functionApp 'Microsoft.Web/sites@2020-06-01' = {
name: functionAppName
location: location
kind: 'functionapp'
identity: {
type: 'SystemAssigned'
}
properties: {
httpsOnly: true
serverFarmId: hostingPlanId
clientAffinityEnabled: true
siteConfig: {
alwaysOn: false
appSettings: concat(defaultAzureFunctionsConfigs, configs)
minTlsVersion: '1.2'
}
}
}
resource zipDeploy 'Microsoft.Web/sites/extensions@2022-03-01' = {
parent: functionApp
name: 'MSDeploy'
properties: {
packageUri: servicePackageLink
appOffline: true
}
}
// Outputs
// -----------------------------------------------------------------------------------------------
output ResourceId string = functionApp.id
output FunctionAppName string = functionApp.name
output PrincipalId string = functionApp.identity.principalId
Service Plan being used is P3V2. The deployment happens successfully but the function app doesn’t come up.
2
Answers
The error was resolved once I updated the version of the DurableTask Version to >= 2.7.0
In Dedicated App Service Plan
WEBSITE_CONTENTSHARE
,WEBSITE_CONTENTAZUREFILECONNECTIONSTRING
is not required.These app setting uses Azure Files, which does not support Managed Identity as mentioned in this MSDos
AzureWebJobsStorage
can be used with Managed Identity.AzureWebJobsStorage__blobServiceUri
if you are using the URL of the storage accounthttps://<accountName>.blob.core.windows.net
AzureWebJobsStorage__accountName
.OUTPUT
:As you can see my timer trigger which requires
AzureWebJobsStorage
value to execute, is running perfectly fine.