title: How to send data to Service Bus Topic with Azure Functions?
body: <p>I have default C# based HTTP Trigger here and I wish to send data "Hello Name" to Service Bus Topic (already created). I'm coding at portal.</p>
  
  <p>How to do it Service Bus output binding?</p>
  
  <p>This is not working. Any help available? </p>
  
  <p>-Reference missing for handling Service Bus?</p>
  
  <p>-How to define Connection of service bus? Where is Functions.json</p>
  
  <p>-How to send a message to service bus?</p>
  
  <pre><code>//This FunctionApp get triggered by HTTP and send message to Azure Service Bus
  
  using System;
  using System.IO;
  using System.Threading.Tasks;
  using Microsoft.AspNetCore.Mvc;
  using Microsoft.Azure.WebJobs;
  using Microsoft.Azure.WebJobs.Extensions.Http;
  using Microsoft.AspNetCore.Http;
  using Microsoft.Extensions.Logging;
  using Newtonsoft.Json;
  
  namespace Company.Function
  
  {
      public static class HttpTriggerCSharp1
  {
      [FunctionName("HttpTriggerCSharp1")]
      [return: ServiceBus("myqueue", Connection = "ServiceBusConnection")] // I added this for SB Output. Where to define.
  
      public static async Task&lt;IActionResult&gt; Run(
          [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
          ILogger log)
  
      {
          log.LogInformation("C# HTTP trigger function processed a request.");
          string name = req.Query["name"];
          string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
          dynamic data = JsonConvert.DeserializeObject(requestBody);
          name = name ?? data?.name;
          string responseMessage = string.IsNullOrEmpty(name)
              ? "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response."
              : $"Hello, {name}. This HTTP triggered function executed successfully.";
          return new OkObjectResult(responseMessage);
          // I added this for SB Output
          return responseMessage;
      }
  }
  </code></pre>
  
  <p>}</p>