Skip to content
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

Dynamic Resource Generator - more detailed guide/documentation for building or modifying resources #2817

Open
salbeck-sit opened this issue Jan 20, 2023 · 4 comments

Comments

@salbeck-sit
Copy link
Contributor

I've started using the DRG to build the foundation for a few resources but has now run into the problem, if you will, that if DRG gets the impression from Graph that a resource doesn't contain (nested) CimInstances, it doesn't provide any hints about how to go about adding a CimInstance to a resource. I've had to go the long route and compare with other resources that seemed to 'fit the bill' but it would be nice to have a place to go when I need to lookup 'how do I...' when building or modifying a resource. Any pointers besides https://microsoft365dsc.com/user-guide/advanced/dynamic-resource-generator/ that I'm not aware of ?

@William-Francillette
Copy link
Contributor

I have posted a PR #2823 with improved nested CIM management - it should fix most issues with nested CIM
Feel free to share the cmdlet noun you've used and I'll have a look
thanks

@salbeck-sit
Copy link
Contributor Author

I've spent some hours with MgDirectoryAdministrativeUnit and its beta-cousin MgAdministrativeUnit. In earlier versions of the Graph-modules, there were parameters for Members and ScopedRoleMembers. ScopedRoleMembers has a nested object/hashtable that DRG correctly translated to a CIM class, but the export-code didn't handle it.
I went down a rabbit-hole and the code became so ugly that I decided to start over, but in the meantime Graph had moved on and the above parameters were gone so I had to add the CIMInstances manually and that was a bit of a struggle.

@William-Francillette
Copy link
Contributor

For the export you can use the ComplexTypeMapping parameter of Get-M365DSCDRGComplexTypeToString - it will overwrite the hashtable and construct the CIM instance for the export file
You can check MSFT_AADEntitlementManagementAccessPackageCatalogResource to see how it works

I have included the logic in the DRG now - it should be automatic

@salbeck-sit
Copy link
Contributor Author

That's the kind of 'documentation' I'm looking for. If you feel like it, a few words and some pointers in the M365DSC blog would go a long way in my book.
I'm aware that the intent for building new resources is to use the DRG. But some resources lend themselves to be customized. One such example is (New-)MgAccessReviewDefinition that seems a bit too complex when all I'm looking for is a resource that'll let me setup Access Reviews for guest users by members of a named security-group. That made me consider building a basic resource where I can add CimInstances if or when required by practical requirements. I'm still considering that and will try to find time to see how it turns out. Now I'm at least somewhat armed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants