存储帐户名称已存在

存储帐户名称已存在

当我尝试运行底部的代码时,出现以下错误(无论我将存储帐户命名为什么)当前它被命名为“函数”,但我可以将其称为“bannanas”,它会输出相同的错误吗?

我遇到的错误:(

“发生了 1 个错误:

  • azurerm_storage_account.test:发生了 1 个错误:

  • azurerm_storage_account.test:创建 Azure 存储帐户“functions”时出错:storage.AccountsClient#Create:发送请求失败:StatusCode=0 -- 原始错误:autorest/azure:服务返回错误。状态=代码=“StorageAccountAlreadyTaken”消息=“名为 functions 的存储帐户已被占用。”

我的代码:

resource "azurerm_resource_group" "test" {
  name     = "azure-functions-cptest-rg"
  location = "westus2"
}

resource "azurerm_storage_account" "test" {
  name                     = "functionsapptestsa"
  resource_group_name      = "${azurerm_resource_group.test.name}"
  location                 = "${azurerm_resource_group.test.location}"
  account_tier             = "Standard"
  account_replication_type = "LRS"
}

resource "azurerm_app_service_plan" "test" {
  name                = "azure-functions-test-service-plan"
  location            = "${azurerm_resource_group.test.location}"
  resource_group_name = "${azurerm_resource_group.test.name}"
  kind                = "FunctionApp"

  sku {
    tier = "Dynamic"
    size = "Y1"
  }
}

resource "azurerm_function_app" "test" {
  name                      = "test-azure-functions"
  location                  = "${azurerm_resource_group.test.location}"
  resource_group_name       = "${azurerm_resource_group.test.name}"
  app_service_plan_id       = "${azurerm_app_service_plan.test.id}"
  storage_connection_string = "${azurerm_storage_account.test.primary_connection_string}"
}

答案1

发生这种情况的原因是存储帐户名称在整个 Azure 中都是唯一的,请尝试一些更独特的名称 :)

喜欢:functions12df3f4g或者rebgh35h3brw4t3ghr

相关内容