0
votes

I want to use a service bus as a webhook

according to https://docs.microsoft.com/en-us/rest/api/servicebus/send-message-batch I can access the service using post request but I need to add an authentication which is not possible for the webhook I'm using

I thought I could add an intermediate layer using azure function, so basically the azure function is the webhook and it forwards the message to the service bus but I can't include Microsoft.Azure.ServiceBus in azure function so I can't do that as well

Is there a way simple way I can forward the message to the service bus?

2
What do you mean by "Trigger azure service bus subscription"? Do you want to add a message to a Service Bus topic? - Cloud SME

2 Answers

0
votes

Add with Andrés Nava - .NET

If you are not using precompiled azure function and you want to reference the external assemblies,you could use #r "AssemblyName". we could get more information from Azure Functions C# script developer reference.

The following assemblies may be referenced by simple-name (for example, #r "AssemblyName"):1

  • Newtonsoft.Json
  • Microsoft.WindowsAzure.Storage
  • Microsoft.ServiceBus
  • Microsoft.AspNet.WebHooks.Receivers
  • Microsoft.AspNet.WebHooks.Common
  • Microsoft.Azure.NotificationHubs
0
votes

Take a look at an example that is an HTTP triggered functions (your webhook) and then writes to the service bus. Quick note: In their example, they write the function's return value as a message into service bus, you probably want to use an output binding:

https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-service-bus#output

[FunctionName("ServiceBusOutput")]
[return: ServiceBus("myqueue", Connection = "ServiceBusConnection")]
public static string ServiceBusOutput([HttpTrigger] dynamic input, TraceWriter log)
{
    log.Info($"C# function processed: {input.Text}");
    return input.Text;
}