I have already written Azure Functions in Python, and know there's also official support for other popular dialects - JS, Java, .NET, etc. BUT, I have a special scenario, where I wish to execute some functions originally written in bash, or to be able to access such *nix utilities as calc, sed, awk and more.
I know that Azure Functions are meant to abstract away the server and even environment(?), but is there a way one can still install and run *nix like utilities or for that matter any exes (since *nix can port).
Some ideas am toying with:
and then invoke it using something like:
from subprocess import call call(["cal", "-y"])
Problem; Can I do this without having to deploy my own binaries?
TL;DR : How to execute own binaries and access Shell inside Azure Functions?
Obviously, Azure function is running on Windows Server
.
After my research, I found that the azure server was pre-loaded with git bash.
You can find the following path on the Kudu:
D:\Program Files (x86)\Git
If you want to run *nix command calc
on windows, you need to download calc for Windows execution files and upload it to Kudu.
Then add the current directory to the environment variable.
D:\home\site\mybin>set PATH=D:\home\site\mybin;%PATH%
Please make sure you add your environment variable in front of the variable D: \\Windows\\System32;
so that you can overwrite Windows own calc
command.
Verify:
When you execute calc
commands in Python, please use the os.environ
and os.putenv
to set your own environment variables.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.