msgraph-sdk-powershell icon indicating copy to clipboard operation
msgraph-sdk-powershell copied to clipboard

Command fails with: property 'AdditionalProperties' does not exist on type 'microsoft.management..'

Open msewaweru opened this issue 2 years ago • 1 comments

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

  • Make sure you can reproduce this issue using the latest released version of Microsoft.Graph or Microsoft.Graph.Beta.
  • Please search the existing issues to see if there has been a similar issue filed.
  • For issues related to authentication and service errors, please refer to our troubleshooting guide. For service issues, please open a question at https://developer.microsoft.com/graph/support.

Describe the bug i'm working on this script to export policies from one Microsoft tenant and re create them in another tenant. the script is as follows: $compliancePolicies = Get-MgDeviceManagementDeviceCompliancePolicy $configurationProfiles = Get-MgBetaDeviceManagementDeviceConfiguration

$exportcompliancePolicies = $compliancePolicies | Export-Clixml -Path $compliancePoliciesPath $exportconfigurationProfiles = $configurationProfiles | Export-Clixml -Path $configurationProfilesPath Disconnect-MgGraph

$importcompliancePolicies = Import-Clixml -Path $compliancePoliciesPath $importconfigurationProfiles = Import-Clixml -Path $configurationProfilesPath

Connect-MgGraph -Scopes DeviceManagementConfiguration.ReadWrite.All

$importcompliancePolicies | New-MgDeviceManagementDeviceCompliancePolicy

the last command fails with this error:

New-MgDeviceManagementDeviceCompliancePolicy : The property 'AdditionalProperties' does not exist on type 'microsoft.management.services.api.deviceComplianceDeviceOverview'. Make sure to only use property names that are defined by the type. Status: 400 (BadRequest) ErrorCode: ModelValidationFailure

which is a bit puzzeling since your documentation has [-AdditionalProperties <Hashtable>] as the first option for the command.

if i check the "AdditionalProperties" for type, i get this: $importcompliancePolicies[0].AdditionalProperties.GetType()

IsPublic IsSerial Name BaseType
True True Hashtable System.Object

which seems to be in lien with what the documentation is asking for.

let me know what other information i can provide. I've tried the beta version of graph and it fails with the exact error. it also fails creating the configuration profiles (New-MgBetaDeviceManagementDeviceConfiguration)

To Reproduce Steps to reproduce the behavior:

  1. Execute -Mg- with ...
  2. See error at ...

Expected behavior

A clear and concise description of what you expected to happen.

Debug Output

Run the problematic command with -Debug and paste the resulting debug stream below. ⚠ ATTENTION: Be sure to remove any sensitive information that may be in the logs.

Module Version

Please run Get-Module Microsoft.Graph* after cmdlet execution and paste the output below. If a module cannot be installed or imported, please run Get-Module -ListAvailable and paste the output.

Environment Data

Please run $PSVersionTable and paste the output below. If running the Docker container image, indicate the tag of the image used and the version of Docker engine.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

msewaweru avatar Oct 11 '23 09:10 msewaweru

Hi @msewaweru apologies for the late response on this issue. Please refer to the list of allowable properties from the Api reference documentation here https://learn.microsoft.com/en-us/graph/api/intune-deviceconfig-windowsphone81compliancepolicy-create?view=graph-rest-1.0&tabs=powershell. Also share the debug log of that request by adding -Debug parameter.

timayabi2020 avatar Feb 04 '25 16:02 timayabi2020

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.