We can generate the OpenAPI definition for Azure Function Apps easily from the Azure Portal. Once the OpenAPI definition generated, we can use it further for any other level of integration. We can integrate it with Power Apps, Microsoft Flows also even to distribute the services to external developers using Azure API Management services. API Definition setting for Azure Function Apps helps in to configure the Swagger metadata that describes our API and makes them easier for discovering and consume.
If you are new to Azure Functions, you may first read these articles:
- Create Azure Functions using Visual Studio and deploy it to Azure
- 5 simple steps to create and test your first Azure Function App
Generate the OpenAPI Definition for Azure Function Apps
Generating the OpenAPI specification for Azure Function Apps are two steps process. First, select the methods for definition generation and secondly, generate the API definition.
From the Azure Portal, navigate to the respective Function App, and select Integrate Option. In this section choose all the methods and header types for which you want to perform the integration and generate the API Specification.
In the next step, Move to the platform feature tab under Function Apps Settings, and choose API definition available under API Group.
It will bring the API definition generation screen. Click on the “Generate API definition template” to generate the Swagger files for your Azure Function. This will also produce the API definition URL.
Save the definition. That’s it.
You have the OpenAPI Specification for Azure Function. Access the Open API URL to see the swagger definition.
You can now also further test this API through tools like Postman or any other REST Client Tools.