I'm creating Azure Iot hub devices both on the portal and via powershell. The devices created on the portal are displayed in the list of devices of the Iot hub,
but the devices created by Powershell's
Add-AzIotHubDevice -ResourceGroupName $resourceGroupName -IotHubName $iothubName -DeviceId $id -AuthMethod "shared_private_key" -EdgeEnabled
are not displayed on the portal although I can't create a device with Id used by powershell.
I tried to log out and then log in - no luck.
It looks like the devices created by Powershell cmdlet are "somewhere" because Id's are busy.
CodePudding user response:
To achieve the requirement we have tried the same to create a new IotHub and adding a device to it using Powershell --version 7.2.1 .
The cmdlet you are using which will Create an edge enabled IoT device with default authorization (shared private key).
Steps we followed :
-
NOTE:- Make sure that you have provided th same location based on your resource group location.
Trying to add a new device using the same command that you are using .
Add-AzIotHubDevice -ResourceGroupName "RG NAME" -IotHubName "IOTHUB NAME" -DeviceId "myDevice3" -AuthMethod "shared_private_key" -EdgeEnabled
- Navigate to Azure Portal> IotHub>Iotedge after sometime make a reload and check the device which we have created using
powershell
.
For more information please refer this Microsoft Documentation:- Add-AzIotHubDevice