PowerShell / PowerShell/DSC

Enable passing JSON input properties as args to resource

Open
#1,475 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Issue-Enhancement Needs Triage
Dominant language
Rust
Stars
523
Forks
75
Avg merge
3d 16h
Merged PRs (30d)
24

Description

Summary of the new feature / enhancement

There might be an existing CLI tool or the developer wants their CLI tool to serve as both a user facing tool but also DSC resource. So in that case, they wouldn't want to receive and process a JSON payload.

Proposed technical implementation details (optional)

In the resource manifest, we can add support for expressions for the args:

{
    "$schema": "https://aka.ms/dsc/schemas/v3/bundled/resource/manifest.json",
    "type": "Microsoft.Windows/User",
    "version": "1.0.0",
    "set": {
        "executable": "net.exe",
        "args": [
            "user",
            "[input().name]",
            "[input().password]",
            "/add"
        ]
    }
}

input() would be a new function that returned the values under properties. Normal dot-notation rules apply. Any functions that result in an object would be an error. secureString would resolve to plain-text.

For get and export, the tool would still be required to return JSON output and the manifest would specify something like:

"/output",
"json"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the resource manifest handling and expression evaluation entry points for set arguments. Define how input() resolves properties, how object results and secureString values are handled, and how get/export continue to require JSON output; the example manifest provides the expected behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.