title: Stream Analytics Egress to Azure Functions
body: <p>Microsoft announced support for sending data from Azure Stream Analytics to Azure Functions few days back:</p>
  
  <p><a href="https://azure.microsoft.com/en-us/blog/new-in-stream-analytics-output-to-azure-functions-built-in-anomaly-detection-etc/" rel="nofollow noreferrer">https://azure.microsoft.com/en-us/blog/new-in-stream-analytics-output-to-azure-functions-built-in-anomaly-detection-etc/</a></p>
  
  <p>I tried this but couldn't send data to Azure Functions. Is there any guide how to send data packet from IoT-hub -> Azure Stream Analytics -> Azure Functions?</p>
  
  <p>The output is fine to other sources. This is the query I have:</p>
  
  <pre><code>WITH rpidata AS
  (
  SELECT 
  *, 
  DATEADD(Hour, 3, timecreated) AS FITimezone
  FROM [rpi]
  )
  SELECT *
  INTO [PowerBI]
  FROM rpidata
  SELECT *
  INTO [storageout]
  FROM rpidata
  SELECT *
  INTO [fnout]
  FROM rpidata
  </code></pre>
  
  <p>The error message I get is:</p>
  
  <blockquote>
    <p>Could not successfully send an empty batch to the Azure Function. Please make sure your function app name, function name, and API key are correct and that your Azure Function compiles. If all of those parameters are correct, Azure Function may be temporarily available at this time. Please try again later. Azure function returned with response code of 500: InternalServerError. It should respond with a 200, 202, or 204.</p>
  </blockquote>
  
  <p>However the function is there, is running and is found automatically when I try to create the connection.</p>
  
  <p>What kind of Function input I should use to receive the data? I n the example I linked function name is httptriggercsharp... Does streamjob send the data as json?</p>