microsoftgraph / msgraph-sdk-powershell

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

null valued properties should be serialized in when using cmdlets #3008

Open gavinbarron opened 3 weeks ago

gavinbarron commented 3 weeks ago

Describe the bug

A customer is trying to clear the Devices Conditions in a Conditional Access Policy and cannot using Update-MgIdentityConditionalAccessPolicy

Expected behavior

We can clear sections of a Conditional Access Policy using Update-MgIdentityConditionalAccessPolicy

When running the reproduction code we should see a request body with a null valued Devices property, e.g.:

{
  "Conditions": {
    "Devices": null
  }
}

How to reproduce

Run the following commands with fiddler set up and intercepting requests to Microsoft Graph

Connect-MgGraph
$policyId = "POLICYID"

$params = @{
  conditions = @{
   devices = $null
  }
}

Update-MgIdentityConditionalAccessPolicy -ConditionalAccessPolicyId $policyId -BodyParameter $params

You will see that the body of the request sent over the wire contains and empty object {}

SDK Version

No response

Latest version known to work for scenario above?

No response

Known Workarounds

use Invoke-GraphRequest

Debug output

not provided in IcM: https://portal.microsofticm.com/imp/v5/incidents/details/557480666

Configuration

Not provided

Other information

No response