As stated in my last comment in #10, I was able to test the v2 and noticed the following behaviors:
Issues:
When a Connect-MgGraph error occurs, the script incorrectly reports "Successfully connected to Microsoft Graph".
This can easily be reproduced by incorrectly setting one of the 3 key variables, for example. In my testing, I tried to delete the certificate used to authenticate the App in Azure and this is what happened:
The error itself is of course expected in this example, but the script fails to catch the error and instead incorrectly continues as if no error had occurred.
So far, it seems to be the only real issues I've noticed. I will update this post accordingly if I find new ones.
Suggested improvements:
A small adjustment can be made to how the script exits, by adding Disconnect-MgGraph | Out-Null right before exit here: https://github.com/ugurkocde/IntuneAssignmentChecker/blob/59d2c6334fdf091e2afde46eae0e9007be82fa94/IntuneAssignmentChecker_v2.ps1#L2045-L2046
This ensures the MS Graph token gets cleared each time the script is exited using the option "8". This is desired to improve reliability and security, in case of configuration changes, for example. | Out-Null allows for a silent output of the command, as it lacks an argument similar to -NoWelcome for Connect-MgGraph. So it's probably the closest to that behavior we can achieve by redirecting the output to $null.
As stated in my last comment in #10, I was able to test the v2 and noticed the following behaviors:
Issues:
When a
Connect-MgGraph
error occurs, the script incorrectly reports "Successfully connected to Microsoft Graph". This can easily be reproduced by incorrectly setting one of the 3 key variables, for example. In my testing, I tried to delete the certificate used to authenticate the App in Azure and this is what happened: The error itself is of course expected in this example, but the script fails to catch the error and instead incorrectly continues as if no error had occurred.Connect-MgGraph
is missing the-NoWelcome
argument, like in the previous v1 script: https://github.com/ugurkocde/IntuneAssignmentChecker/blob/59d2c6334fdf091e2afde46eae0e9007be82fa94/IntuneAssignmentChecker_v2.ps1#L88So far, it seems to be the only real issues I've noticed. I will update this post accordingly if I find new ones.
Suggested improvements:
Disconnect-MgGraph | Out-Null
right beforeexit
here: https://github.com/ugurkocde/IntuneAssignmentChecker/blob/59d2c6334fdf091e2afde46eae0e9007be82fa94/IntuneAssignmentChecker_v2.ps1#L2045-L2046 This ensures the MS Graph token gets cleared each time the script is exited using the option "8". This is desired to improve reliability and security, in case of configuration changes, for example.| Out-Null
allows for a silent output of the command, as it lacks an argument similar to-NoWelcome
forConnect-MgGraph
. So it's probably the closest to that behavior we can achieve by redirecting the output to $null.Thank you again for this awesome script!