Terraform-provider-azurerm: Support for .NET Core stack for azurerm_app_service

Created on 9 Jan 2020  路  16Comments  路  Source: terraform-providers/terraform-provider-azurerm

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

Description

The provider supports a flag in site_config to set the dotnet_framework_version. This works well to set one of the .NET Framework versions that are supported by Azure App Services. App Services, however, also supports .NET Core applications since some time last year.

This feature request is to add a possibility to configure app services that run .NET Core.

Azure currently lists these .NET Core versions for the runtime stack: 1.0, 1.1, 2.0, 2.1 (LTS), 2.2, 3.0 (Current), 3.1 (LTS).

New or Affected Resource(s)

  • azurerm_app_service

Potential Terraform Configuration

resource "azurerm_resource_group" "main" {
  name     = "${var.prefix}-resources"
  location = "${var.location}"
}

resource "azurerm_app_service_plan" "main" {
  name                = "${var.prefix}-asp"
  location            = "${azurerm_resource_group.main.location}"
  resource_group_name = "${azurerm_resource_group.main.name}"

  sku {
    tier = "Basic"
    size = "B1"
  }
}

resource "azurerm_app_service" "main" {
  name                = "${var.prefix}-appservice"
  location            = "${azurerm_resource_group.main.location}"
  resource_group_name = "${azurerm_resource_group.main.name}"
  app_service_plan_id = "${azurerm_app_service_plan.main.id}"

  site_config {
    dotnet_core_version = "v3.1"
  }
}

References

  • I have not been able to find any current GitHub issues regarding this

  • Disclamer / Note for others wanting to deploy Core applications through terraform

    Even if you set the dotnet_framework_version to "v.4.0" and this is reflected in the web GUI, you will still be able to deploy your Core application to this App Service and they will run regardless of this property.

    enhancement servicapp-service

    Most helpful comment

    Nice suggestion, that would make it way easier!

    Just incase this helps anyone, I was able to set the net core version using the following:

    resource "azurerm_app_service" "main" {
      name                = "${var.prefix}-appservice"
      location            = "${azurerm_resource_group.main.location}"
      resource_group_name = "${azurerm_resource_group.main.name}"
      app_service_plan_id = "${azurerm_app_service_plan.main.id}"
    
      site_config {
        linux_fx_version = "DOTNETCORE|3.1"
      }
    

    All 16 comments

    Nice suggestion, that would make it way easier!

    Just incase this helps anyone, I was able to set the net core version using the following:

    resource "azurerm_app_service" "main" {
      name                = "${var.prefix}-appservice"
      location            = "${azurerm_resource_group.main.location}"
      resource_group_name = "${azurerm_resource_group.main.name}"
      app_service_plan_id = "${azurerm_app_service_plan.main.id}"
    
      site_config {
        linux_fx_version = "DOTNETCORE|3.1"
      }
    

    As I understand it, the net core version has no effect on Windows app service plans (aside from setting a metadata field). You also can't specify the version in the portal once the app service is created, only that it's the net core stack.

    On Linux, you use the setting @aagoldingay used.

    Hello Everyone,

    First of all thank you for your efforts! Do you have any idea when will this feature be added please?

    This would be a good thing to have for the App Service resource.

    To clarify, .NET Core up to 3.1 will run in an App Service that is configured with the current dotnet_framework_version = "v4.0"? If so, I'll open an issue to have the documentation updated.

    To clarify, .NET Core up to 3.1 will run in an App Service that is configured with the current dotnet_framework_version = "v4.0"? If so, I'll open an issue to have the documentation updated.

    It's slightly more nuanced than that, but generally yes for Windows. When not using self-contained deployments, the runtime has to be rolled out on the Azure side first. Ditto on the SDK when using kudu to build on the app service. See also https://github.com/Azure/app-service-announcements-discussions/issues/129

    Hello,
    Are there any updates with regard to dot net core? is it implemented? in the documentation, it is still not there.

    Nice suggestion, that would make it way easier!

    Just incase this helps anyone, I was able to set the net core version using the following:

    resource "azurerm_app_service" "main" {
      name                = "${var.prefix}-appservice"
      location            = "${azurerm_resource_group.main.location}"
      resource_group_name = "${azurerm_resource_group.main.name}"
      app_service_plan_id = "${azurerm_app_service_plan.main.id}"
    
      site_config {
        linux_fx_version = "DOTNETCORE|3.1"
      }
    

    If your app service plan is for linux then linux_fx_version ="DOTNETCORE|3.1" works but it will not work for windows web app

    Hello,
    Are there any updates with regard to dot net core? is it implemented? in the documentation, it is still not there.

    I haven't found any update regarding the same. Finding it difficult to find the same even in Azure CLI documentation as well

    Please advise if there is a way to use .NET 3.1 Stack for Windows App Service in Azure.

    @thisisjagan What do mean by "use". If you want to run dotnet core, see this remark in issue text:

    Even if you set the dotnet_framework_version to "v.4.0" and this is reflected in the web GUI, you will still be able to deploy your Core application to this App Service and they will run regardless of this property.

    @thisisjagan What do mean by "use". If you want to run dotnet core, see this remark in issue text:

    Even if you set the dotnet_framework_version to "v.4.0" and this is reflected in the web GUI, you will still be able to deploy your Core application to this App Service and they will run regardless of this property.
    @StefanSchoof
    It won't work it gives
    HTTP Error 500.31 - ANCM Failed to Find Native Dependencies
    Common solutions to this issue:
    The specified version of Microsoft.NetCore.App or Microsoft.AspNetCore.App was not found.
    Troubleshooting steps:
    Check the system event log for error messages
    Enable logging the application process' stdout messages
    Attach a debugger to the application process and inspect
    For more information visit: https://go.microsoft.com/fwlink/?LinkID=2028526 error

    Any new update on this?
    I used terraform to call ARM template as work around about an year and half back. I can't believe this is still not available for windows app service plan.

    For Windows App plan use ' windows_fx_version = "DOTNETCORE|3.1" '

    Is there a reason that the documentation hasn't been updated to reflect that .NET Core runtimes are installed on the Windows plan regardless of the site_settings? I deployed an app using windows_fx_version = "DOTNETCORE" as suggested above and it deployed as .NET Framework v4.0. I changed it to .Net Core in the portal and terraform sees no change in state. More clarity around this setting would be appreciated.

    I think because the core team has many important tasks and nobody of us created a PR to improve the docs. Usually docs PR are merged quite fast. So best thing, to help others not running into this problem is to create a PR to update the docs.

    @StefanSchoof Before I update the docs, I'd need to do some more testing and/or get confirmation from the dev team that what we are seeing is WAI and not just a fluke that the .Net Core runtimes are all there. If it's a function that just hasn't been added yet to the Go SDK and future behavior might change, I don't want to lead people astray.

    Was this page helpful?
    0 / 5 - 0 ratings