One way of solving the Azure function app error “Storage is not configured” is described in this article.
Storage is not configured
Opening an Azure Function App blade for the first time in over 3 months I saw a new screen & a warning shown above that I had not seen before. You can still view the old screen by switching to the classic experience. This does not display the same warning. Why are we getting this warning? This Azure function is over 18 months old and we do not observe any runtime issues.
Investigation
Following the Microsoft link you get to a page that says the storage account has been deleted and your app does not work. This does not make sense because our app still works.
Furthermore I have a AzureWebJobStorage Application setting that is set to a valid storage account.
The clue is in the last line of the Microsoft document. Event though this is a consumption plan function it does not have a WEBSITE_CONTENTAZUREFILECONNECTIONSTRING or WEBSITE_CONTENTSHARE setting. How do you set this?
A solution
The devops arm template for the function app does not contain these setting either. The relative code fragment is shown below.
{
"apiVersion": "2015-08-01",
"name": "[concat('edi-', parameters('webApps')[copyIndex()].name, '-', parameters('env'), '-app')]",
"type": "Microsoft.Web/sites",
"kind": "functionapp",
"dependsOn": [
"[resourceId('microsoft.insights/components/', variables('insightsName'))]"
],
"location": "[resourceGroup().location]",
"properties": {
"name": "[concat('edi-', parameters('webApps')[copyIndex()].name, '-', parameters('env'), '-app')]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('svcPlanName'))]",
"siteConfig": {
"appSettings": [
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~2"
},
{
"name": "AzureWebJobsDashboard",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountid'),'2015-05-01-preview').key1)]"
},
{
"name": "AzureWebJobsStorage",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountid'),'2015-05-01-preview').key1)]"
},
{
"name": "APPINSIGHTS_INSTRUMENTATIONKEY",
"value": "[reference(resourceId('microsoft.insights/components/', variables('insightsName')), '2015-05-01').InstrumentationKey]"
},
{
"name": "AzureKeyVaultURL",
"value": "[variables('azureKeyVaultURL')]"
}
]
}
},
Gratifyingly after adding the missing appsettings and redeploying the storage account warning disappears from the Azure portal blade. The modified code is
"apiVersion": "2015-08-01",
"name": "[concat('edi-', parameters('webApps')[copyIndex()].name, '-', parameters('env'), '-app')]",
"type": "Microsoft.Web/sites",
"kind": "functionapp",
"dependsOn": [
"[resourceId('microsoft.insights/components/', variables('insightsName'))]"
],
"location": "[resourceGroup().location]",
"properties": {
"name": "[concat('edi-', parameters('webApps')[copyIndex()].name, '-', parameters('env'), '-app')]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('svcPlanName'))]",
"siteConfig": {
"appSettings": [
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~2"
},
{
"name": "AzureWebJobsDashboard",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountid'),'2015-05-01-preview').key1)]"
},
{
"name": "AzureWebJobsStorage",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountid'),'2015-05-01-preview').key1)]"
},
{
"name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountid'),'2015-05-01-preview').key1)]"
},
{
"name": "WEBSITE_CONTENTSHARE",
"value": "[concat('edi-', parameters('webApps')[copyIndex()].name, '-', parameters('env'), '-app')]"
},
{
"name": "APPINSIGHTS_INSTRUMENTATIONKEY",
"value": "[reference(resourceId('microsoft.insights/components/', variables('insightsName')), '2015-05-01').InstrumentationKey]"
},
{
"name": "AzureKeyVaultURL",
"value": "[variables('azureKeyVaultURL')]"
}
]
}
},
Closing Remarks
I have shown that a missing application setting has surfaced a warning in the new application functions Azure Portal. This begs the question why have these settings been missing from our arm template for so long. Secondly if they are missing do they cause an Azure function to not scale properly.
Explore more on Logging with ILogger in Azure Functions