Hi I'am having issues with deploying the app service through azure portal and terraform.

When I try to deploy the service I get this error The subscription 'xxxx-xxxx-xxxx' is not allowed to create or update the serverfarm. But 2 days ago I was able to deploy without any issues.

I checked on github and azure learn but had no luck, does anyone have any idea why it's not working?

[fixed]

Hey everyone, Just wanted to give you a quick update – the issue seems to have resolved itself. I reached out to the Azure support team and had a couple of conversations with them over the last three days. We went through the classic troubleshooting steps like changing the plan, resource group, and location, but unfortunately, nothing seemed to help. Interestingly, I decided to try deploying again through the Azure portal every morning to see if there were any changes. Yesterday, to my surprise, the deployment went through successfully. Sometimes, things just work out on their own! Thanks for your support and suggestions.

1

There are 1 best solutions below

4
On

The subscription 'xxxx-xxxx-xxxx' is not allowed to create or update the serverfarm:

Need to check below:

  • Make sure that you are attempting to create or update both the service plan and app service in the same region to prevent conflicts.

  • Verify the existence of any Azure Policies created by other users that might impact or restrict the creation or modification of the server farm or related resources.

  • Check the providers list and register Microsoft.Web provider if is not existed with the help of below CLI commands.

az provider register --namespace Microsoft.Web

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

enter image description here

  • Clear all the logged in subscriptions cache using az account clear command and set the required subscription freshly using az account set --name command. Now if required login into Az account with az login command.

  • Verify the Terraform code configuration and ensure that the app_service_plan_id is accurately defined and associated with the identical resource group as the App Service.

After checking all the above, I tried deploying an app service in a dedicated app service plan and the deployment was successful as shown below.

Template taken from azurerm_app_service terraform registry.

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"
  }

Deployment succeeded:

enter image description here

enter image description here

Reference discussion for the relevant issue.