Azure / Azure/azure-functions-powershell-worker
Unable to set custom properties on a ServiceBus message when using push-outputbinding
- Dominant language
- C#
- Stars
- 215
- Forks
- 61
- Avg merge
- 21h 4m
- Merged PRs (30d)
- 6
Description
When working with Azure Functions V2 (Powershell) ServiceBus output binding we are not able to add any user attributes to the servicebus message since the push-outputbinding cmdlet takes the object passed in "value" as the message body (it will serialize the object and submit that as the message text/body). ideally one could craft a Service Bus message of type Microsoft.Azure.ServiceBus.Message and use this object as the input for the push-outputbinding which will then :
1. Use the $message.body value as the contents of the serviceBus message,
2. Allow us to set any other $message attributes we need and honor them. For example the custom attribute is of upmost importance:
```
Import-Module .\modules\Microsoft.Azure.ServiceBus.dll
$Message = New-Object Microsoft.Azure.ServiceBus.Message
$Message.UserProperties.Add("name", "alex")
# Should be able to send the message object out also and not just a string
Push-OutputBinding -Name demooutputSbMsg -Value $Message
```
Instead, when you call push-outputbinding, the whole $message object is processed as the actual body of the message, making it impossible to set custom attributes
see example:

Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.