Share via

Azure IoTHub Event Hub Endpoint Creation is Unreachable

David Maryo 126 Reputation points
2022-10-08T08:35:35.51+00:00

Creating Event Hub Endpoint via Terraform it shows the status as "Unreachable" and "Unauthorized". But the same Endpoint when created manually seems to be working fine as expected. I would like to know if this can be a bug or am I missing out something?

Event Hub Endpoint via Terraform:

resource "azurerm_iothub_endpoint_eventhub" "jd-endpoint" {  
  resource_group_name = data.azurerm_iothub.jd-iot.resource_group_name  
  iothub_id           = data.azurerm_iothub.jd-iot.id  
  name                = "jd-endpoint"  
  connection_string = azurerm_eventhub_authorization_rule.staging.primary_connection_string  
}  

Provider Version:

terraform {  
  required_providers {  
    azurerm = {  
      version = "~> 3.24.0"  
    }  
  }  

f2mU9.png

Azure IoT Hub
Azure IoT Hub

An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.

Azure Event Hubs

2 answers

Sort by: Most helpful
  1. Valeriia Nesterova 0 Reputation points
    2026-03-05T15:47:55.2633333+00:00

    I faced the same problem. For me the problem was related to the fact that in Terraform I was using "Listen" policy for EventHub and it was lacking enough permissions for Iothub to access EventHub. And when you create that endpoint manually, Azure automatically creates new policy "iothubroutes_{eventhubname}" with "Send" permissions. So, I had to use "Send' permission in my Terraform code

    0 comments No comments

  2. AshokPeddakotla-MSFT 36,016 Reputation points Moderator
    2022-10-10T04:49:35.313+00:00

    @David Maryo

    But the same Endpoint when created manually seems to be working fine as expected.

    You mean, under IoT Hub routing?

    Can you please confirm, If the endpoint uses managed identity? If yes, please check that the IoT Hub principal has the required permissions on the target.

    248760-image.png

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.