1
votes

I would like to obtain the endpoint string relating to the hub IoT "EventHub compatible endpoint" that is the one that begins with Endpoint = sb // .... which is found in the hub in the built-in endpoint. By creating the endpoint on Azure, the system communicates

Each IoT hub comes with built-in system endpoints to handle system and device messages. When you create new endpoints and routes, messages stop flowing to the built-in endpoint unless you create a separate route and direct them there.

I have not created any routing endpoints so the command

Get-AzIotHubRoutingEndpoint -ResourceGroupName <r_name> -Name <iothubname> -EndpointType EventHub

which should return the endpoint, does not return anything, but it is the only command I have found that gave me a minimum of "hope of find it".

Thank you in advance Amf

1

1 Answers

2
votes

I can reproduce your issue, it looks like a bug, from the example in the doc, the command you used is the correct way.

If you want to get the Event Hub-compatible endpoint like in the portal, you could use the workaround below, in my sample, it uses the iothubowner shared access policy by default, you can also use others e.g. service, $endpoint is what you want.

$groupname = "<groupname>"
$iothubname = "<iothubname>"
$sapolicy = "iothubowner"
$a = (Get-AzResource -ResourceGroupName $groupname -ResourceType Microsoft.Devices/IotHubs -Name $iothubname).Properties.eventHubEndpoints.events.endpoint
$key = (Get-AzIotHubKey -ResourceGroupName $groupname -Name $iothubname -KeyName $sapolicy).PrimaryKey
$endpoint = "Endpoint="+ $a + ";SharedAccessKeyName="+ $sapolicy +";SharedAccessKey=" + $key + ";EntityPath=" + $iothubname

enter image description here