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.
Postman will need an App Registration to authenticate and send messages to Service Bus using access tokens.
Steps to setup the Postman client:
- Create an App Registration on Azure AD with a client secret + Service Principal
- Assign the desired Service Bus RBAC to the Service Principal.
- Configure the Postman collection to connect to Azure AD and Service Bus.
Identify the values marked as {...}
that need to be replaced.
# 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
# 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 evenAzure Service Bus Data Owner
depending no your needs. Check out Azure RBAC built-in roles.
Download and import both the Collection and the Environment boilerplate files from this repository that are available under the ./postman folder.
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.
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
✅ 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.
Feel free to send a PR for new operations that you find useful for your use cases and complement this collection.