Looking for the plugin's configuration parameters? You can find them in the Azure Functions configuration reference doc.
This plugin invokes Azure Functions. It can be used in combination with other request plugins to secure, manage, or extend the function.
Demonstration
To demonstrate the plugin, set up the Azure Functions “hello world” function.
-
In this example, we’ll consider the following placeholder settings. Insert your own values for the placeholders in the code examples:
-
<appname>
for the function’s app name -
<functionname>
for the function name -
<apikey>
for the api key
-
-
Test your function to make sure it works before adding it to Kong Gateway:
curl -i -X GET https://<appname>.azurewebsites.net/api/<functionname>?name=Kong \ -H "x-functions-key:<apikey>"
HTTP/1.1 200 OK ... "Hello Kong!"
-
Set up a route in Kong Gateway and link it to the Azure function you just created.
Note: If
config.https_verify
is set astrue
, then the server certificate is verified according to the CA certificates specified by thelua_ssl_trusted_certificate
directive in your Kong configuration.
Test the Azure Function through Kong
In this example, we’re only passing a query parameter name
to the Azure
Function. Besides query parameters, the HTTP method, path parameters,
headers, and body are also passed to the Azure Function if provided.
curl -i -X GET http://localhost:8000/azure1?name=Kong
You should see the same result as shown in step 2:
HTTP/1.1 200 OK
...
"Hello Kong!"