Reputation: 1833
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.
Upvotes: 0
Views: 191
Reputation: 4923
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 :
Created new IoT device
by using below cmdlets post az login
New-AzIotHub ` -ResourceGroupName rgname -Name IotHubname -SkuName S1 -Units 1 -Location "west us2"
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
powershell
.For more information please refer this Microsoft Documentation:- Add-AzIotHubDevice
Upvotes: 1