microsoftgraph / microsoftgraph/msgraph-sdk-powershell

Get-MgDeviceManagementDeviceCompliancePolicyAssignment does not show the Target value

Open
#2,399 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug
Dominant language
C#
Stars
898
Forks
230
Avg merge
2d 5h
Merged PRs (30d)
31

Description

Thanks for reporting the bug. Please ensure you've gone through the following checklist before opening an issue:

Describe the bug
I cant see the Target of Assignment Compliance Policy in Intune using MS Graph
image

To Reproduce
Steps to reproduce the behavior:

Import-Module Microsoft.Graph.DeviceManagement
Get-MgDeviceManagementDeviceCompliancePolicyAssignment -DeviceCompliancePolicyId $deviceCompliancePolicyId

Expected behavior
I should see the Target value like on Graph Explorer
image

Debug Output
Get-MgDeviceManagementDeviceCompliancePolicyAssignment -DeviceCompliancePolicyId $CompliancePolicy.Id -Debug | FL
DEBUG: [CmdletBeginProcessing]: - Get-MgDeviceManagementDeviceCompliancePolicyAssignment begin processing with parameterSet 'List'.

Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): A
DEBUG: [Authentication]: - AuthType: 'Delegated', TokenCredentialType: 'InteractiveBrowser', ContextScope: 'CurrentUser', AppName:
'Microsoft Graph Command Line Tools'.
DEBUG: [Authentication]: - Scopes: [Application.Read.All, AppRoleAssignment.ReadWrite.All, DeviceManagementApps.Read.All,
DeviceManagementConfiguration.ReadWrite.All, DeviceManagementManagedDevices.Read.All, DeviceManagementManagedDevices.ReadWrite.All,
Group.Read.All, openid, profile, User.Read, User.Read.All, email].
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://graph.microsoft.com/v1.0/deviceManagement/deviceCompliancePolicies//assignments

Headers:
FeatureFlag : 00000043
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.19045; pl-PL),PowerShell/5.1.19041.3570
Accept-Encoding : gzip
SdkVersion : graph-powershell/2.8.0
client-request-id : 72e49bd1-0ebb-4eef-a23c-2dc09d346fe0

Body:

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

Status Code:
OK

Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id :
client-request-id :
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Germany West
Central","Slice":"E","Ring":"5","ScaleUnit":"001","RoleInstance":"FR2PEPF000001DC"}}
OData-Version : 4.0
Date : Fri, 03 Nov 2023 14:30:27 GMT

Body:
{
"@odata.context":
"https://graph.microsoft.com/v1.0/$metadata#deviceManagement/deviceCompliancePolicies('cc26ee06-ae41-49c2-8d6d-8b2c081778a0')/assignment
s",
"value": [
{
"id": "",
"target": {
"@odata.type": "#microsoft.graph.allDevicesAssignmentTarget"
}
}
]
}

Id :
Target : Microsoft.Graph.PowerShell.Models.MicrosoftGraphDeviceAndAppManagementAssignmentTarget
AdditionalProperties : {}

DEBUG: [CmdletEndProcessing]: - Get-MgDeviceManagementDeviceCompliancePolicyAssignment end processing.
image

Module Version
Get-Module Microsoft.Graph*

ModuleType Version Name ExportedCommands


Script 2.8.0 Microsoft.Graph.Authentication {Add-MgEnvironment, Connect-MgGraph, Disconnect-MgGraph, Get-MgContext...}
Script 2.8.0 Microsoft.Graph.DeviceManagement {Get-MgAdminEdge, Get-MgAdminEdgeInternetExplorerMode, Get-MgAdminEdgeInternetExplorerModeSiteList, Get-MgAdminEdgeInternetExplorerModeSiteListCount...}

Environment Data
$PSVersionTable

Name Value


PSVersion 5.1.19041.3570
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.3570
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Screenshots

Additional context

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing Get-MgDeviceManagementDeviceCompliancePolicyAssignment from the Microsoft.Graph.DeviceManagement module and compare its Target output with Graph Explorer. Trace the cmdlet's generated assignment model and response handling; done means the Target value returned by the API is exposed rather than only the base assignment-target type.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.