2

I'm trying to add a message to an azure message queue from an azure function. To do so, I'm following this article where it has me add a reference to Microsoft.Azure.ServiceBus.

https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-dotnet-get-started-with-queues

When trying to add this reference, the Azure function project in Visual Studio 2017 complains about the restricted version of Newtonsoft.Json (=9.0.1) relative to the Microsoft.NET.Sdk.Functions reference.

Version conflict detected for Newtonsoft.Json. Install/reference Newtonsoft.Json 10.0.1 directly to project IHA.Functions to resolve this issue. IHA.Functions -> Microsoft.Azure.ServiceBus 3.1.0 -> System.IdentityModel.Tokens.Jwt 5.2.2 -> Newtonsoft.Json (>= 10.0.1)
IHA.Functions -> Microsoft.NET.Sdk.Functions 1.0.14 -> Newtonsoft.Json (= 9.0.1). IHA.Functions C:\TFS\IHA\Misc\IHA.CSL\IHA.Functions\IHA.Functions.csproj 1

From what I understand, Microsoft.Azure.ServiceBus requires Newtonsoft.Json 10.0.1. If I remove the 9.0 version and add the 10.0 version, I can successfully add the Microsoft.Azure.ServiceBus package, but then the Azure Functions project complains that Microsoft.NET.Sdk.Functions requires 9.0 of Newtonsoft.

Based on these understandings, I can't seem to write to an Azure message queue from an Azure function. Is this correct or am I doing something wrong?

1 Answer 1

6

Azure Functions have explicit support for Service Bus in the form of extension.

You need to install the extension, see Azure Service Bus bindings for Azure Functions. Pay attention which Function App version you are using: 1.x with full .NET Framework, or beta 2.x with .NET Standard, and follow the corresponding guidance.

Then, instead of using Service Bus SDK directly, you would define and write to an output binding.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks! That worked perfectly and I edited the title. Appreciate the help!
does the python sdk support output binding for service bus? been looking for a while and am unable to find anything on this
Worth a separate question to be able to give a larger answer, but yes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.