This pull request introduces a few changes to the AppProtectionPolicy/ManagedAppPolicy_Export.ps1 and AppProtectionPolicy/ManagedAppPolicy_Import_From_JSON.ps1 files. The changes include formatting/code readability and improvements to the handling and validation of JSON data during import and export.
JSON Handling and Validation:
AppProtectionPolicy/ManagedAppPolicy_Export.ps1: The script now iterates over the full AndroidPolicies and iOSPolicies objects instead of just their Id properties. It also uses Invoke-MgGraphRequest to retrieve policy data and directly writes the response to a JSON file, simplifying the process and reducing the risk of errors. This should resolve #5
AppProtectionPolicy/ManagedAppPolicy_Import_From_JSON.ps1: The script now distinguishes between iOS and Android policies and creates the appropriate policy accordingly. It also includes improved error handling and provides more informative error messages.
This pull request introduces a few changes to the
AppProtectionPolicy/ManagedAppPolicy_Export.ps1
andAppProtectionPolicy/ManagedAppPolicy_Import_From_JSON.ps1
files. The changes include formatting/code readability and improvements to the handling and validation of JSON data during import and export.JSON Handling and Validation:
AppProtectionPolicy/ManagedAppPolicy_Export.ps1
: The script now iterates over the fullAndroidPolicies
andiOSPolicies
objects instead of just theirId
properties. It also usesInvoke-MgGraphRequest
to retrieve policy data and directly writes the response to a JSON file, simplifying the process and reducing the risk of errors. This should resolve #5AppProtectionPolicy/ManagedAppPolicy_Import_From_JSON.ps1
: The script now distinguishes between iOS and Android policies and creates the appropriate policy accordingly. It also includes improved error handling and provides more informative error messages.