IntuneManagement icon indicating copy to clipboard operation
IntuneManagement copied to clipboard

PolicySets are missing policies when the tenant has more than 100 policies

Open jjrmilner opened this issue 1 year ago • 10 comments

When a PolicySet is created in a tenant with more than 100 policies, any policy set that is created which includes policies beyond the first 100 will have missing XML errors in the policy set.

jjrmilner avatar Dec 24 '23 08:12 jjrmilner

Hello,

That is a weird one. Is it 100 policies in total or 100 policies if a specific kind eg Configuration Policies. Do you gave a log you can attach? Also the error, is that during listing,exporting, importing or documenting a Policy Set? Sounds like after import but just to be sure.

Cheers!

Micke-K avatar Dec 27 '23 11:12 Micke-K

Hi

The issue arises if the policy set includes one or more policies that are not the first 100 policies in the tenant.

For example:

If policy A is policy number 48, and policy B is policy number 165, and both policies are in the policyset.

The policy set gets created. It show that it contains 2 policies. Policy A is listed correctly. Policy B is listed as ‘Device Configuration Not Found’. The policy can't be clicked on and can only be removed from the policy set.

The issue presents when the policy set is imported.

I will import a set into a test tenant and will upload the logs and a few screen shots.

Alternatively, I am available for a remote session via teams. I am working today 😉

Thanks JJ

jjrmilner avatar Dec 27 '23 11:12 jjrmilner

Here are the screenshots on the target tenant after the import: image

image

jjrmilner avatar Dec 27 '23 12:12 jjrmilner

These are the only errors in the logs. I dont think they are relevant to the issues creating the policy sets but I have included them for reference:

image

image

image

image

image

jjrmilner avatar Dec 27 '23 12:12 jjrmilner

Some additional information.

The target tenants have over 1000 configuration profiles.

Intune does not return all 1000 profiles immediately. The first 100 are returned and display a message at the top of the page that the full list is being compiled. After a few seconds, a ‘Ready’ button appears to merge the results. Intune then returns the full set of data.

When adding a policy to the policy set, Intune paginates the list of available policies with a ‘load more’ prompt.

I am wondering if the Policy Set API has a similar behaviour, which is preventing the import from correctly referencing some of the configuration profiles.

Thanks JJ

jjrmilner avatar Dec 29 '23 03:12 jjrmilner

Hello,

Sorry I've been away from the computer during the holidays and thank you for all the troubleshooting.

I attached an updated version. I hope this will fix it. The dependency during import loaded only the first page. Policies with multiple pages would then not be available and import would fail. This will load a lot of data so memory usage and import time will increase.

Cheers

MSGraph.zip

Micke-K avatar Jan 02 '24 07:01 Micke-K

Thank you - I will test the new code and let you know the results.

jjrmilner avatar Jan 06 '24 09:01 jjrmilner

I have started testing the policy set exports.

Policysets do not export the PolicySets Node of Intune Manager. The log does not generate any errors, but no files are saved.

However, if I use the Bulk Export option and select the Policy sets Object Type, then the policy sets to export.

I will test the import and advise futher.

jjrmilner avatar Jan 09 '24 09:01 jjrmilner

I have tested importing PolicySets (Same Tenant), and all the policies are now being added to the PolicySet :).

Thank you for your help with this.

jjrmilner avatar Jan 09 '24 09:01 jjrmilner

Hello,

Thank you for the update!

I have no issues exporting a single Policy Set. I did some simple tests but all worked.

I'll see if I can do some more tests later.

Cheers!

Micke-K avatar Jan 10 '24 12:01 Micke-K