azure-functions
Name
is a serverless plugin built into Apache APISIX for seamless integration with Azure Serverless Function as a dynamic upstream to proxy all requests for a particular URI to the Microsoft Azure cloud, one of the most used public cloud platforms for production environment. If enabled, this plugin terminates the ongoing request to that particular URI and initiates a new request to the azure faas (the new upstream) on behalf of the client with the suitable authorization details set by the users, request headers, request body, params ( all these three components are passed from the original request ) and returns the response body, status code and the headers back to the original client that has invoked the request to the APISIX agent.
Metadata
Name | Type | Requirement | Default | Valid | Description |
---|---|---|---|---|---|
master_apikey | string | optional | “” | The API KEY secret that could be used to access the azure function uri. | |
master_clientid | string | optional | “” | The Client ID (active directory) that could be used the authorize the function uri |
Metadata for azure-functions
plugin provides the functionality for authorization fallback. It defines master_apikey
and master_clientid
(azure active directory client id) where users (optionally) can define the master API key or Client ID for mission-critical application deployment. So if there are no authorization details found inside the plugin attribute the authorization details present in the metadata kicks in.
- First, the plugin looks for or
x-functions-clientid
keys inside the request header to the APISIX agent. - If they are not found, the azure-functions plugin checks for the authorization details inside plugin attributes. If present, it adds the respective header to the request sent to the Azure cloud function.
To add a new Master APIKEY, make a request to /apisix/admin/plugin_metadata endpoint with the updated metadata as follows:
The following is an example of how to enable the azure-function faas plugin for a specific route URI. We are assuming your cloud function is already up and running.
For requests where the mode of communication between the client and the Apache APISIX gateway is HTTP/2, the example looks like ( make sure you are running APISIX agent with enable_http2: true
for a port in conf.yaml or uncomment port 9081 of node_listen
field inside config-default.yaml ) :
Disable Plugin
Remove the corresponding JSON configuration in the plugin configuration to disable the azure-functions
plugin and add the suitable upstream configuration. APISIX plugins are hot-reloaded, therefore no need to restart APISIX.