almenscorner / IntuneCD

Tool to backup, update and document configurations in Intune
MIT License
277 stars 35 forks source link

[FEATURE] Change "Device Filter" import priority #181

Closed Edocsyl closed 5 months ago

Edocsyl commented 6 months ago

Is your feature request related to a problem? Please describe. When importing new policies into a new tenant, the assignment fails. This is because the "Device Filter" does not yet exist.

Describe the solution you'd like I would like the device filters to be processed, i.e. imported/created, right at the start of the "IntuneCD update" process. Or the possibility to say which "payload" should have which import/update priority.

Describe alternatives you've considered Create the filters manually on the tenant.

Additional context I get this error message: Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "C:\Program Files\Python312\Scripts\IntuneCD-startupdate.exe\__main__.py", line 7, in <module> File "C:\Program Files\Python312\Lib\site-packages\IntuneCD\run_update.py", line 311, in start run_update( File "C:\Program Files\Python312\Lib\site-packages\IntuneCD\run_update.py", line 232, in run_update update_intune( File "C:\Program Files\Python312\Lib\site-packages\IntuneCD\update_intune.py", line 65, in update_intune update(path, token, assignment, report, create_groups, remove, scope_tags) File "C:\Program Files\Python312\Lib\site-packages\IntuneCD\update\Intune\update_compliance.py", line 215, in update post_assignment_update( File "C:\Program Files\Python312\Lib\site-packages\IntuneCD\update\Intune\update_assignment.py", line 194, in post_assignment_update makeapirequestPost( File "C:\Program Files\Python312\Lib\site-packages\IntuneCD\intunecdlib\graph_request.py", line 209, in makeapirequestPost raise requests.exceptions.HTTPError( requests.exceptions.HTTPError: Request failed with 400 - {"error":{"code":"BadRequest","message":"{\r\n \"_version\": 3,\r\n \"Message\": \"An error has occurred - Operation ID (for customer support): 00000000-0000-0000-0000-000000000000 - Activity ID: 9a7358cc-6bbb-42ca-a086-xxxxxxxxxx- Url: https://fef.amsub0502.manage.microsoft.com/DeviceConfiguration_2402/StatelessDeviceConfigurationFEService/deviceManagement/deviceCompliancePolicies('bac6c597-9428-4910-aa28-xxxxxxxxxx')/microsoft.management.services.api.assign?api-version=5023-12-15\",\r\n \"CustomApiErrorPhrase\": \"\",\r\n \"RetryAfter\": null,\r\n \"ErrorSourceService\": \"\",\r\n \"HttpHeaders\": \"{}\"\r\n}","innerError":{"date":"2024-03-07T09:40:27","request-id":"9a7358cc-6bbb-42ca-a086-xxxxxxxxxx","client-request-id":"9a7358cc-6bbb-42ca-a086-xxxxxxxxxx"}}}

almenscorner commented 6 months ago

I will change the priority of filters in an upcoming version. Currently refactoring the entire IntuneCD code base and will make this a part of that