azure - 通过 PowerShell 创建的 IotHub 设备不显示

标签 azure powershell azure-functions azure-iot-sdk azure-sdk

我正在门户上和通过 powershell 创建 Azure 物联网中心设备。 在门户上创建的设备显示在物联网中心的设备列表中,

但是 Powershell 创建的设备

Add-AzIotHubDevice -ResourceGroupName $resourceGroupName -IotHubName $iothubName -DeviceId $id -AuthMethod "shared_private_key" -EdgeEnabled

尽管我无法使用 powershell 使用的 ID 创 build 备,但门户上未显示这些信息。

我尝试注销然后登录 - 没有成功。

Powershell cmdlet 创建的设备似乎位于“某处”,因为 Id 正忙。

最佳答案

为了达到要求,我们尝试了同样的方法来创建一个新的IotHub 并使用 Powershell 向其添加设备 --版本 7.2.1 。

您正在使用的 cmdlet 将使用默认授权(共享私钥)创建支持边缘的 IoT 设备。

我们遵循的步骤:

New-AzIotHub ` -ResourceGroupName rgname -Name IotHubname -SkuName S1 -Units 1 -Location "west us2"

enter image description here

enter image description here

注意:- 确保您根据资源组位置提供了相同的位置。

  • 尝试使用您正在使用的相同命令添加新设备。

    Add-AzIotHubDevice -ResourceGroupName“RG NAME”-IotHubName“IOTHUB NAME”-DeviceId“myDevice3”-AuthMethod“shared_private_key”-EdgeEnabled

enter image description here

  • 导航到 Azure 门户> IotHub>Iotedge 稍后重新加载并检查我们使用 powershell 创建的设备。<

enter image description here

有关详细信息,请参阅此Microsoft 文档:- Add-AzIotHubDevice

关于azure - 通过 PowerShell 创建的 IotHub 设备不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71442985/

相关文章:

signalR(协商函数)的 Azure 函数绑定(bind)错误(500 错误代码)

azure - 云服务中不支持 BindingRedirect

xml - 如何在对象中列出 Powershell 中复杂 xml 中的两个元素

powershell - 在带有参数的函数上使用 Invoke-Command -ScriptBlock

powershell - 在powershell中隐藏标题栏

Azure 函数从 Azure 应用程序配置配置计时器触发器

azure - 通过 Visual Studio 2017 发布 Azure 函数项目后,所有函数应用程序都转为只读模式

azure - 集成测试连接到服务总线队列的 Azure 函数应用程序

python - 使用 Python 访问 Azure API

azure - 使用单个 PowerShell 命令在 Classic 和 ARM VM 上安装扩展