GithubHelp home page GithubHelp logo

Microsoft.Web/Sites about bicep-types-az HOT 14 OPEN

Plork avatar Plork commented on June 2, 2024
Microsoft.Web/Sites

from bicep-types-az.

Comments (14)

seligj95 avatar seligj95 commented on June 2, 2024 2

Opened up a GH issue (see mentioned issue above) with the team that should be able to help with this.

from bicep-types-az.

erionpc avatar erionpc commented on June 2, 2024 1

I was given a solution for this on stackoverflow
https://stackoverflow.com/questions/69897663/setting-azure-app-service-server-stack-on-a-bicep-template?noredirect=1#comment123566981_69897663

The trick is using linuxFxVersion: 'DOTNETCORE|3.1'

resource appServicePlan 'Microsoft.Web/serverfarms@2021-02-01' = {
  name: 'MyAppService'
  location: resourceGroup().location
  properties: {
    reserved: true
  }
  sku: {
    name: 'P1v2'
  }
  kind: 'linux'
}
resource appService 'Microsoft.Web/sites@2021-02-01' = {
  name: 'MyApp'
  location: resourceGroup().location
  identity: {
    type: 'SystemAssigned'
  }
  kind: 'app'
  properties: {
    enabled: true
    serverFarmId: appServicePlan.id
    siteConfig: {
      linuxFxVersion: 'DOTNETCORE|3.1'
      appCommandLine: 'dotnet MyApp.dll'
    }
  }
}

from bicep-types-az.

seligj95 avatar seligj95 commented on June 2, 2024 1

I was given a solution for this on stackoverflow https://stackoverflow.com/questions/69897663/setting-azure-app-service-server-stack-on-a-bicep-template?noredirect=1#comment123566981_69897663

The trick is using linuxFxVersion: 'DOTNETCORE|3.1'

resource appServicePlan 'Microsoft.Web/serverfarms@2021-02-01' = {
  name: 'MyAppService'
  location: resourceGroup().location
  properties: {
    reserved: true
  }
  sku: {
    name: 'P1v2'
  }
  kind: 'linux'
}
resource appService 'Microsoft.Web/sites@2021-02-01' = {
  name: 'MyApp'
  location: resourceGroup().location
  identity: {
    type: 'SystemAssigned'
  }
  kind: 'app'
  properties: {
    enabled: true
    serverFarmId: appServicePlan.id
    siteConfig: {
      linuxFxVersion: 'DOTNETCORE|3.1'
      appCommandLine: 'dotnet MyApp.dll'
    }
  }
}

Apologies, didn't see this yesterday. For reference, you can use az webapp list-runtimes --linux to see the supported runtimes/linuxFxVersions. As you found out, dotnet|3.1 is not supported while dotnetcore|3.1 is.

from bicep-types-az.

alex-frankel avatar alex-frankel commented on June 2, 2024

Do you happen to know how/where that metadata array is consumed? It looks like the web/sites resource type understands what to do with that.

You are getting this warning because this property is not declared in this resource type's swagger, so I'm wondering if it should be or if this is arbitrary metadata.

from bicep-types-az.

Plork avatar Plork commented on June 2, 2024

that last part I figured out thnx.

but it looks like web/sites or web/sites/config. but its not very clear to me either. We were looking for a way to specify dotnetcore on a windows app service. Not much is documented about this.

MicrosoftDocs/azure-docs#43963

from bicep-types-az.

alex-frankel avatar alex-frankel commented on June 2, 2024

Were you able to verify that the website is in fact running dotnet core? I'm worried it may be silently failing.

If it is working, then it looks like the right fix is to add it to the swagger spec.

from bicep-types-az.

ErwinWiegmanTest avatar ErwinWiegmanTest commented on June 2, 2024

Hi Alex, i can confirm that setting the metadata stack, changes the stack to dotnetcore and back to framework (tested on existing deployment). Also the stack option is generated in the azure portal, when deploying a new webapp and choosing the Download a template for automation option.

@Plork: Thanks for this snippet, i waisted a day figuring this out ;)

from bicep-types-az.

bminisi avatar bminisi commented on June 2, 2024

Hi @alex-frankel , Any update on this. In Azure Pipelines, it is being surfaced as a warning and the build shows as partially succeeded. It compiles correctly and the corresponding ARM template deploys correctly. Need to remove the warning.

from bicep-types-az.

alex-frankel avatar alex-frankel commented on June 2, 2024

No update on resolution of the issue unfortunately. It is part of a larger list of swagger fixes that I hope the team will be able to resolve soon. cc @seligj95

from bicep-types-az.

erionpc avatar erionpc commented on June 2, 2024

This doesn't work. Here's my template for a .NET Core 3.1 web app.

resource appServicePlan 'Microsoft.Web/serverfarms@2021-02-01' = {
  name: 'MyAppServicePlan'
  location: resourceGroup().location
  properties: {
    reserved: true
  }
  sku: {
    name: 'P1v2'
  }
  kind: 'linux'
}

resource appService 'Microsoft.Web/sites@2021-02-01' = {
  name: 'MyApp'
  location: resourceGroup().location
  kind: 'app,linux'
  identity: {
    type: 'SystemAssigned'
  }
  properties: {
    enabled: true
    serverFarmId: appServicePlan.id
    siteConfig: {
      linuxFxVersion: 'dotnet|3.1'
      appCommandLine: 'dotnet MyUI.dll'
      netFrameworkVersion: 'v4.0'
      metadata: [
        {
          name: 'CURRENT_STACK'
          value: 'dotnetcore'
        }
      ]
    }
  }
}

When it gets deployed it gives the warning mentioned above and the app service is set up with an empty server stack.

image

from bicep-types-az.

alex-frankel avatar alex-frankel commented on June 2, 2024

@seligj95 -- is there a possibility to validate when the linuxFxVersion is not valid? I know this is not a strict list of enum values, so it may not be feasible, but presumably the property value could be compared w/ what is returned by the list-runtimes command?

from bicep-types-az.

cpdohert avatar cpdohert commented on June 2, 2024

The core issue is that the metadata property is one - but not the only - way to set the Stack Settings (from the Azure Portal) programmatically:

stack_settings

For different stacks an app setting/environment variable is used.

I don't know if it's the ARM team or the App Service team that adamantly refuses to document this, but it's been going on for years and there are dozens of StackOverflow questions about it. The closest thing to a Microsoft official answer is "manually create what you want in the portal, then dump the ARM template before actually initiating the deploy", which is pretty much the definition of half-assing it.

This is complicated by the fact that apparently it isn't necessary to configure Stack Settings at all for any version of .NET Core/Framework running on a Windows App Service Plan because all the runtimes are just there and magically work, but that's not documented clearly anywhere either.

from bicep-types-az.

alex-frankel avatar alex-frankel commented on June 2, 2024

@cpdohert -- have you seen this reference before? Wondering if it is helpful at all, or if we need to edit/expand it:
https://docs.microsoft.com/azure/app-service/reference-app-settings?tabs=kudu%2Cdotnet

from bicep-types-az.

naveedaz avatar naveedaz commented on June 2, 2024

Please use the metadata APIs instead.

https://learn.microsoft.com/en-us/rest/api/appservice/web-apps/list-metadata
https://learn.microsoft.com/en-us/rest/api/appservice/web-apps/update-metadata

from bicep-types-az.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.