How to Test Azure Functions Through Postman and Azure Portal ?

How to Test Azure Functions Through Postman and Azure Portal ?

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

  1. Go to Azure Portal → Function App → select your function.
  2. Click Code + Test.
  3. Select Test/Run tab.
  4. Choose HTTP Method (GET/POST).
  5. Add headers, query parameters, or body.
  6. 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:

  1. Go to the function in Azure Portal.
  2. Click Code + Test.
  3. Click Run.
  4. 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:

  1. Open Storage Account → Queues.
  2. Select the queue linked to the function.
  3. Add a new message with test JSON/text.
  4. Save.
  5. Azure Functions automatically picks the message.
  6. Check logs under Monitor → Logs.

Blob Trigger Test Steps:

  1. Open Storage Account → Containers.
  2. Upload a file into the correct folder/path.
  3. Function will fire automatically.
  4. 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.

Post a Comment

0 Comments