Search code examples
pythonazureazure-webjobs

Python Azure webjob passing parameters


I have a Python WebJob living in Azure and I'm trying to pass parameters to it.

I've found documentation saying that I should be able to post the URL and add:?arguments={'arg1', 'arg2'} after it.

However, when I do that and then try to print(sys.argv) in my code, it's only printing the name of the Python file and none of the arguments I pass to it.

How do I get the arguments to pass to my Python code? I am also using a run.cmd in my Azure directory to trigger my Python code if that makes a difference.

UPDATE: So I tested it in another script without the run.cmd and that certainly is the problem. If I just do ?arguments=22 66 it works. So how do I pass parameters when I'm using a run.cmd file?


Solution

  • I figured it out: in the run.cmd file, you need to put "%*" after your script name and it will detect any arguments you passed in the URL.