Skip to content

A boilerplate Postman collection to quickly start working with Azure Service Bus REST API

License

Notifications You must be signed in to change notification settings

epomatti/servicebus-postman-collection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Service Bus - Postman client

This is a Postman boilerplate collection to use Azure Service Bus REST API as detailed in the official docs.

You'll find the Azure CLI instructions below to setup the required resources that Postman will need. You can also create the resources with the Azure Portal and just use the Postman collection.

Setup

Postman will need an App Registration to authenticate and send messages to Service Bus using access tokens.

Steps to setup the Postman client:

  1. Create an App Registration on Azure AD with a client secret + Service Principal
  2. Assign the desired Service Bus RBAC to the Service Principal.
  3. Configure the Postman collection to connect to Azure AD and Service Bus.

Identify the values marked as {...} that need to be replaced.

1 - Create the App Registration

# Creates an app registration (ex: postman-servicebus-dev)
az ad app create --display-name "{name}" --query appId -o tsv

# Create a secret ---> 💡 save the output for later
az ad app credential reset --append --display-name postman --id "{APP ID}"

# Create the service principal
az ad sp create --id "{APP ID}" --query id -o tsv

2 - Assign permissions for the Service Principal to send messages to Service Bus

# Get the Service Bus resource id
az servicebus namespace show -n "{SERVICEBUS NAMESPACE}" -g "{RESOURCE GROUP}" --query id -o tsv

# Assign the permission
az role assignment create --assignee "{SERVICE PRINCIPAL ID}" \
  --role 69a216fc-b8fb-44d8-bc22-1f3c2cd27a39 \
  --scope "{SERVICE BUS RESOURCE ID}"

ℹ️ Optionally, you can add Azure Service Bus Data Receiver or even Azure Service Bus Data Owner depending no your needs. Check out Azure RBAC built-in roles.

3 - Configure Postman & Send messages

Download and import both the Collection and the Environment boilerplate files from this repository that are available under the ./postman folder.

3.1 Set the environment variables

Set the required values so Postman can authenticate and send messages. You'll add the dynamic values that were generated and your Service Bus namespace name and queues.

3.2 - Authenticate

Select the environment on Postman. First you need to authenticate and generate a token:

💡The token will be automatically saved to the context in the {{access_token}} variable on Postman

3.3 - Send Messages

✅ You can now send messages to Service Bus.

I've added a batch request there as well. You might want to check Service Bus REST API for more operations, options, and troubleshooting.

Contributing

Feel free to send a PR for new operations that you find useful for your use cases and complement this collection.

About

A boilerplate Postman collection to quickly start working with Azure Service Bus REST API

Topics

Resources

License

Stars

Watchers

Forks

Packages