DSC icon indicating copy to clipboard operation
DSC copied to clipboard

Support URI on dsc config

Open Gijsreyn opened this issue 9 months ago • 3 comments

Summary of the new feature / enhancement

As a user, I want the ability to specify a URI to a configuration document. This removes the step to pull down the configuration document file and allows me to directly point towards it as such:

dsc config get --file https://raw.githubusercontent.com/PowerShell/DSC/refs/heads/main/dsc/examples/assertion.dsc.yaml

Proposed technical implementation details (optional)

No response

Gijsreyn avatar Apr 01 '25 04:04 Gijsreyn

I'm not sure that the tool should handle this - the alternative here would be something like

Invoke-WebRequest $url |
    Select-Object -ExpandProperty Content |
    dsc config get --file -

or

curl $uri | dsc config get --file -

Having DSC handle URIs for --file and downloading content directly in general requires expanding the vulnerability surface of the tool for web requests. I think this functionality is better left to higher order tools / workflows, but I'm open to different perspectives.

michaeltlombardi avatar Apr 01 '25 13:04 michaeltlombardi

I was already a little afraid of that, but the idea came from the winget CLI. It's already supported there, and with the ongoing development to integrate DSC in it, I guess you already have your first higher order tool that does it.

Gijsreyn avatar Apr 01 '25 13:04 Gijsreyn

Hopefully, this will be alternately resolved once people can package and publish configurations and resources to a repository - rather than pulling a configuration document and immediately applying it, you could search for, review, and save configurations for re-use. This will be more important later on when the default settings for DSC may require signed files, attestations, etc.

michaeltlombardi avatar Apr 01 '25 14:04 michaeltlombardi