Azure Functions can be tested easily without writing any client application. Two of the most common methods are Postman (for HTTP-triggered functions) and the Azure Portal (for all triggers). This guide explains both methods step-by-step.
1. Testing Azure Functions Using Postman
Postman is the most convenient tool to test HTTP Trigger Azure Functions.
Prerequisites
- Function must be running locally (func start) or deployed to Azure.
- You need the Function URL with the function key.
Steps
Step 1: Get the Function URL
If running locally:
http://localhost:7071/api/<FunctionName>
If running in Azure:
- Open Azure Portal → Function App.
- Select your function → Get Function URL.
- Copy the URL (it includes code=<function_key>).
Step 2: Open Postman and Create a Request
- Select GET, POST, PUT, or DELETE depending on your function.
- Paste the function URL.
Step 3: Add Input Data
For GET:
- Add query parameters.
For POST/PUT:
- Go to Body → choose raw → JSON.
- Enter JSON input.
Example:
"name": "ViASTUDY",
"score": 90
}
Step 4: Send the Request
Click Send.
Postman will display:
- Response status (200, 400, 500, etc.)
- Response body
- Execution time
- Headers
Step 5: Check Logs (optional)
If running locally:
- Check the terminal running func start.
If in Azure:
- Check Monitor tab → Logs.
2. Testing Azure Functions Using Azure Portal
Azure Portal allows testing without any external tool.
Useful when:
- You don’t have Postman installed.
- You want quick tests after deployment.
a. Testing HTTP Trigger Functions
- Go to Azure Portal → Function App → select your function.
- Click Code + Test.
- Select Test/Run tab.
- Choose HTTP Method (GET/POST).
- Add headers, query parameters, or body.
- Click Run.
Results You Will See:
- Response body
- Status code
- Execution logs (right panel)
- Invocation details
b. Testing Timer Trigger Functions
Timer triggers cannot be run manually on schedule, but you can test them:
- Go to the function in Azure Portal.
- Click Code + Test.
- Click Run.
- The function will execute once immediately for testing.
c. Testing Queue/Blob Trigger Functions
These functions react to Azure Storage events.
Queue Trigger Test Steps:
- Open Storage Account → Queues.
- Select the queue linked to the function.
- Add a new message with test JSON/text.
- Save.
- Azure Functions automatically picks the message.
- Check logs under Monitor → Logs.
Blob Trigger Test Steps:
- Open Storage Account → Containers.
- Upload a file into the correct folder/path.
- Function will fire automatically.
- Check logs under Monitor.
Summary
- Postman is ideal for testing API-style HTTP-trigger functions.
- Azure Portal is ideal for quick manual tests after deployment and testing non-HTTP triggers.
- Both tools support verifying input, output, logs, and errors effectively.








.gif)
0 Comments