Skip to content

Enable passing JSON input properties as args to resource #1475

@SteveL-MSFT

Description

@SteveL-MSFT

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"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions