我在哪里可以找到 Azure 门户中 IoT 中心的事件中心兼容路径和服务主键

Where can i find Event Hubs-compatible path, and service primary key of the IoT hub in azure portal

Azure IoT Edge 快速入门说我们可以使用 Azure Cli 从 IOThub 获取事件中心兼容路径和服务主键:

az iot hub show --query properties.eventHubEndpoints.events.path --name YourIoTHubName

az iot hub policy show --name service --query primaryKey --hub-name YourIoTHubName

是否有任何其他方式从 Azure 门户或 Powershell 访问这些值。 当我从 powershell 运行 这些命令时,它说 az 不是

az : The term 'az' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

我已经安装了AZ模块。但仍然抛出错误。

在门户中,转到您的 IoT 中心。然后在设置中,转到Built-in端点。在这里您可以找到 Event Hub-compatible nameEvent Hub-compatible endpointEvent Hub-compatible name 就是你需要的路径。 事件Hub-compatible端点包括主键。

如果您在 设置 中转到 IoT 中心的共享访问策略,您也可以找到主键。 Select 服务 获取服务密钥。