首页 > 解决方案 > 使用 PowerShell 在与事件中心兼容的终结点中检索构建

问题描述

我想获取与集线器 IoT“EventHub 兼容端点”相关的端点字符串,该字符串以Endpoint = sb // ....在内置端点的集线器中找到的开头。通过在 Azure 上创建端点,系统进行通信

每个 IoT 中心都带有用于处理系统和设备消息的内置系统端点。当您创建新的端点和路由时,消息将停止流向内置端点,除非您创建单独的路由并将它们定向到那里。

我没有创建任何路由端点,所以命令

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

它应该返回端点,不返回任何东西,但它是我发现的唯一命令,它给了我最低限度的“找到它的希望”。

提前谢谢你

标签: azureazure-powershellazure-iot-hub

解决方案


我可以重现您的问题,它看起来像一个错误,从文档中的示例来看,您使用的命令是正确的方法。

如果你想Event Hub-compatible endpoint在门户中获得类似的东西,你可以使用下面的解决方法,在我的示例中,它iothubowner默认使用共享访问策略,你也可以使用其他策略,例如service$endpoint这是你想要的。

$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

在此处输入图像描述


推荐阅读