Azure 应用程序服务部署失败不允许订阅“xxxx-xxxx-xxxx”创建或更新服务器场

问题描述 投票:0回答:1

您好,我在通过 azure 门户和 terraform 部署应用程序服务时遇到问题。

当我尝试部署服务时,出现此错误:不允许订阅“xxxx-xxxx-xxxx”创建或更新服务器场。但 2 天前我可以毫无问题地部署。

我检查了 github 和 azure learn 但没有运气,有人知道为什么它不起作用吗?

azure web-applications terraform appservice
1个回答
0
投票

订阅“xxxx-xxxx-xxxx”不允许创建或更新服务器场:

需要检查以下内容:

  • 确保您尝试在同一区域中创建或更新服务计划和应用服务,以防止冲突。

  • 验证其他用户创建的任何 Azure 策略是否存在,这些策略可能会影响或限制服务器场或相关资源的创建或修改。

  • 检查提供商列表并注册

    Microsoft.Web
    提供商(如果不存在),借助以下 CLI 命令。

az provider register --namespace Microsoft.Web

az provider list --query "[namespace=='Microsoft.Web'].resourceTypes[].resourceType"

enter image description here

  • 使用

    az account clear
    命令清除所有登录的订阅缓存,并使用
    az account set --name
    命令重新设置所需的订阅。现在,如果需要,请使用
    az login
    命令登录 Az 帐户。

  • 验证 Terraform 代码配置并确保

    app_service_plan_id
    已准确定义并与与
    App Service
    相同的资源组关联。

检查完上述所有内容后,我尝试在专用应用服务计划中部署应用服务,部署成功,如下所示。

模板取自

azurerm_app_service
terraform 注册表。

provider "azurerm" {
  features  {}
}

resource "azurerm_resource_group" "example" {
  name     = "examplejahresources"
  location = "West Europe"
}

resource "azurerm_app_service_plan" "example" {
  name                = "jahplan"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name

  sku {
    tier = "Standard"
    size = "S1"
  }
}

resource "azurerm_app_service" "example" {
  name                = "jahservice"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  app_service_plan_id = azurerm_app_service_plan.example.id

  site_config {
    dotnet_framework_version = "v4.0"
  }

  app_settings = {
    "SOME_KEY" = "some-value"
  }

  connection_string {
    name  = "Database"
    type  = "SQLServer"
    value = "Server=some-server.mydomain.com;Integrated Security=SSPI"
  }

部署成功:

enter image description here

enter image description here

参考相关问题的讨论。

© www.soinside.com 2019 - 2024. All rights reserved.