From this Tutorial
- Local vs code azure function dev : Further Details
- Install azurite
- Start azurite :
In Visual Studio Code : Ctrl + P > Azurite : Start
- Configure Azure Function to use local development storage :
{ "Values": { "AzureWebJobsStorage": "UseDevelopmentStorage=true", ... } }
- Install NGrok to tunnel the connection from internet :
- Set the token in the config :
ngrok config add-authtoken <token>
- Create a custom endpoint (free and optional : Will help with keeping the same domain name for future tests) :
- Create an edge tunnel and configure it to the azure function host :
ngrok config edit
- Inside the file (retrieve the config from
Cloud Edge > Edges > Start a Tunnel > Start a tunnel from a config file
:
version: 2 authtoken: xxx tunnels: my_tunnel_name: labels: - edge=xxx addr: http://localhost:80
- Inside the file (retrieve the config from
- Manually serve the tunnel from the bash terminal :
ngrok tunnel --label edge=edghts_2ShvSEl8k4SQImfDoMaECki0yop http://localhost:7071
- Configure the task.json (Java Sample) to expose the azure function to the internet :
{ "type":"shell", "label" : "Expose debug to internet", "command": "ngrok tunnel --label edge=edghts_2ShvSEl8k4SQImfDoMaECki0yop http://localhost:7071", "dependsOn": "func: host start" }, { "type": "func", "label": "func: host start", "command": "host start", "problemMatcher": "$func-java-watch", "isBackground": true, "options": { "cwd": "${workspaceFolder}/target/azure-functions/unzipfunc-20230717151702055" }, "dependsOn": "package (functions)" },
- Configure the launch.json to offer another debug option (calling the task.json):
{ "name": "Expose to Internet", "type": "java", "request": "attach", "hostName": "127.0.0.1", "port": 5005, "preLaunchTask": "Expose debug to internet" }
- Now the Azure function is running and exposed via the ngrok proxy, it's time to wire up Event Grid :
- Create an Event Grid System Topic Subscription from an
Azure Storage Account
Event tab
for example - Define the endpoint to HTTP Webhook as follows :
https://<ngrok-endpoint>/runtime/webhooks/eventgrid?functionName=<FunctionName>
- Create an Event Grid System Topic Subscription from an
- In my example :
https://carefully-awake-jennet.ngrok-free.app/runtime/webhooks/eventgrid?functionName=EventGridExample
- Then start everything together from vscode
debug > Expose to Internet
:- Bare in mind that the reverse-proxy will be exposed via the token configured in the
ngrok config edit
step and communication remains encrypted through https
- Bare in mind that the reverse-proxy will be exposed via the token configured in the
The source code can be found here : https://github.com/Justrebl/AzureFunction-unzipbigfiles