msgraph-metadata icon indicating copy to clipboard operation
msgraph-metadata copied to clipboard

No method match route template when executing Remove-MgBetaDeviceManagementScriptGroupAssignment

Open AndrewJNet opened this issue 3 years ago • 0 comments

Issue Summary When executing the Remove-MgBetaDeviceManagementScriptGroupAssignment a status 400 (BadRequest) is received. I receive the same response in Graph Explorer.

Referenced Graph documentation: https://learn.microsoft.com/en-us/graph/api/intune-devices-devicemanagementscriptgroupassignment-delete?view=graph-rest-beta

To Reproduce

  1. Execute the following ($IntuneScript and $IntuneScriptAssignments return results in my tenant):
$ScriptName = "Escrow Bitlocker Recovery Keys"
$IntuneScript = Get-MgBetaDeviceManagementScript -Filter "displayName eq '$ScriptName'"
$URI = "https://graph.microsoft.com/beta/deviceManagement/deviceManagementScripts/$($IntuneScript.Id)/groupAssignments"
$IntuneScriptAssignments = Invoke-MgGraphRequest -Uri $URI -Method GET
$Assignment.id = $IntuneScriptAssignments.value.targetGroupId[0]
Remove-MgBetaDeviceManagementScriptGroupAssignment -DeviceManagementScriptId $IntuneScript.Id -DeviceManagementScriptGroupAssignmentId $Assignment.id
  1. Execute a DELETE against https://graph.microsoft.com/beta/deviceManagement/deviceManagementScripts/{deviceManagementScriptId}/groupAssignments/{deviceManagementScriptGroupAssignmentId} in Graph Explorer

Debug Output In PowerShell:

DEBUG: [CmdletEndProcessing]: - Remove-MgBetaDeviceManagementScriptGroupAssignment end processing.
> $ScriptName = "Escrow Bitlocker Recovery Keys"
$IntuneScript = Get-MgBetaDeviceManagementScript -Filter "displayName eq '$ScriptName'"
# Management Scripts Assignments URI
$URI = "https://graph.microsoft.com/beta/deviceManagement/deviceManagementScripts/$($IntuneScript.Id)/groupAssignments"
$IntuneScriptAssignments = Invoke-MgGraphRequest -Uri $URI -Method GET
$intunescriptassignments.value.targetgroupid[0]| foreach {
    Remove-MgBetaDeviceManagementScriptGroupAssignment -DeviceManagementScriptId $IntuneScript.Id -DeviceManagementScriptGroupAssignmentId $_ -Debug
}

DEBUG: [CmdletBeginProcessing]: - Remove-MgBetaDeviceManagementScriptGroupAssignment begin processing with parameterSet 'Delete'.
DEBUG: [Authentication]: - AuthType: 'Delegated', TokenCredentialType: 'InteractiveBrowser', ContextScope: 'CurrentUser', AppName: 'Microsoft Graph Command Line Tools'.
DEBUG: [Authentication]: - Scopes: [Application.Read.All, AppRoleAssignment.ReadWrite.All, AuditLog.Read.All, DeviceManagementConfiguration.ReadWrite.All, DeviceManagementManagedDevices.PrivilegedOperations.All, DeviceManagementManagedDevices.Read.All, DeviceManagementManagedDevices.ReadWrite.All, DeviceManagementServiceConfig.Read.All, DeviceManagementServiceConfig.ReadWrite.All, Directory.Read.All, Group.Read.All, Group.ReadWrite.All, openid, profile, User.Read, User.Read.All, email, DeviceManagementApps.ReadWrite.All].

Confirm
Are you sure you want to perform this action?
Performing the operation "Remove-MgBetaDeviceManagementScriptGroupAssignment_Delete" on target "Call remote 'DELETE
/deviceManagement/deviceManagementScripts/{deviceManagementScript-id}/groupAssignments/{deviceManagementScriptGroupAssignment-id}' operation".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): y
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
DELETE

Absolute Uri:
https://graph.microsoft.com/beta/deviceManagement/deviceManagementScripts/d830db3c-d2ec-476c-8fd6-a6b0b107f812/groupAssignments/1

Headers:
FeatureFlag                   : 00000043
Cache-Control                 : no-store, no-cache
User-Agent                    : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.22000; en-US),PowerShell/2023.8.0
Accept-Encoding               : gzip
SdkVersion                    : graph-powershell-beta/2.9.0
client-request-id             : 16151d3f-070b-433a-b0f6-c1ef5c593ccd

Body:



DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
BadRequest

Headers:
Transfer-Encoding             : chunked
Vary                          : Accept-Encoding
Strict-Transport-Security     : max-age=31536000
request-id                    : 87fe623b-7707-4c96-832e-315b51685d65
client-request-id             : 16151d3f-070b-433a-b0f6-c1ef5c593ccd
x-ms-ags-diagnostic           : {"ServerInfo":{"DataCenter":"North Central US","Slice":"E","Ring":"3","ScaleUnit":"005","RoleInstance":"CH01EPF000196F0"}}
Date                          : Fri, 17 Nov 2023 05:47:22 GMT

Body:
{
  "error": {
    "code": "No method match route template",
    "message": "No OData route exists that match template ~/singleton/navigation/key/navigation/key with http verb DELETE for request /DeviceFE/StatelessDeviceFEService/deviceManagement/deviceManagementScripts('d830db3c-d2ec-476c-8fd6-a6b0b107f812')/groupAssignments('1').",
    "innerError": {
      "date": "2023-11-17T05:47:23",
      "request-id": "87fe623b-7707-4c96-832e-315b51685d65",
      "client-request-id": "16151d3f-070b-433a-b0f6-c1ef5c593ccd"
    }
  }
}


Remove-MgBetaDeviceManagementScriptGroupAssignment_Delete: 
Line |
   7 |      Remove-MgBetaDeviceManagementScriptGroupAssignment -DeviceManagem …
     |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | No OData route exists that match template ~/singleton/navigation/key/navigation/key with http verb DELETE for request /DeviceFE/StatelessDeviceFEService/deviceManagement/deviceManagementScripts('d830db3c-d2ec-476c-8fd6-a6b0b107f812')/groupAssignments('1').

Status: 400 (BadRequest)
ErrorCode: No method match route template
Date: 2023-11-17T05:47:23

Headers:
Transfer-Encoding             : chunked
Vary                          : Accept-Encoding
Strict-Transport-Security     : max-age=31536000
request-id                    : 87fe623b-7707-4c96-832e-315b51685d65
client-request-id             : 16151d3f-070b-433a-b0f6-c1ef5c593ccd
x-ms-ags-diagnostic           : {"ServerInfo":{"DataCenter":"North Central US","Slice":"E","Ring":"3","ScaleUnit":"005","RoleInstance":"CH01EPF000196F0"}}
Date                          : Fri, 17 Nov 2023 05:47:22 GMT

DEBUG: [CmdletEndProcessing]: - Remove-MgBetaDeviceManagementScriptGroupAssignment end processing.

In Graph Explorer: { "error": { "code": "No method match route template", "message": "No OData route exists that match template ~/singleton/navigation/key/navigation/key with http verb DELETE for request /DeviceFE/StatelessDeviceFEService/deviceManagement/deviceManagementScripts('d830db3c-d2ec-476c-8fd6-a6b0b107f812')/groupAssignments('2bc6e016-1059-436f-8c24-4cdccc5628ca').", "innerError": { "date": "2023-11-17T05:39:31", "request-id": "631534c3-b75d-4786-8123-72a247bfabf0", "client-request-id": "c4253cfc-81dc-3de9-54db-8f926066ba77" } } }

image

AndrewJNet avatar Nov 17 '23 05:11 AndrewJNet