I am trying to use the cmd New-MgDeviceManagementImportedDeviceIdentity to insert new serialnumbers from our assetDB.
connect-mggraph works fine, using certificate and appID.
My testing example (serial is fakeserial, but valid):
$NewID = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphImportedDeviceIdentity
$NewID.Description = "A Description"
$NewID.ImportedDeviceIdentifier = "07C200200007"
$NewID.ImportedDeviceIdentityType = "serialNumber"
I then run the command
New-MgDeviceManagementImportedDeviceIdentity -BodyParameter $NewID
The error i receive looks like this.
New-MgDeviceManagementImportedDeviceIdentity : No OData route exists that match template ~/singleton/navigation with http verb POST for request /DeviceEnrollmentFE_2204/StatelessDeviceEnrollmentFESe
rvice/deviceManagement/importedDeviceIdentities.
I posted a ticket about this here: 147
I then tried the suggestion using :
$ImportedDeviceIdentities = @{
"@odata.type" = "#microsoft.graph.importedDeviceIdentity"
Description = "A Description"
ImportedDeviceIdentifier = "07C200200007"
ImportedDeviceIdentityType = "serialNumber"
\# Add more details.
}
Import-MgDeviceManagementImportedDeviceIdentityList -ImportedDeviceIdentities $ImportedDeviceIdentities -OverwriteImportedDeviceIdentities:$false
But this generated a new error:
Import-MgDeviceManagementImportedDeviceIdentityList : Unable to cast object of type 'Microsoft.Graph.PowerShell.Runtime.Json.JsonObject' to type 'Microsoft.Graph.PowerShell.Runtime.Json.JsonArray'.
At line:11 char:1
- Import-MgDeviceManagementImportedDeviceIdentityList -ImportedDeviceId ...
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : NotSpecified: (:) [Import-MgDevice..._ImportExpanded], InvalidCastException
- FullyQualifiedErrorId : Microsoft.Graph.PowerShell.Cmdlets.ImportMgDeviceManagementImportedDeviceIdentityList_ImportExpanded