Antonio Andrés Avila Moreno Thanks for posting your question in Microsoft Q&A. Based on your description, you face this issue with .NET 6, however .NET 3.1 works fine. Can you confirm if you have Connection string with secret or using Identify based connections? (Since you have tested in Postman, I guess it is likely secret).
Here is my local test which works fine without any errors and you can try with the same.
.csproj
local.settings.json
Program.cs
public class Function1
{
private readonly ILogger<Function1> _logger;
public Function1(ILogger<Function1> log)
{
_logger = log;
}
[FunctionName("Function1")]
public void Run([ServiceBusTrigger("mtopic", "msubscription", Connection = "MSBCONNECTION")]string mySbMsg)
{
_logger.LogInformation($"C# ServiceBus topic trigger function processed message: {mySbMsg}");
}
}
mtopic - my topic name
msubscription - my subscription in mtopic
MSBCONNECTION - connection string with secret for SB namespace (not topic or queue) as suggested in doc: https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-service-bus-trigger?pivots=programming-language-csharp&tabs=python-v2%2Cin-process%2Cextensionv5#connection-string
If you still face the issue, share local.settings.json (hiding connection string), full .csproj reference, that will help in reproducing the issue. I hope this helps and let me know if you still face the issues.