almenscorner / IntuneCD

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

[BUG] Inconsistent addition of the ID when --append-id is used #136

Closed ztrhgf closed 1 year ago

ztrhgf commented 1 year ago

Describe the bug Remediation scripts have "parent" JSON file with ID suffix, but also "child" ps1 files have ID in the name. Shell and PowerShell scripts have IDs only in "parent" JSON.

Solution Add an ID suffix to all "child" files (in this case Shell/PowerShell script files) too.

Additional context Right now the absence of the ID in the file names doesn't make sense (the user already explicitly chose to add the ID suffix) plus makes work with your otherwise great tool unnecessarily hard (when working with IDs).

For example, I need a modified policies ID so I can search the Intune audit log for the author of such change.

Now imagine this (very real world) situation. Some PowerShell script is deleted in the Intune. The backup is being run and detects such change. So I need to find the deleted script ID to be able to find the author of this change, but there is no "parent" JSON file in the repository to search for the ID (because it was deleted). If the ID is in the file name, I could easily extract it.

This problem applies to all "child" files without ID in their name.

Thank you in advance 👍

almenscorner commented 1 year ago

"The backup is being run and detects such change. So I need to find the deleted script ID to be able to find the author of this change, but there is no "parent" JSON file in the repository to search for the ID (because it was deleted). If the ID is in the file name, I could easily extract it."

The "parent" JSON is never deleted from the repo by running a backup. It might be moved to archive but it is never removed. So, if someone removes the Powershell script configuration from Intune, you will still be able to find it in the repo.

CoMMyCZ commented 1 year ago

Having a similar problem, having ID everywhere would be the most beneficial.

ztrhgf commented 1 year ago

"The backup is being run and detects such change. So I need to find the deleted script ID to be able to find the author of this change, but there is no "parent" JSON file in the repository to search for the ID (because it was deleted). If the ID is in the file name, I could easily extract it."

The "parent" JSON is never deleted from the repo by running a backup. It might be moved to archive but it is never removed. So, if someone removes the Powershell script configuration from Intune, you will still be able to find it in the repo.

Yes, I know I can extract it from the GIT history, but it would be A LOT easier, to just have the ID in the file name...

almenscorner commented 1 year ago

It might just be me not seeing what benefit adding ID to the script file name will bring. Nonetheless, it's added to v2.0.3-beta.1.

Test and report back!

almenscorner commented 1 year ago

Make sure you also test the update functionality with this, not just backup.

ztrhgf commented 1 year ago

Make sure you also the update functionality with this, not just backup.

Not sure what you mean? I've noticed this beta use '__' as a separator. Is that what you mean?

almenscorner commented 1 year ago

IntuneCD-startbackup is one command, however, these changes also affect IntuneCD-startupdate where the tool updates and creates configurations in Intune because the filenames of the scripts changes to include the ID whereas before it looked for the fileName reported in the config.

ztrhgf commented 1 year ago

IntuneCD-startbackup is one command, however, these changes also affect IntuneCD-startupdate where the tool updates and creates configurations in Intune because the filenames of the scripts changes to include the ID whereas before it looked for the fileName reported in the config.

I use IntuneCD just for backup.

ztrhgf commented 1 year ago

BUGs:

  1. Separator is incorrectly placed for Compliance Policies/Policies

image

  1. For WIN32 Windows apps there are three underscores instead of two image
almenscorner commented 1 year ago

Compliance is an easy fix, what should be included after the win32 is the product version so it should be " win32{PRODUCTVERSION}__{ID}". Does that app not have a product version? (or for win32, displayVersion)

Screenshot 2023-10-17 at 14 43 57
almenscorner commented 1 year ago

looking at it, I think you have left the "App Version" blank in the Intune console which is why nothing is added to the export

ztrhgf commented 1 year ago

looking at it, I think you have left the "App Version" blank in the Intune console which is why nothing is added to the export

Exactly, I don't set version at all :)

ztrhgf commented 1 year ago

Let me know when the new beta is released to test it out. Thanks!

almenscorner commented 1 year ago

these two has been fixed in 2.0.3 beta2 which is uploading now.

ztrhgf commented 1 year ago

Seems good now 👍

ztrhgf commented 1 year ago

Looking forward to the official release

Thanks a lot for your work 👍

ztrhgf commented 1 year ago

btw this is the reason I need to have an ID https://doitpsway.com/how-to-easily-backup-your-intune-environment-using-intunecd-and-azure-devops-pipeline