dsccommunity / DscWorkshop

Blueprint for a full featured DSC project for Push / Pull with or without CI/CD
MIT License
203 stars 162 forks source link

How to use dynamic Variable in Datum yml files? #175

Open gabeKay opened 1 week ago

gabeKay commented 1 week ago

Hello everyone,

I've been working with Datum, SharedDSC, SecretVaults, and so on for weeks. I've been dissecting your (Gael, Raandree) code for weeks, and sometimes it's been a real struggle, but I managed to build a professional-level environment that we can soon use in production. The idea behind Composite Configurations is fantastic – it makes my old DSC configurations look like monsters in comparison.

However, one thing I don’t understand is how I can interpret variables in the Datum YAML files. I see [X=...=] with variables in the YAMLs, but in the MOF files, they appear as strings. I'm using Get-SplattedResource.

image

Could you please give me a hint?

--------- EDIT -----------

I've partially figured it out. Setting variables simply works. However, when I need variables directly in the MOF build process, it doesn’t work. Is this even possible? In the workshop, encrypted credentials are already set in the YML, but that’s not an option for me. What does work is setting them directly in the SharedDSC. However, using the YML would be better

image

The certificate path also cannot be inserted dynamically; it is only interpreted in the final MOF.

image

RSOP YML image

Best regards, Gabe

gabeKay commented 1 week ago

I got it right. It is very well described, if I had looked in the right file

Datum.InvokeCommand makes the magic