I am new to azure function.
I want to run my azure function code locally (in an azure virtual machine).
I'm running my code using this line in a linux VM terminal: . env/bin/activate && func host start
. env/bin/activate && func host start
It was successful with this output.
Azure Functions Core Tools
Core Tools Version: 4.0.4785 Commit hash: N/A (64-bit)
Function Runtime Version: 4.10.4.19213
Functions:
update-info: [GET,POST] http://localhost:7071/update-info
However, I wonder if it is possible to change localhost :7071 to the IP of my virtual machine so that it will be available online. Is it? If yes, how?; if not, how can I run HTTPS request/response program in a VM?
Another question if it is possible is can I change it from http to https? If yes, how?
Edited: - Adding Settings from the config files.
function.json
{
"scriptFile": "__init__.py",
"bindings": [
{
"authLevel": "anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": [
"get",
"post"
]
},
{
"type": "http",
"direction": "out",
"name": "$return"
}
]
}
host.json
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[2.*, 3.0.0)"
},
"extensions": {
"http": {
"routePrefix": ""
}
}
}
Btw, I already figured out how to run it using https. I had to add --useHTTPS on the command like this: . env/bin/activate && func host start --useHttps
. env/bin/activate && func host start --useHttps
I just need to know how to change the localhost to the VM IP address.
Glad that enabling the HTTPS flag is resolved by yourself.
I'm able to get the Function App Result with the local host and private IP address in Azure Linux VM:
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.