azure - 使用 PowerShell 在与事件中心兼容的终结点中检索构建
问题描述
我想获取与集线器 IoT“EventHub 兼容端点”相关的端点字符串,该字符串以Endpoint = sb // ....
在内置端点的集线器中找到的开头。通过在 Azure 上创建端点,系统进行通信
每个 IoT 中心都带有用于处理系统和设备消息的内置系统端点。当您创建新的端点和路由时,消息将停止流向内置端点,除非您创建单独的路由并将它们定向到那里。
我没有创建任何路由端点,所以命令
Get-AzIotHubRoutingEndpoint -ResourceGroupName <r_name> -Name <iothubname> -EndpointType EventHub
它应该返回端点,不返回任何东西,但它是我发现的唯一命令,它给了我最低限度的“找到它的希望”。
提前谢谢你
解决方案
我可以重现您的问题,它看起来像一个错误,从文档中的示例来看,您使用的命令是正确的方法。
如果你想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
推荐阅读
- matlab - 带三叶草校正的威尔逊狄拉克算子的有限差分法
- spring-boot - Spring Boot Rest API - 部署在 Wildfly SErver
- var - 为什么这段代码只取 0 到 6 之间的数字
- python - 错误:无法为 ripser 构建轮子,这是安装基于 pyproject.toml 的项目所必需的
- python - 从python中的excel文件中的查找列表中提取元素
- android - Xamarin Forms(Android)中检查移动互联网是否打开的最佳方法是什么?
- flutter - Flutter android TV按钮即使在聚焦后也无法点击
- javascript - 使用 Amcharts 向下钻取 sankey 图
- c++ - 无法在 VScode 上链接两个文件(平台:MAC)
- xamarin - “ManifestMerger”任务意外失败 - Xamarin 表单