msgraph-sdk-powershell
msgraph-sdk-powershell copied to clipboard
Get-MgBetaDeviceManagementComanagedDevice with ManagedDeviceId parameter not working
Describe the bug Get-MgBetaDeviceManagementComanagedDevice works on its own, but when adding a ManagedDeviceId to target a specific device (required to expand the "detectedApps" property among other things) it fails with the following error:
To Reproduce Steps to reproduce the behavior:
- Execute
Get-MgBetaDeviceManagementComanagedDevicewith-ManagedDeviceId $ComanagedDeviceID - See error at
Get-MgBetaDeviceManagementComanagedDevice : No OData route exists that match template ~/singleton/navigation/key with http verb GET for request /DeviceFE/StatelessDeviceFEService/deviceManagement/comanagedDevices('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX').Status: 400 (BadRequest)ErrorCode: No method match route templateDate: 2023-12-19T20:34:28Headers:Transfer-Encoding : chunkedVary : Accept-EncodingStrict-Transport-Security : max-age=31536000request-id : XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXclient-request-id : XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXx-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"CanadaEast","Slice":"E","Ring":"2","ScaleUnit":"000","RoleInstance":"XXXXXXXXXXXXXXX"}}Date : Tue, 19 Dec 2023 20:34:27 GMTAt line:1 char:1+ Get-MgBetaDeviceManagementComanagedDevice -ManagedDeviceId 'XXXXXXXX- ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidOperation: ({ ManagedDevice...ndProperty = }:<>f__AnonymousType193) [Get-MgBeta Devic...nagedDevice_Get], Exception+ FullyQualifiedErrorId : No method match route template,Microsoft.Graph.Beta.PowerShell.Cmdlets.GetMgBetaDeviceMa nagementComanagedDevice_Get
Expected behavior Should return the specific comanaged device information
Debug Output
Get-MgBetaDeviceManagementComanagedDevice -ManagedDeviceId 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX' -Debug
DEBUG: [CmdletBeginProcessing]: - Get-MgBetaDeviceManagementComanagedDevice begin processing with parameterSet 'Get'.
Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): a
DEBUG: [Authentication]: - AuthType: 'AppOnly', TokenCredentialType: 'ClientCertificate', ContextScope: 'Process',
AppName: 'Intune_GetData'.
DEBUG: [Authentication]: - Scopes: [DeviceManagementManagedDevices.Read.All, Device.Read.All, Group.Read.All,
Directory.Read.All, User.Read.All, DeviceManagementConfiguration.Read.All, DeviceManagementApps.Read.All].
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://graph.microsoft.com/beta/deviceManagement/comanagedDevices/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
Headers:
FeatureFlag : 00000043
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.22621;
en-US),PowerShell/5.1.22621.2506
Accept-Encoding : gzip
SdkVersion : graph-powershell-beta/2.11.1
client-request-id : XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
Body:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
BadRequest
Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
client-request-id : XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Canada
East","Slice":"E","Ring":"2","ScaleUnit":"000","RoleInstance":"XXXXXXXXXXXXXXX"}}
Date : Tue, 19 Dec 2023 20:34:33 GMT
Body:
{
"error": {
"code": "No method match route template",
"message": "No OData route exists that match template ~/singleton/navigation/key with http verb GET for request
/DeviceFE/StatelessDeviceFEService/deviceManagement/comanagedDevices('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX').",
"innerError": {
"date": "2023-12-19T20:34:34",
"request-id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"client-request-id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
}
}
}
Confirm
No OData route exists that match template ~/singleton/navigation/key with http verb GET for request
/DeviceFE/StatelessDeviceFEService/deviceManagement/comanagedDevices('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX').
`Status: 400 (BadRequest)` `ErrorCode: No method match route template` `Date: 2023-12-19T20:34:34`
Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
client-request-id : XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Canada
East","Slice":"E","Ring":"2","ScaleUnit":"000","RoleInstance":"XXXXXXXXXXXXXXX"}}
Date : Tue, 19 Dec 2023 20:34:33 GMT
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): a
Get-MgBetaDeviceManagementComanagedDevice : No OData route exists that match template ~/singleton/navigation/key with
http verb GET for request
/DeviceFE/StatelessDeviceFEService/deviceManagement/comanagedDevices('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX').
Status: 400 (BadRequest)
ErrorCode: No method match route template
Date: 2023-12-19T20:34:34
Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
client-request-id : XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Canada
East","Slice":"E","Ring":"2","ScaleUnit":"000","RoleInstance":"XXXXXXXXXXXXXXX"}}
Date : Tue, 19 Dec 2023 20:34:33 GMT
At line:1 char:1
+ Get-MgBetaDeviceManagementComanagedDevice -ManagedDeviceId 'XXXXXXXX- ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: ({ ManagedDevice...ndProperty = }:<>f__AnonymousType193) [Get-MgBeta Devic...nagedDevice_Get], Exception
+ FullyQualifiedErrorId : No method match route template,Microsoft.Graph.Beta.PowerShell.Cmdlets.GetMgBetaDeviceMa nagementComanagedDevice_Get
DEBUG: [CmdletEndProcessing]: - Get-MgBetaDeviceManagementComanagedDevice end processing.
Module Version
Get-Module Microsoft.Graph* | select moduleType,Version,Name
ModuleType Version Name
---------- ------- ----
Script 2.11.1 Microsoft.Graph.Authentication
Script 1.27.0 Microsoft.Graph.Authentication
Script 2.11.1 Microsoft.Graph.Beta.DeviceManagement
Script 1.27.0 Microsoft.Graph.DeviceManagement
Environment Data
$PSVersionTable
Name Value
---- -----
PSVersion 5.1.22621.2506
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22621.2506
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1