terraform-provider-azurerm: azurerm_app_service transient error - "RepoUrl VSTSRM is not supported"

Community Note

  • Please vote on this issue by adding a šŸ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave ā€œ+1ā€ or ā€œme tooā€ comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform (and AzureRM Provider) Version

$ /c/tools/Terraform/terraform0_12_29.exe -v
Terraform v0.12.29
+ provider.azuread v0.11.0
+ provider.azurerm v2.23.0
+ provider.local v1.4.0
+ provider.random v2.3.0

Affected Resource(s)

  • azurerm_function_app, azurerm_app_service

Terraform Configuration Files


resource "azurerm_function_app" "mgmtportal_fa" {
  name                      = "${local.resourceNamePrefix}${local.nameschemeAffixes.azureFunction}${var.functionAppName}"
  location                  = "${azurerm_resource_group.rg.location}"
  resource_group_name       = "${azurerm_resource_group.rg.name}"
  app_service_plan_id       = "${azurerm_app_service_plan.mgmtportal_asp.id}"
  storage_connection_string = "${azurerm_storage_account.mgmtportal_sa.primary_connection_string}"
  version                   = "~3"
  app_settings = {
     // ...
  }
  site_config {
    always_on = true
  }
  
  identity {
    type = "SystemAssigned"
  }
}

Debug Output

Error Message
Error: failed to create App Service Source Control for "aitifdevaffunctions" (Resource Group "aitdevelopment"): 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."]}}]

on main.tf line 369, in resource "azurerm_function_app" "mgmtportal_fa":
369: resource "azurerm_function_app" "mgmtportal_fa" {

Failing Request
2020-08-19T10:03:49.1545190Z 2020-08-19T12:03:49.151+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: PUT /subscriptions/99e0a02c-f0ab-41ad-8de7-d621ce36a09e/resourceGroups/aitdevelopment/providers/Microsoft.Web/sites/aitifdevaffunctions/sourcecontrols/web?api-version=2019-08-01 HTTP/1.1
2020-08-19T10:03:49.1545852Z 2020-08-19T12:03:49.151+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Host: management.azure.com
2020-08-19T10:03:49.1546672Z 2020-08-19T12:03:49.151+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: User-Agent: Go/go1.14.5 (amd64-windows) go-autorest/v14.0.0 Azure-SDK-For-Go/v44.2.0 web/2019-08-01 HashiCorp Terraform/0.12.29 (+https://www.terraform.io) Terraform Plugin SDK/1.13.1 terraform-provider-azurerm/2.23.0 VSTS_3a20467b-7171-4b7e-a40b-19e133f2093a_build_354_0 pid-222c6c49-1b0a-5959-a213-6608f9eb8820
2020-08-19T10:03:49.1547477Z 2020-08-19T12:03:49.151+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Content-Length: 135
2020-08-19T10:03:49.1547949Z 2020-08-19T12:03:49.151+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Content-Type: application/json; charset=utf-8
2020-08-19T10:03:49.1548480Z 2020-08-19T12:03:49.151+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: X-Ms-Correlation-Request-Id: c1d1a14c-1989-abf4-4e88-a526f0abfa49
2020-08-19T10:03:49.1548981Z 2020-08-19T12:03:49.151+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Accept-Encoding: gzip
2020-08-19T10:03:49.1549387Z 2020-08-19T12:03:49.151+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: 
2020-08-19T10:03:49.1549989Z 2020-08-19T12:03:49.151+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: {"properties":{"repoUrl":"VSTSRM","branch":"master","isManualIntegration":false,"deploymentRollbackEnabled":false,"isMercurial":false}}
2020-08-19T10:03:49.3271152Z 2020/08/19 12:03:49 [TRACE] dag/walk: vertex "local_file.mgmt_sql_init_sql" is waiting for "azurerm_function_app.mgmtportal_fa"
2020-08-19T10:03:49.6218201Z 2020-08-19T12:03:49.621+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: [DEBUG] AzureRM Response for https://management.azure.com/subscriptions/99e0a02c-f0ab-41ad-8de7-d621ce36a09e/resourceGroups/aitdevelopment/providers/Microsoft.Web/sites/aitifdevaffunctions/sourcecontrols/web?api-version=2019-08-01: 
2020-08-19T10:03:49.6219247Z 2020-08-19T12:03:49.621+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: HTTP/2.0 400 Bad Request
2020-08-19T10:03:49.6219696Z 2020-08-19T12:03:49.621+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Content-Length: 459
2020-08-19T10:03:49.6220135Z 2020-08-19T12:03:49.621+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Cache-Control: no-cache
2020-08-19T10:03:49.6220609Z 2020-08-19T12:03:49.621+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Content-Type: application/json; charset=utf-8
2020-08-19T10:03:49.6221096Z 2020-08-19T12:03:49.621+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Date: Wed, 19 Aug 2020 10:03:49 GMT
2020-08-19T10:03:49.6221550Z 2020-08-19T12:03:49.621+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Expires: -1
2020-08-19T10:03:49.6221961Z 2020-08-19T12:03:49.621+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Pragma: no-cache
2020-08-19T10:03:49.6222398Z 2020-08-19T12:03:49.621+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Server: Microsoft-IIS/10.0
2020-08-19T10:03:49.6222891Z 2020-08-19T12:03:49.621+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Strict-Transport-Security: max-age=31536000; includeSubDomains
2020-08-19T10:03:49.6223396Z 2020-08-19T12:03:49.621+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: X-Aspnet-Version: 4.0.30319
2020-08-19T10:03:49.6224054Z 2020-08-19T12:03:49.621+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: X-Content-Type-Options: nosniff
2020-08-19T10:03:49.6224588Z 2020-08-19T12:03:49.621+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: X-Ms-Correlation-Request-Id: c1d1a14c-1989-abf4-4e88-a526f0abfa49
2020-08-19T10:03:49.6225716Z 2020-08-19T12:03:49.621+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: X-Ms-Ratelimit-Remaining-Subscription-Writes: 1195
2020-08-19T10:03:49.6226250Z 2020-08-19T12:03:49.621+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: X-Ms-Request-Id: e2b2adc5-b93e-4fd8-b715-0aec297c41cd
2020-08-19T10:03:49.6226845Z 2020-08-19T12:03:49.621+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: X-Ms-Routing-Request-Id: GERMANYWESTCENTRAL:20200819T100349Z:e2b2adc5-b93e-4fd8-b715-0aec297c41cd
2020-08-19T10:03:49.6227761Z 2020-08-19T12:03:49.621+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: X-Powered-By: ASP.NET
2020-08-19T10:03:49.6228480Z 2020-08-19T12:03:49.621+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: 
2020-08-19T10:03:49.6229625Z 2020-08-19T12:03:49.621+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: {"Code":"BadRequest","Message":"Operation not supported: RepoUrl VSTSRM is not supported.","Target":null,"Details":[{"Message":"Operation not supported: RepoUrl VSTSRM is not supported."},{"Code":"BadRequest"},{"ErrorEntity":{"ExtendedCode":"51024","MessageTemplate":"Operation not supported: {0}","Parameters":["RepoUrl VSTSRM is not supported."],"Code":"BadRequest","Message":"Operation not supported: RepoUrl VSTSRM is not supported."}}],"Innererror":null}
Likely problematic response (before the error happens)
2020-08-19T10:02:11.7321231Z 2020-08-19T12:02:11.729+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: [DEBUG] AzureRM Request: 
2020-08-19T10:02:11.7322258Z 2020-08-19T12:02:11.729+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: GET /subscriptions/99e0a02c-f0ab-41ad-8de7-d621ce36a09e/resourceGroups/aitdevelopment/providers/Microsoft.Web/sites/aitifdevaffunctions/config/web?api-version=2019-08-01 HTTP/1.1
2020-08-19T10:02:11.7323280Z 2020-08-19T12:02:11.729+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Host: management.azure.com
2020-08-19T10:02:11.7324605Z 2020-08-19T12:02:11.729+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: User-Agent: Go/go1.14.5 (amd64-windows) go-autorest/v14.0.0 Azure-SDK-For-Go/v44.2.0 web/2019-08-01 HashiCorp Terraform/0.12.29 (+https://www.terraform.io) Terraform Plugin SDK/1.13.1 terraform-provider-azurerm/2.23.0 VSTS_3a20467b-7171-4b7e-a40b-19e133f2093a_build_354_0 pid-222c6c49-1b0a-5959-a213-6608f9eb8820
2020-08-19T10:02:11.7325998Z 2020-08-19T12:02:11.729+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: X-Ms-Correlation-Request-Id: 51f9c150-2d49-80c3-8936-9a9e9470cf5b
2020-08-19T10:02:11.7326770Z 2020-08-19T12:02:11.729+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Accept-Encoding: gzip
2020-08-19T10:02:11.7327382Z 2020-08-19T12:02:11.729+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: 
2020-08-19T10:02:11.7327947Z 2020-08-19T12:02:11.729+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: 
2020-08-19T10:02:11.8261663Z 2020-08-19T12:02:11.825+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: [DEBUG] AzureRM Response for https://management.azure.com/subscriptions/99e0a02c-f0ab-41ad-8de7-d621ce36a09e/resourceGroups/aitdevelopment/providers/Microsoft.Web/sites/aitifdevaffunctions/config/web?api-version=2019-08-01: 
2020-08-19T10:02:11.8263146Z 2020-08-19T12:02:11.825+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: HTTP/2.0 200 OK
2020-08-19T10:02:11.8263968Z 2020-08-19T12:02:11.825+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Cache-Control: no-cache
2020-08-19T10:02:11.8264764Z 2020-08-19T12:02:11.825+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Content-Type: application/json
2020-08-19T10:02:11.8266111Z 2020-08-19T12:02:11.825+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Date: Wed, 19 Aug 2020 10:02:08 GMT
2020-08-19T10:02:11.8266953Z 2020-08-19T12:02:11.825+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Expires: -1
2020-08-19T10:02:11.8267411Z 2020-08-19T12:02:11.825+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Pragma: no-cache
2020-08-19T10:02:11.8267845Z 2020-08-19T12:02:11.825+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Server: Microsoft-IIS/10.0
2020-08-19T10:02:11.8268346Z 2020-08-19T12:02:11.825+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Strict-Transport-Security: max-age=31536000; includeSubDomains
2020-08-19T10:02:11.8268843Z 2020-08-19T12:02:11.825+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Vary: Accept-Encoding
2020-08-19T10:02:11.8269291Z 2020-08-19T12:02:11.825+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: X-Aspnet-Version: 4.0.30319
2020-08-19T10:02:11.8269757Z 2020-08-19T12:02:11.825+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: X-Content-Type-Options: nosniff
2020-08-19T10:02:11.8270269Z 2020-08-19T12:02:11.825+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: X-Ms-Correlation-Request-Id: 51f9c150-2d49-80c3-8936-9a9e9470cf5b
2020-08-19T10:02:11.8271571Z 2020-08-19T12:02:11.825+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: X-Ms-Ratelimit-Remaining-Subscription-Reads: 11990
2020-08-19T10:02:11.8272384Z 2020-08-19T12:02:11.825+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: X-Ms-Request-Id: 6f279179-6bcb-4308-8fb6-a2007b1fc03a
2020-08-19T10:02:11.8273954Z 2020-08-19T12:02:11.825+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: X-Ms-Routing-Request-Id: GERMANYWESTCENTRAL:20200819T100209Z:02ad04d3-0df4-400e-a381-6fca02eefb8c
2020-08-19T10:02:11.8275023Z 2020-08-19T12:02:11.825+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: X-Powered-By: ASP.NET
2020-08-19T10:02:11.8275456Z 2020-08-19T12:02:11.825+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: 
2020-08-19T10:02:11.8282150Z 2020-08-19T12:02:11.825+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: {"id":"/subscriptions/99e0a02c-f0ab-41ad-8de7-d621ce36a09e/resourceGroups/aitdevelopment/providers/Microsoft.Web/sites/aitifdevaffunctions/config/web","name":"aitifdevaffunctions","type":"Microsoft.Web/sites/config","location":"West Europe","tags":{},"properties":{"numberOfWorkers":1,"defaultDocuments":["Default.htm","Default.html","Default.asp","index.htm","index.html","iisstart.htm","default.aspx","index.php"],"netFrameworkVersion":"v4.0","phpVersion":"5.6","pythonVersion":"","nodeVersion":"","powerShellVersion":"","linuxFxVersion":"","windowsFxVersion":null,"requestTracingEnabled":false,"remoteDebuggingEnabled":false,"remoteDebuggingVersion":"VS2019","httpLoggingEnabled":false,"azureMonitorLogCategories":null,"acrUseManagedIdentityCreds":false,"acrUserManagedIdentityID":null,"logsDirectorySizeLimit":35,"detailedErrorLoggingEnabled":false,"publishingUsername":"$aitifdevaffunctions","publishingPassword":null,"appSettings":null,"azureStorageAccounts":{},"metadata":null,"connectionStrings":null,"machineKey":null,"handlerMappings":null,"documentRoot":null,"scmType":"VSTSRM","use32BitWorkerProcess":true,"webSocketsEnabled":false,"alwaysOn":true,"javaVersion":null,"javaContainer":null,"javaContainerVersion":null,"appCommandLine":"","managedPipelineMode":"Integrated","virtualApplications":[{"virtualPath":"/","physicalPath":"site\\wwwroot","preloadEnabled":true,"virtualDirectories":null}],"winAuthAdminState":0,"winAuthTenantState":0,"customAppPoolIdentityAdminState":false,"customAppPoolIdentityTenantState":false,"runtimeADUser":null,"runtimeADUserPassword":null,"loadBalancing":"LeastRequests","routingRules":[],"experiments":{"rampUpRules":[]},"limits":null,"autoHealEnabled":false,"autoHealRules":null,"tracingOptions":null,"vnetName":"","vnetRouteAllEnabled":false,"siteAuthEnabled":false,"siteAuthSettings":{"enabled":null,"unauthenticatedClientAction":null,"tokenStoreEnabled":null,"allowedExternalRedirectUrls":null,"defaultProvider":null,"clientId":null,"clientSecret":null,"clientSecretSettingName":null,"clientSecretCertificateThumbprint":null,"issuer":null,"allowedAudiences":null,"additionalLoginParams":null,"isAadAutoProvisioned":false,"aadClaimsAuthorization":null,"googleClientId":null,"googleClientSecret":null,"googleClientSecretSettingName":null,"googleOAuthScopes":null,"facebookAppId":null,"facebookAppSecret":null,"facebookAppSecretSettingName":null,"facebookOAuthScopes":null,"gitHubClientId":null,"gitHubClientSecret":null,"gitHubClientSecretSettingName":null,"gitHubOAuthScopes":null,"twitterConsumerKey":null,"twitterConsumerSecret":null,"twitterConsumerSecretSettingName":null,"microsoftAccountClientId":null,"microsoftAccountClientSecret":null,"microsoftAccountClientSecretSettingName":null,"microsoftAccountOAuthScopes":null},"cors":{"allowedOrigins":[],"supportCredentials":false},"push":null,"apiDefinition":null,"apiManagementConfig":null,"autoSwapSlotName":null,"localMySqlEnabled":false,"managedServiceIdentityId":18048,"xManagedServiceIdentityId":null,"ipSecurityRestrictions":[{"ipAddress":"Any","action":"Allow","priority":1,"name":"Allow all","description":"Allow all access"}],"scmIpSecurityRestrictions":[{"ipAddress":"Any","action":"Allow","priority":1,"name":"Allow all","description":"Allow all access"}],"scmIpSecurityRestrictionsUseMain":false,"http20Enabled":false,"minTlsVersion":"1.2","scmMinTlsVersion":"1.0","ftpsState":"AllAllowed","preWarmedInstanceCount":0,"functionAppScaleLimit":0,"healthCheckPath":null,"fileChangeAuditEnabled":false,"functionsRuntimeScaleMonitoringEnabled":false,"websiteTimeZone":null,"minimumElasticInstanceCount":0}}


2020-08-19T10:02:11.8288880Z 2020-08-19T12:02:11.825+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: [DEBUG] AzureRM Request: 
2020-08-19T10:02:11.8289568Z 2020-08-19T12:02:11.825+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: GET /subscriptions/99e0a02c-f0ab-41ad-8de7-d621ce36a09e/resourceGroups/aitdevelopment/providers/Microsoft.Web/sites/aitifdevaffunctions/sourcecontrols/web?api-version=2019-08-01 HTTP/1.1
2020-08-19T10:02:11.8290242Z 2020-08-19T12:02:11.825+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Host: management.azure.com
2020-08-19T10:02:11.8291069Z 2020-08-19T12:02:11.825+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: User-Agent: Go/go1.14.5 (amd64-windows) go-autorest/v14.0.0 Azure-SDK-For-Go/v44.2.0 web/2019-08-01 HashiCorp Terraform/0.12.29 (+https://www.terraform.io) Terraform Plugin SDK/1.13.1 terraform-provider-azurerm/2.23.0 VSTS_3a20467b-7171-4b7e-a40b-19e133f2093a_build_354_0 pid-222c6c49-1b0a-5959-a213-6608f9eb8820
2020-08-19T10:02:11.8291936Z 2020-08-19T12:02:11.825+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: X-Ms-Correlation-Request-Id: 51f9c150-2d49-80c3-8936-9a9e9470cf5b
2020-08-19T10:02:11.8292439Z 2020-08-19T12:02:11.825+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Accept-Encoding: gzip
2020-08-19T10:02:11.8292846Z 2020-08-19T12:02:11.825+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: 
2020-08-19T10:02:11.8293223Z 2020-08-19T12:02:11.825+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: 
2020-08-19T10:02:12.0698984Z 2020-08-19T12:02:12.068+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: [DEBUG] AzureRM Response for https://management.azure.com/subscriptions/99e0a02c-f0ab-41ad-8de7-d621ce36a09e/resourceGroups/aitdevelopment/providers/Microsoft.Web/sites/aitifdevaffunctions/sourcecontrols/web?api-version=2019-08-01: 
2020-08-19T10:02:12.0700200Z 2020-08-19T12:02:12.068+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: HTTP/2.0 200 OK
2020-08-19T10:02:12.0700650Z 2020-08-19T12:02:12.068+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Cache-Control: no-cache
2020-08-19T10:02:12.0701303Z 2020-08-19T12:02:12.068+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Content-Type: application/json
2020-08-19T10:02:12.0702116Z 2020-08-19T12:02:12.068+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Date: Wed, 19 Aug 2020 10:02:08 GMT
2020-08-19T10:02:12.0702732Z 2020-08-19T12:02:12.068+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Etag: "1D6760C83016480"
2020-08-19T10:02:12.0703273Z 2020-08-19T12:02:12.068+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Expires: -1
2020-08-19T10:02:12.0703782Z 2020-08-19T12:02:12.068+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Pragma: no-cache
2020-08-19T10:02:12.0704297Z 2020-08-19T12:02:12.068+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Server: Microsoft-IIS/10.0
2020-08-19T10:02:12.0704926Z 2020-08-19T12:02:12.068+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Strict-Transport-Security: max-age=31536000; includeSubDomains
2020-08-19T10:02:12.0705541Z 2020-08-19T12:02:12.068+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: Vary: Accept-Encoding
2020-08-19T10:02:12.0706074Z 2020-08-19T12:02:12.068+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: X-Aspnet-Version: 4.0.30319
2020-08-19T10:02:12.0706640Z 2020-08-19T12:02:12.068+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: X-Content-Type-Options: nosniff
2020-08-19T10:02:12.0707522Z 2020-08-19T12:02:12.068+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: X-Ms-Correlation-Request-Id: 51f9c150-2d49-80c3-8936-9a9e9470cf5b
2020-08-19T10:02:12.0708539Z 2020-08-19T12:02:12.068+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: X-Ms-Ratelimit-Remaining-Subscription-Reads: 11989
2020-08-19T10:02:12.0709402Z 2020-08-19T12:02:12.068+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: X-Ms-Request-Id: d994b01a-c9d6-4290-9c66-169b9b0e4214
2020-08-19T10:02:12.0710015Z 2020-08-19T12:02:12.068+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: X-Ms-Routing-Request-Id: GERMANYWESTCENTRAL:20200819T100209Z:fc3f0e7c-d8cc-4c54-a93d-f76d7a79757a
2020-08-19T10:02:12.0710570Z 2020-08-19T12:02:12.068+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: X-Powered-By: ASP.NET
2020-08-19T10:02:12.0710978Z 2020-08-19T12:02:12.068+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: 
2020-08-19T10:02:12.0712046Z 2020-08-19T12:02:12.068+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5.exe: {"id":"/subscriptions/99e0a02c-f0ab-41ad-8de7-d621ce36a09e/resourceGroups/aitdevelopment/providers/Microsoft.Web/sites/aitifdevaffunctions/sourcecontrols/web","name":"aitifdevaffunctions","type":"Microsoft.Web/sites/sourcecontrols","location":"West Europe","tags":{},"properties":{"repoUrl":"VSTSRM","branch":null,"isManualIntegration":false,"isGitHubAction":false,"deploymentRollbackEnabled":false,"isMercurial":false,"provisioningState":"Succeeded"}}

Expected Behavior

Deployment should work

Actual Behavior

apply fails with error

Steps to Reproduce

  1. terraform apply in our CI pipeline

Important Factoids

I feel like this has been introduced in #7945, as we don’t even want to set/use these fields. My assumption is that when we deploy to the webapp via Azure DevOps (different pipeline) that the field is set with the VSTSRM-Value and then terraform somehow reads that and tries to change it (it shows in the diff, that it tries to change to None).

Interestingly, even when I set

  lifecycle {
    ignore_changes = [
      site_config.0.scm_type,
      source_control
    ]
  }

the deployment fails. I’m not sure why the terraform provider should ever try to write this field, given the above configurations.

I’m still testing but I think downgrading to 2.22.0 should work.

We have a function app and a web app, and it seems like either both work or both fail in a single deployment. If my assumption is correct that this happens when the function or web app are deployed (or are being deployed) by the other pipeline this seems reasonable. This also explains why I cannot reproduce this with another infrastructure I have deployed myself, this only happens in our CI/CD pipeline.

References

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 66
  • Comments: 42 (6 by maintainers)

Most upvoted comments

@jackofallops have you seen this already by any chance? Might be related to the change where you exposed source_control.

I have now (I’m head-down on another issue at the moment) - ADO appears to be a special case there. The API prevents updating the source_control items if site_config.scm_type is set, which is why it’s cleared on update. It might be that we can exclude VSTSRM from that (that value has only relatively recently been supported by the SDK). I’ll take a look as soon as I can for a potential solution.

I’m confused why this doesn’t have a bug label? It looks like a Bug to me?

I have the exact same problem with the new version 2.23.0. I wasn’t having the issue with version 2.22.0. I’ll try to download and see if problem still occurs.

I reverted to 2.22.0, removed the source_control object attributes manual_integration, rollback_enabled and use_mercurial in my state file, and it worked.

I’m still seeing this error on 2.29. What’s really strange is that the Error 400 on ā€˜Apply’ happens every other build. My repo is in github and my pipeline is in ADO. I don’t have this issue on 2.22, but confirmed it started on 2.23.

Error: failed to create App Service Source Control for "<redacted>" (Resource Group "<redacted>"): 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 don’t have scm_type defined in my azure function and the plan doesn’t show anything changing in this regard.

My function app:

resource "azurerm_function_app" "api" {
  name                      = "${var.appName1}-${var.environment}"
  resource_group_name       = azurerm_resource_group.rg.name
  location                  = azurerm_resource_group.rg.location
  app_service_plan_id       = azurerm_app_service_plan.sp.id
  storage_account_name        = azurerm_storage_account.function.name
  storage_account_access_key  = azurerm_storage_account.function.primary_access_key
  version                   = "~3"
  os_type                   = "linux"
  https_only                = true

  identity { type = "SystemAssigned" }

  auth_settings {
    enabled = true
    default_provider    = "AzureActiveDirectory"
    runtime_version     = "~1"
    token_store_enabled = true
    issuer = "<redacted>"

    active_directory {
      client_id = var.aad_client
      allowed_audiences = var.audiences
    }

    unauthenticated_client_action = "RedirectToLoginPage"
  }

  app_settings = {
    https_only = true
    FUNCTIONS_WORKER_RUNTIME = "node"
    WEBSITE_NODE_DEFAULT_VERSION = "~10"
    FUNCTION_APP_EDIT_MODE = "readonly"
    APPINSIGHTS_INSTRUMENTATIONKEY = azurerm_application_insights.api.instrumentation_key
    AZURE_STORAGE_CONNECTION_STRING = "<redacted>",
    STORAGEACCOUNTNAME = azurerm_storage_account.data.name
  }

  site_config {
    cors {
      allowed_origins = var.cors
    }
  }
}

I think I may be able to help with this having smashed by head against it for over a month.

What I have found is that this is actually not an issue with Terraform at all in our case, but is instead an issue caused by the way we are applying infrastructure changes. Here is what we have…

Terraform (obviously) that builds our resource groups and components (including an app_service) Azure Devops Release pipeline with a stage that uses the ā€œAzure App Service deployā€ step to deploy our web site

This step in the azure dev ops release pipeline deploys the code using a ZIP deploy method (that’s built-in behavior) but it seems it does a little more than that. It actually sets the startup command ā€œnode app.jsā€ AND the scm_type to ā€œVSTSRMā€

So, we have the terraform scripts that set scm_type to NONE and then the ā€œAzure App Service deployā€ step was setting it to VSTSRM. When we next ran terraform it attempts to change the setting in situ and BANG!!!

Setting scm_type to VSTSRM in the terraform now means that it never tries to unset it.

@MelHarbour findings tie up with what we’re seeing as well

Setting site_config{ scm_type = "None" } didn’t work for me

@jackofallops have you seen this already by any chance? Might be related to the change where you exposed source_control.

After much debugging and trying simple cases, we’ve been able to pin down a little more accurately what’s going wrong, and we believe that some of the problems are coming from the Azure CLI (or whatever the provider is using to connect to Azure under the hood).

Do the first two steps suggested by @kensykora in the steps to reproduce and then run the following command with the Azure CLI against your newly created App Service:

az webapp deployment source show --name "<your app service>" -resource-group "<your resource group>"

Then you’ll get some output that will show you (amongst other things, a repoUrl of VSTSRM. If you then try and run the following command:

az webapp deployment source config --repo-url "VSTSRM" --name "<your app service>" -resource-group "<your resource group>"

It will error (with much the same error as quoted in the original issue). Our conclusion - the values from Microsoft don’t round trip correctly. The Terraform provider is attempting to run a command to send updates to the source config section as above (not sure why it does, since nothing has changed).

If you let a terraform apply fail as above and then look at the source config using the CLI, you’ll see that repoUrl has become set to null. Which you also can’t round trip into the CLI.

Not really sure what that means with regard to a fix. It feels like the provider shouldn’t really be calling out to Azure to set something that hasn’t changed, but then it also feels like the values ought to round trip.

Do you try this :

site_config { scm_type = ā€œVSTSRMā€ }

lifecycle { ignore_changes = [ app_settings[ā€œWEBSITE_RUN_FROM_PACKAGEā€], app_settings[ā€œMSDEPLOY_RENAME_LOCKED_FILESā€], site_config[ā€œremote_debugging_enabledā€],
site_config[ā€œremote_debugging_versionā€],
site_config[ā€œscm_typeā€],
id, ] }

When i have added site_config[ā€œscm_typeā€] i not longer get the error.

Kind regards,

@kensykora a potential work around is to use AzureCLI@2 and a az functionapp deployment source config-zip script instead. this is what we do now. TBH I found the AzureFunctionApp@1 unreliable and opaque.

Hi @sonic1981 - I’m just back form vacation, so I’ve not delved deeply into this, but in your example above you appear to explicitly set scm_type = "None" on a resource that has existing VSTSRM type source_control. This will prevent the workaround in PR8531 from skipping over the code that would try to resend the source_control config, resulting in the previous issue. Are you able to try without overriding the scm_type?

I’ve just upgraded to 2.29.0 and I’ve just received this error message:

ā€œParametersā€:[ā€œRepoUrl VSTSRM is not supported.ā€]}}]

So I don’t think this is fixed @jackofallops

Here’s the plan that triggers the issue:

resource "azurerm_function_app" "process" {
        app_service_plan_id            = "<redacted>"
      ~ app_settings                   = {
            "APPINSIGHTS_INSTRUMENTATIONKEY"             = "<redacted>"
            "APPLICATIONINSIGHTS_CONNECTION_STRING"      = "<redacted>"
            "ApplicationInsightsAgent_EXTENSION_VERSION" = "~2"
          - "AzureWebJobs.Process.Disabled"              = "1" -> null
            "FUNCTIONS_WORKER_RUNTIME"                   = "dotnet"

          - "SCM_DO_BUILD_DURING_DEPLOYMENT"             = "false" -> null
            "WEBSITES_ENABLE_APP_SERVICE_STORAGE"        = "true"
            "WEBSITE_ENABLE_SYNC_UPDATE_SITE"            = "true"
            "WEBSITE_RUN_FROM_PACKAGE"                   = ""
        }
        client_affinity_enabled        = false
        daily_memory_time_quota        = 0
        default_hostname               = "<redacted>"
        enable_builtin_logging         = false
        enabled                        = true
        https_only                     = true
        id                             = "<redacted>"
        kind                           = "functionapp,linux"
        location                       = "uksouth"
        name                           = "<redacted>"
        os_type                        = "linux"
        outbound_ip_addresses          = "51.140.146.130,51.143.182.89,51.143.182.117,51.143.182.96,51.143.182.211"
        possible_outbound_ip_addresses = "51.140.146.130,51.143.182.89,51.143.182.117,51.143.182.96,51.143.182.211,51.143.182.95,51.143.182.129,51.143.182.150,51.143.182.101,51.143.177.236"
        resource_group_name            = "<redacted>"
        site_credential                = [
            {
                password = "<redacted>"
                username = "<redacted>"
            },
        ]
        storage_account_access_key     = (sensitive value)
        storage_account_name           = "<redacted>"
        storage_connection_string      = (sensitive value)
        tags                           = {

        }
        version                        = "~3"

        auth_settings {
            additional_login_params        = {}
            allowed_external_redirect_urls = []
            enabled                        = false
            token_refresh_extension_hours  = 0
            token_store_enabled            = false
        }

        identity {
            identity_ids = []
            principal_id = "<redacted>"
            tenant_id    = "<redacted>"
            type         = "SystemAssigned"
        }

      ~ site_config {
            always_on                   = true
            ftps_state                  = "AllAllowed"
            http2_enabled               = false
            ip_restriction              = []
            linux_fx_version            = "DOTNET|3.1"
            min_tls_version             = "1.2"
            pre_warmed_instance_count   = 0
            scm_ip_restriction          = []
          + scm_type                    = "None"
            scm_use_main_ip_restriction = false
            use_32_bit_worker_process   = false
            websockets_enabled          = false

            cors {
                allowed_origins     = []
                support_credentials = false
            }
        }

        source_control {
            branch             = "master"
            manual_integration = false
            repo_url           = "VSTSRM"
            rollback_enabled   = false
            use_mercurial      = false
        }
    }

Here’s the terraform file for the above:

resource "azurerm_function_app" "take" {
  name                      = "<redacted>"
  location                  = var.rg.location
  resource_group_name       = var.rg.name
  app_service_plan_id       = var.sp.id
  storage_account_name      = azurerm_storage_account.sa.name
  storage_account_access_key = azurerm_storage_account.sa.primary_access_key
  https_only                = true
  version                   = "~3"
  enable_builtin_logging    = false
  os_type                   = "linux"
  daily_memory_time_quota   = 0
  
  identity {
    type                    = "SystemAssigned"
  }
  tags = var.tags
  site_config {
    linux_fx_version          = "dotnet|3.1"
    always_on                 = true
    use_32_bit_worker_process = false
    min_tls_version           = 1.2
    websockets_enabled        = false
    scm_type                  = "None"
  }

  app_settings = {
    APPINSIGHTS_INSTRUMENTATIONKEY                = var.appinsight.instrumentation_key
    APPLICATIONINSIGHTS_CONNECTION_STRING         = "InstrumentationKey=${var.appinsight.instrumentation_key};IngestionEndpoint=https://${var.rg.location}-0.in.applicationinsights.azure.com/"
    "ApplicationInsightsAgent_EXTENSION_VERSION"  = "~2"
    FUNCTIONS_WORKER_RUNTIME                      = "dotnet"
    WEBSITE_RUN_FROM_PACKAGE                      = ""
    WEBSITE_ENABLE_SYNC_UPDATE_SITE               = ""
    WEBSITES_ENABLE_APP_SERVICE_STORAGE           = ""

  }



  lifecycle {
    ignore_changes = [
      app_settings["WEBSITE_RUN_FROM_PACKAGE"],
      app_settings["WEBSITE_ENABLE_SYNC_UPDATE_SITE"],
      app_settings["WEBSITES_ENABLE_APP_SERVICE_STORAGE"],
      app_settings["SCM_DO_BUILD_DURING_DEPLOYMENT"]
    ]
  }
}

Looks at your changes in the PR I’d expect this to work?

We are not using continous deployments via scm. Explicitly setting site_config{ scm_type = "None" }

Has resolved the issue in our case

Do you try this :

site_config { scm_type = ā€œVSTSRMā€ }

lifecycle { ignore_changes = [ app_settings[ā€œWEBSITE_RUN_FROM_PACKAGEā€], app_settings[ā€œMSDEPLOY_RENAME_LOCKED_FILESā€], site_config[ā€œremote_debugging_enabledā€], site_config[ā€œremote_debugging_versionā€], site_config[ā€œscm_typeā€], id, ] }

When i have added site_config[ā€œscm_typeā€] i not longer get the error.

Kind regards,

We tried this, but it did not work around the issue. The issue goes away if you redeploy terraform. The issue only pops back up on subsequent application code deployments to app service, and on the following terraform deployment.

Steps to reproduce

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

Expected: applies change Actual: Errors with message in original post

Note: After step 4, you can continue redeploying terraform without incident. Again, The error only shows up after step 2 when you deploy app code.

Indeed it should get a note in the documentation that this parameter is not optional in any case eg. when using VSTS/AzureDevops!

https://www.terraform.io/docs/providers/azurerm/r/app_service.html#scm_type

@didaskein

Kudos! I can confirm that adding site_config["scm_type"] to lifecycle -> ignore_changes resolved the issue - at least in my case for a azurerm_function_app resource.