microsoftgraph / microsoftgraph/msgraph-sdk-powershell
Get-MgDeviceManagementDeviceConfigurationAssignment returns empty target
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 898
- Forks
- 230
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 31
Description
Describe the bug
I am trying to query a specific configuration profile's assignments but it's returning assignments with "Target" property missing.
Expected behavior
returns assignments with target.
How to reproduce
- Execute
Connect-MgGraph -Scopes "DeviceManagementConfiguration.ReadWrite.All" - Execute
Get-MgDeviceManagementDeviceConfigurationAssignment -DeviceConfigurationId {deviceConfigurationId}
SDK Version
2.16.0
Latest version known to work for scenario above?
No response
Known Workarounds
run api call manually using Invoke-MgGraphRequest:
Invoke-MgGraphRequest -Method GET -Uri "/v1.0/deviceManagement/deviceConfigurations/$($configurationProfile.Id)/assignments"
Debug output
DEBUG: [CmdletBeginProcessing]: - Get-MgDeviceManagementDeviceConfigurationAssignment begin processing with parameterSet 'List'.
DEBUG: [Authentication]: - AuthType: 'AppOnly', TokenCredentialType: 'ClientSecret', ContextScope: 'Process', AppName: 'REDACTED'.
DEBUG: [Authentication]: - Scopes: [DeviceManagementManagedDevices.Read.All, Device.Read.All, Group.ReadWrite.All, User.Read.All, DeviceManagementConfiguration.ReadWrite.All].
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://graph.microsoft.com/v1.0/deviceManagement/deviceConfigurations/{REDACTED}/assignments
Headers:
FeatureFlag : 00000043
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.22631; en-US),PowerShell/2024.2.1
Accept-Encoding : gzip
SdkVersion : graph-powershell/2.16.0
client-request-id : 1f898a68-779d-4097-bf83-09388fc05fa6
Body:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
OK
Headers:
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : aa760a65-ad0e-4850-b238-77fcbd9d0bd2
client-request-id : 1f898a68-779d-4097-bf83-09388fc05fa6
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"East US 2","Slice":"E","Ring":"5","ScaleUnit":"000","RoleInstance":"BN5PEPF0000E134"}}
odata-version : 4.0
Date : Tue, 14 May 2024 19:55:38 GMT
Body:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#deviceManagement/deviceConfigurations('{REDACTED}')/assignments",
"value": [
{
"id": "{REDACTED}",
"target": {
"@odata.type": "#microsoft.graph.groupAssignmentTarget",
"groupId": "a9cf9631-72c0-4e9f-8a13-03259a28463d"
}
}
]
}
DEBUG: [CmdletEndProcessing]: - Get-MgDeviceManagementDeviceConfigurationAssignment end processing.
Configuration
- PSVersion 7.4.1
- PSEdition Core
- GitCommitId 7.4.1
- OS Microsoft Windows 10.0.22631
- Platform Win32NT
- PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
- PSRemotingProtocolVersion 2.3
- SerializationVersion 1.1.0.1
- WSManStackVersion 3.0
Other information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with Get-MgDeviceManagementDeviceConfigurationAssignment and compare its output with the Invoke-MgGraphRequest workaround shown in the issue. Trace how the returned target is represented and deserialized, then verify that the groupAssignmentTarget data is preserved and add or run a regression check for the reported response.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- api, devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100