1

I have created an azure function app via Terraform and then deployed source code of function app into it via Azure DevOps CI & CD pipelines.

Next, I have deployed the Terraform scripts with some modifications then I am getting the following error for the first execution. But if I redeployed those TF scripts, then I am not getting the below error:

Error: failed to create App Service Source Control for "" (Resource Group ""): web.AppsClient#CreateOrUpdateSourceControl: Failure sending request: StatusCode=400 -- Original Error: Code="BadRequest" Message="Operation not supported: RepoUrl VSTSRM is not supported." Details=[{"Message":"Operation not supported: RepoUrl VSTSRM is not supported."},{"Code":"BadRequest"},{"ErrorEntity":{"Code":"BadRequest","ExtendedCode":"51024","Message":"Operation not supported: RepoUrl VSTSRM is not supported.","MessageTemplate":"Operation not supported: {0}","Parameters":["RepoUrl VSTSRM is not supported."]}}]

I am using the following terraform configuration:

 terraform {
  required_version = ">=0.14"
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "~>2.40.0"
    }
}

Function App terraform configuration file:

resource "azurerm_function_app" "function_app" {
  name                       = var.fn_name
  resource_group_name        = var.rg_name
  location                   = var.location
  tags                       = var.tags
  app_service_plan_id        = var.app_service_plan_id
  storage_account_name       = var.sa_name
  storage_account_access_key = var.sa_primary_access_key

  version = var.runtime_version

  enabled    = var.enabled
  https_only = var.https_only

  client_affinity_enabled = var.client_affinity_enabled

  app_settings = {
    FUNCTIONS_WORKER_RUNTIME       = "dotnet"
    WEBSITE_NODE_DEFAULT_VERSION   = "10.14.1"
    FUNCTION_APP_EDIT_MODE         = "readonly"
    WEBSITE_RUN_FROM_PACKAGE       = "1"
    APPINSIGHTS_INSTRUMENTATIONKEY = var.instrumentation_key
  }
  identity {
    type         = var.identity_type
    identity_ids = var.identity_type == "UserAssigned" ? var.identity_ids : null
  }
  site_config {
    always_on = var.always_on
    scm_type  = "None"
    cors {
      allowed_origins     = var.cors_allowed_origins
      support_credentials = var.cors_support_credentials
    }
  }
  lifecycle {
    ignore_changes = [
      app_settings["WEBSITE_RUN_FROM_PACKAGE"],
      site_config["scm_type"]
    ]
  }
}

Steps to reproduce:

  1. Deploy terraform config
  2. Deploy function app code via azure devops App Service task
  3. Make a tweak to terraform config (this might even be optional)
  4. Redeploy terraform

Before posting question here, I have spent lot of time on this issue in google and then found few articles related to this issue. But the issue remains same.

azurerm_app_service transient error - "RepoUrl VSTSRM is not supported"

So, can you please suggest me how to resolve the above error.

Pradeep
  • 5,101
  • 14
  • 68
  • 140
  • Did you try additing site_config { scm_type = "VSTSRM" } ? – Andriy Bilous Jan 28 '21 at 15:13
  • It seems to be a known Terraform issue reported here: https://github.com/terraform-providers/terraform-provider-azurerm/issues/9007, you could try mattduguid's workaround: https://github.com/terraform-providers/terraform-provider-azurerm/issues/9007#issuecomment-759065713 – Edward Han-MSFT Jan 29 '21 at 05:37
  • @AndriyBilous, I have tried `{ scm_type = "VSTSRM" }` with this option. But issue not fixed. – Pradeep Jan 29 '21 at 06:42
  • @EdwardHan-MSFT, I have tried mattduguid's workaround: https://github.com/terraform-providers/terraform-provider-azurerm/issues/9007#issuecomment-759065713. But issue is the same. – Pradeep Jan 29 '21 at 06:44
  • It seems that this issue persists with the higher version of Terraform(version >= 0.14), we suggest that you follow this thread: https://github.com/terraform-providers/terraform-provider-azurerm/issues/9007 to get the product group's latest feedback. – Edward Han-MSFT Feb 01 '21 at 03:26

0 Answers0