-
Notifications
You must be signed in to change notification settings - Fork 523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSFT_IntuneAppProtectionPolicyAndroid.psm1 remove Get-M365DSCIntuneAppProtectionPolicyAndroid function and fix #1955 #2091
Conversation
add appgrouptype variable (doesn't actualy set it yet remove calls to Get-M365DSCIntuneAppProtectionPolicyAndroid and corresponding function add get-InputParameters function to allow easy looping of all parameters in other functions
removed appgrouptype parameter- that's not what I'm trying to implement here - will do that when I alter set command
amended policy.add values so they acutally work
the output using the graph module doesn't return objects that can be exported to a DSC config - rather than try to amend reverse DSC to handle the objects (it would mean either a generic action adding or support for lots of object types) I added conversion data to this module - get-InputParameters now returns a hashtable of hashtables - I hope to be able to re-use this function for further updates. Tested with an add and amend and it performed as expected
removed commented lines and removed name value from hashtable of parameters (primary hashtable already contains name)
amended test file to remove reference to Get-M365DSCIntuneAppProtectionPolicyAndroid and to return a suitable object for Get-MgDeviceAppManagementAndroidManagedAppProtection
@menswearUK the parameters you are trying to remove are being returned by the function: |
Hi Nik, I don't think isAssigned is required as the value is automatically set based on the content of assignments Can you advise if the other code changes are acceptable? If so I'll add in those parameters to this branch |
All other changes make total sense. Let's add back the values and keep IsAssigned in there as to not cause any breaking changes. Thanks |
Added in new parameters - also discovered that assignments and excluded groups are not amended when an existing policy is amended, added this in removed mandatory requirement for assignments value as a null array will cause errors and you may conceivably want to apply an edit to remove all assignments I'm still not sure about isassigned as I've had to hack it in the test-targetresource
Hi Nik, |
tweaked tests file so returned objects and config default parameters are only set in a single place
updated changelog
Hi @NikCharlebois , |
@NikCharlebois |
@menswearUK we should try to call into the cmdlet wherever possible instead of direct calls. Let me know when you've had a chance to refactor the PR and I'll review it. Thanks again for all your hard work! |
added appgrouptype parameter amended to use graph module cmdlets removed unused functions added a few formatting functions to constrinct json snippets, convert timespans, and set the appgrouptype and apps values Updated test file with mocking for graph module, etc. amended the test-targetresource module
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
updated changelog to reflect new features minor tidy up of main code - removed commented line. commented out a write-host I used for info while testing, etc
Hi @NikCharlebois , |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Pull Request (PR) description
This change amends the get-targetresource function to eliminate function Get-M365DSCIntuneAppProtectionPolicyAndroid.
The function is not needed as we already gather all the information required when we call Get-MgDeviceAppManagementAndroidManagedAppProtection.
I've added a function to gather a list of the parameters and any amendments required to allow the export function to work correctly.
Get-MgDeviceAppManagementAndroidManagedAppProtection is using the beta profile. Whilst this isn't required for this update the function I've removed used the beta profile for gathering data and I'll need it for future updates as there are some values not returned by using v1.0.
It also no longer returns the parameters which cause error #1955. I've tested the export function and have been able to use the config as exported to create a new policy
This Pull Request (PR) fixes the following issues
fixes #1955