title: Azure - Debugging Iot Hub - Function trigger
body: <p>I'm trying to get the payload of Azure IoT Hub telemetry to a Function. I tried using <a href="https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-event-iot-trigger?tabs=csharp" rel="nofollow noreferrer">this</a> documentation, but I must be missing something. While I see data coming through, my function is not executed. I tried to put a Service Bus in between, so I created a Message Route in my IoT Hub and used that according to the same documentation, but for Service Bus instead of IoT Hub. I see the messages from a simulated device in the IoT Hub and the Service Bus, but somehow, the function is not executed. I also have no idea how to debug this problem, why the function is not executed. Any help with debugging tips or documentation tips would be much appreciated.</p>
  <p>I added the Service Bus parameters in <code>host.json</code>:</p>
  <pre class="lang-json prettyprint-override"><code>...
          &quot;serviceBus&quot;: {
              &quot;prefetchCount&quot;: 100,
              &quot;messageHandlerOptions&quot;: {
                  &quot;autoComplete&quot;: true,
                  &quot;maxConcurrentCalls&quot;: 32,
                  &quot;maxAutoRenewDuration&quot;: &quot;00:05:00&quot;
              },
              &quot;sessionHandlerOptions&quot;: {
                  &quot;autoComplete&quot;: false,
                  &quot;messageWaitTimeout&quot;: &quot;00:00:30&quot;,
                  &quot;maxAutoRenewDuration&quot;: &quot;00:55:00&quot;,
                  &quot;maxConcurrentSessions&quot;: 16
              },
              &quot;batchOptions&quot;: {
                  &quot;maxMessageCount&quot;: 1000,
                  &quot;operationTimeout&quot;: &quot;00:01:00&quot;,
                  &quot;autoComplete&quot;: true
              }
          }
  ...
  </code></pre>
  <p>And set the right trigger binding in <code>functions.json</code>:</p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;scriptFile&quot;: &quot;__init__.py&quot;,
    &quot;bindings&quot;: [
      {
        &quot;name&quot;: &quot;msg&quot;,
        &quot;type&quot;: &quot;serviceBusTrigger&quot;,
        &quot;direction&quot;: &quot;in&quot;,
        &quot;queueName&quot;: &quot;[MyQueueName]&quot;,
        &quot;connection&quot;: &quot;Endpoint=sb://[MyServiceBusName].servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=[MyServiceBusSAS]&quot;
      }
    ]
  }
  </code></pre>