2

I am deploying Azure function app using terraform code below.

resource "azurerm_function_app" "function_app" {
  name                       = var.function_app_name
  resource_group_name        = var.resource_group_name
  location                   = var.location
  app_service_plan_id        = azurerm_app_service_plan.app_service_plan.id
  storage_account_name       = azurerm_storage_account.function_app_sa.name
  storage_account_access_key = azurerm_storage_account.function_app_sa.primary_connection_string
  version                    = "~3"
  app_settings                 = {
    FUNCTIONS_WORKER_RUNTIME = "dotnet"
  }
  site_config {
    always_on                = true
  }
  identity {
      type = "SystemAssigned"
  }
  tags                       = local.tags
}

The terraform creates the azure resource without any issues. But after the deployment once I log into the portal and go to the resource page, I see the error on the overview page.

Microsoft.WindowsAzure.Storage: Duplicate setting 'AccountName' found.

I am not sure if I understand the error and where to start troubleshooting. Any help would be greatly appreciated.

P.S: There are no functions deployed yet. It is an empty resource.

  • 2
    According to your script, you use a connection string as storage access key. Please update your script as `storage_account_access_key = azurerm_storage_account.function_app_sa.primary_access_key` – Jim Xu Sep 10 '20 at 08:40

1 Answers1

1

Update:

When deployed with Terraform it is adding a config setting on the Function app, AzureWebJobsDashboard which according to Microsoft docs is only required for version ~1. We are deploying it as version ~3. But still terraform adds this config setting which creates this issue. When I delete the config setting the error is cleared.

We had to switch to using ARM template deployment till the issue is fixed with Terraform. I have raised the bug - https://github.com/terraform-providers/terraform-provider-azurerm/issues/8432 It will help if anyone facing this issue can upvote this issue.