0

How can I add a command line argument for when my app starts?

I'm using the Azure Functions in an isolated process, and after publish command, the worker.config.json file is created. I didn't find much documentation about this file, but I have tried to edit it and add the "arguments" property, then it seems something like this:

{
  "description": {
    "language": "dotnet-isolated",
    "extensions": [ ".dll" ],
    "defaultExecutablePath": "dotnet",
    "defaultWorkerPath": "MyFunctionProjectName.dll",
    "workerIndexing": "false",
    "arguments": ["foo-bar"]
  }
}

But when my function starts, the below error is thrown.

[Information] The application 'foo-bar' does not exist.

So, how can I add command line arguments to my function?

1 Answers1

0
  • I have reproduced by creating HttpTrigger Azure function in visual studio.

  • To create a C# function in Azure from the command line, you can refer the MSDOC.

  • After creating the Azure function, I have tried to add the property "arguments" in worker.config.json file and run the project as below:

{

"description": {

"language": "dotnet-isolated",

"extensions": [ ".dll" ],

"defaultExecutablePath": "dotnet",

"defaultWorkerPath": "FunctionApp7.dll",

"workerIndexing": "false",

"arguments": ["foo-bar"]

}

}

Result: enter image description here

  • can be seen the same in portal:

enter image description here

enter image description here

Pravallika KV
  • 2,415
  • 2
  • 2
  • 7