The name "" used for the App Service needs to be globally unique and isn't available

I am getting the below error while creation of Azure appservices through terraform script (version: 0.13 and 1.11 both),

Error: The name "" used for the App Service needs to be globally unique and isn't available: Site names only allow alphanumeric characters and hyphens, cannot start or end in a hyphen, and must be less than 64 chars.

It was working properly earlier in the azure devops release pipeline, but now I am having issue in azure devops release pipeline as well as in my local machine with different name… which I have tested it as a unique name… I am able to create azure appservice from the portal by using same name… but not working through terraform script…

I have tried to execute same version with another local machine with another different name, but no luck.

2 Likes

I do also have the same issue… i thought i am doing something wrong :frowning_face:

1 Like

Likewise; I have run the same terraform file several times in the past without issue, and as of today, I am unable to create an app service with it. The app service plan is created as expected, but the service itself fails to be created.

Encountering the same issue. Using:

terraform version: >= 0.14.9
azurerm provider version: ~> 2.65

The following features have been enabled:

provider "azurerm" {
  features {
    api_management {
      purge_soft_delete_on_destroy = true
    }

    key_vault {
      recover_soft_deleted_key_vaults = false
      purge_soft_delete_on_destroy    = true
    }

    resource_group {
      prevent_deletion_if_contains_resources = false
    }
  }
}

We have successfully run terraform apply and terraform destroy for this infrastructure in the past. This issue just came up today during the terraform apply.

I had the issue on azure webapps in an azure devops pipeline.

Tried hashicorp/azurerm v2.92.0 and it worked

Hope this helps.

2 Likes

Can confirm that azurerm provider version 2.92.0 works for this issue.
Example:

azurerm = {
      source  = "hashicorp/azurerm"
      version = "=2.92.0"
    }
1 Like

Hi all, looks like there’s more devving ongoing – PR for this fix: `azurerm_app_service` - fix name availability check request by jackofallops · Pull Request #15062 · hashicorp/terraform-provider-azurerm · GitHub

Pull in using terraform init --upgrade

2 Likes