0

I'm starting to wonder whether this is the right tool for the job, still here goes.

I'm attempting to automate the creation of our Azure Test environment using Azure SDK for JS. The environment spans many services (as you can imagine), including Classic ASP.NET app services.

Node is my safe space, so that is why I started with the JS SDK.

I have started scripting the creation of an app service using WebSiteManagementClient.webApps.createOrUpdate. I'm confused though, there is seemingly no way to configure any of the following:

  1. Which app service plan the app service should be connected to. This feels fundamental.
  2. The operating system, Windows or Linux.
  3. The stack version, .NET 4.8, .NET Core, or whatever.

Is it possible to configure the above using the JS SDK, or am I going to have find another approach?

Update 23/03/21

Untested, but these are my findings so far:

App Service Plan - The plan is set using the serverFarmId property of the Site interface.

Operating system - Assuming Windows as the default, if you want a Linux app service, you change the kind property of Site from app, to app,linux.

Stack & version - In the SiteConfig interface, you have linuxFxVersion and windowsFxVersion. Again, I think the assumption is 'latest .NET' (e.g. .NET 4.8). For .NET Core 3.1, the setting looks to be DOTNETCORE|3.1.

kim3er
  • 6,306
  • 4
  • 41
  • 69
  • If my reply is helpful, please accept it as answer(click on the mark option beside the reply to toggle it from greyed out to fill in.), see https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work – Jason Pan Mar 24 '21 at 01:23
  • Hey @jason-pan, as you'll see from my last update. The situation has not been tested yet. You're answer led me to better documentation, for which I'm very grateful, but didn't specifically deal with any of the three points I raised. – kim3er Mar 24 '21 at 09:39
  • https://stackoverflow.com/questions/66428776/can-net-core-2-2-and-3-1-application-slots-coexist-in-the-same-app-service/66432286#66432286 – Jason Pan Mar 24 '21 at 11:42

1 Answers1

1

It can be achieved using js SDK. I checked the source code and it is ok. But I don't recommend to use js sdk to do this.

Because you need to call the SDK, there are many internal logics that you need to code. This will waste a lot of your time. So I recommend you to use restapi.


The restapi method name is similar to the naming in the SDK, mainly because you can test api interfaces online to achieve the functions you want. So you can selectively choose the method you want to achieve the function you want.


Official doc

Web Apps - Create Or Update

As for your concerns, you only need to write all the configuration in json format and put it in the request body.

Tips:

First use the online interface, encode the json format, create a webapp according to your needs, and then integrate it into your code.

enter image description here

Jason Pan
  • 15,263
  • 1
  • 14
  • 29
  • Thanks for the response @jason-pan, much appreciated. 'serverFarmId'! That's what lets me set the app service plan. Couldn't see it for love nor money in the JS docs, popped straight out at me in the REST docs, and can now see it in JS as well. – kim3er Mar 23 '21 at 10:00