Today we are announcing preview support for editing and hosting OpenAPI 2.0 (Swagger) metadata in Azure Functions. API authoring is a popular application of Functions, and Swagger metadata allows a whole network of Swagger compliant software to easily integrate with those APIs.
We are adding a Swagger template generator to create a quickstart Swagger file from the existing metadata in your HTTP Trigger Functions. You just fill in the operation objects for each of your HTTP verbs and you’re off!
We host a version of the swagger editor to provide rich inline editing of your Swagger file from within the Function UI. Once you save your Swagger file we’ll host it for you at a url in your Function App's domain.
Head on over to the documentation to learn more
To create your first OpenAPI (Swagger) definition you must first have a function App with at least one HTTP Trigger Function. Instructions.
Next head over to the "API Definition (preview)" tab in the lower left hand corner of your Function App.
Toggle your Swagger source to "Internal." This will enable hosting and inline editing of an OpenAPI definition for this Function App.
Click "Load Generated API Definition" to populate the Swagger editor with a quickstart OpenAPI definition.
This definition uses your function.json, represented as the settings in the "Integrate tab," for each Function to populate the definition.
Add an operation object for the POST operation of your function with the expected type of input.
For the HTTP Trigger sample code you can use the following Operation object:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Remove the entries under Paths/api/<yourFunctionName> for every verb except POST. (get, delete, head, etc)
For the default HTTP Trigger, all HTTP verbs are allowed, so our quickstart will have a blank entry for all 8 possible verbs. We want our definition to only contain the available functionality of our API.
Test your Swagger definition
In the right-hand pane of the swagger editor add your API key as Authentication info, click "try this operation," and enter a name to test your Swagger.
Provide Preview Feedback
Try out Swagger support in Functions and let us know how you like it! We are continuing to develop this set of features and would love to know what matters most to you.
If you run into any problems, let us know on the forums, ask a question on StackOverFlow, or file an issue on GitHub. If you have any additional features you would like to see, please let us know on Uservoice.
3 minute read
• By Tulika Chaudharie
• March 19, 2025
Azure App Service now supports running Redis as a sidecar extension, allowing you to easily add Redis caching to your applications. This blog will walk you t...
4 minute read
• By Tulika Chaudharie
• March 19, 2025
Monitoring your applications is crucial for performance and reliability. With Datadog as a sidecar extension, you can seamlessly collect logs, metrics, and t...
1 minute read
• By Tulika Chaudharie
• March 19, 2025
In November 2024, we announced the General Availability (GA) of the Sidecar feature for Azure App Service for Linux, enabling developers to run sidecar conta...