microsoftgraph / msgraph-sdk-powershell

Powershell SDK for Microsoft Graph
https://www.powershellgallery.com/packages/Microsoft.Graph
Other
701 stars 168 forks source link

New-MgDeviceManagementGroupPolicyConfigurationDefinitionValue - how to reference definition? #1806

Closed William-Francillette closed 1 year ago

William-Francillette commented 1 year ago

I don't know how to reference the Definition of a new definitionValue for an intune GroupPolicy? This is the code I have tried

$dv=@{
    Definition=@{id='50b2626d-f092-4e71-8983-12a5c741ebe0'}
    "Enabled"= $true
    ConfigurationType="policy"
}
New-MgDeviceManagementGroupPolicyConfigurationDefinitionValue -GroupPolicyConfigurationId 'c57c9e17-3e54-4961-b5b4-75489f855a4e' -BodyParameter $dv

The Intune portal utilizes updateDefinitionValues and 'definition@odata.bind'="https://graph.microsoft.com/beta/deviceManagement/groupPolicyDefinitions('50b2626d-f092-4e71-8983-12a5c741ebe0')" https://learn.microsoft.com/en-us/graph/api/intune-grouppolicy-grouppolicyconfiguration-updatedefinitionvalues?view=graph-rest-beta

I would rather use the sdk instead of fallback on the REST API

I had no issue with get, update and remove of the cmdlet There is no information/example in the doc

timayabi2020 commented 1 year ago

Hi @William-Francillette, please open a question at https://developer.microsoft.com/en-us/graph/support to get assistance from subject matter experts. This repository is intended for issues related to the functionality of the module (bugs and feature requests). We may not be the best place to answer some queries that are tied to the functionality of the API or how to use an API.

William-Francillette commented 1 year ago

@timayabi2020, the issue is specific to the Graph SDK module and not API - there isn't any documentation/example about how to reference this attribute. The Rest API uses the action updateDefinitionValues - it doesn't looks like there is an equivalent for the SDK

peombwa commented 1 year ago

@William-Francillette, the SDK already supports updateDefinitionValues action via Update-MgBetaDeviceManagementGroupPolicyConfigurationMultipleDefinitionValue.

➜ Find-MgGraphCommand -Uri "https://graph.microsoft.com/beta/deviceManagement/groupPolicyConfigurations/{groupPolicyConfigurationId}/updateDefinitionValues"

   APIVersion: beta

Command                                                                      Module                        Method URI                                                                                              OutputType Permissions                                   Variants
-------                                                                      ------                        ------ ---                                                                                              ---------- -----------                                   --------
Update-MgBetaDeviceManagementGroupPolicyConfigurationMultipleDefinitionValue Beta.DeviceManagement.Actions POST   /deviceManagement/groupPolicyConfigurations/{groupPolicyConfiguration-id}/updateDefinitionValues            {DeviceManagementConfiguration.ReadWrite.All} {Update, UpdateExpanded, UpdateViaIdentity, UpdateViaIdentityExpanded}

It's the API reference doc that hasn't fully documented to show all examples - https://learn.microsoft.com/en-us/graph/api/intune-grouppolicy-grouppolicyconfiguration-updatedefinitionvalues?view=graph-rest-beta:

Not yet documented

William-Francillette commented 1 year ago

@peombwa thanks you're a super star!