Locally we can do dotnet run [args]
or dotnet publish
followed by dotnet mydll.dll [args]
.
When deploying that App to an Azure Web App under App Services, how do you make it startup with these command line arguments?
Configure connection strings. In the Azure portal, search for and select App Services, and then select your app. In the app's left menu, select Configuration > Application settings. For ASP.NET and ASP.NET Core developers, setting connection strings in App Service are like setting them in <connectionStrings> in Web.
You can use the Kudu API Rest to execute command lines operations.
Documentation: https://github.com/projectkudu/kudu/wiki/REST-API
POST /api/command
Executes an arbitrary command line and return its output
{
"command": 'echo Hello World',
"dir": 'site\\repository'
}
The JSON body of the post should look like this, passing the command and the folder it should run in.
You need to use Basic Auth (Get your credentials in Overview / Get Publish Profile Section) in order to make a POST request.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With