Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ members = [
"resources/WindowsUpdate",
"resources/windows_service",
"resources/windows_firewall",
"resources/secret_store",
"tools/dsctest",
"tools/test_group_resource",
"grammars/tree-sitter-dscexpression",
Expand Down Expand Up @@ -53,6 +54,7 @@ default-members = [
"resources/WindowsUpdate",
"resources/windows_service",
"resources/windows_firewall",
"resources/secret_store",
"tools/dsctest",
"tools/test_group_resource",
"grammars/tree-sitter-dscexpression",
Expand Down Expand Up @@ -84,6 +86,7 @@ Windows = [
"resources/WindowsUpdate",
"resources/windows_service",
"resources/windows_firewall",
"resources/secret_store",
"tools/dsctest",
"tools/test_group_resource",
"grammars/tree-sitter-dscexpression",
Expand Down
18 changes: 18 additions & 0 deletions resources/secret_store/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "secret_store"
version = "0.1.0"
edition = "2024"

[package.metadata.i18n]
available-locales = ["en-us"]
default-locale = "en-us"
load-path = "locales"

[[bin]]
name = "secret_store"
path = "src/main.rs"

[dependencies]
rust-i18n = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
27 changes: 27 additions & 0 deletions resources/secret_store/locales/en-us.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
_version = 1

[main]
missingOperation = "Missing operation. Usage: secret_store <get|set|test|export> <vault-config|secret> [--input <json>]"
unknownOperation = "Unknown operation: '%{operation}'. Expected: get, set, test, or export"
unknownResourceType = "Unknown resource type: '%{resource_type}'. Expected: vault-config or secret"
missingArguments = "Missing required arguments. Expected: secret_store <operation> <resource-type>"
missingInput = "Missing --input argument"
missingInputValue = "Missing value for --input argument"
invalidJson = "Invalid JSON input: %{error}"
windowsOnly = "This resource is only supported on Windows"
stdinReadError = "Failed to read from stdin: %{error}"

[vault_config]
pwshNotFound = "PowerShell (pwsh) not found. Ensure PowerShell 7+ is installed and on the PATH."
moduleNotInstalled = "Required PowerShell module '%{module}' is not installed. Install it with: Install-Module -Name %{module} -Force"
getConfigFailed = "Failed to get SecretStore configuration: %{error}"
setConfigFailed = "Failed to set SecretStore configuration: %{error}"
unlockFailed = "Failed to unlock SecretStore: %{error}"
registerVaultFailed = "Failed to register SecretStore vault: %{error}"

[secret]
nameRequired = "'name' is required"
getFailed = "Failed to get secret '%{name}': %{error}"
setFailed = "Failed to set secret '%{name}': %{error}"
removeFailed = "Failed to remove secret '%{name}': %{error}"
exportFailed = "Failed to export secrets: %{error}"
101 changes: 101 additions & 0 deletions resources/secret_store/secretstoresecret.dsc.resource.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"$schema": "https://aka.ms/dsc/schemas/v3/bundled/resource/manifest.json",
"description": "Manage individual secrets in the Microsoft.PowerShell.SecretStore vault, including creating, updating, removing, and exporting secrets.",
"tags": [
"windows",
"secretstore",
"secretmanagement",
"secret",
"credential"
],
"type": "Microsoft.Windows/SecretStoreSecret",
"version": "0.1.0",
"get": {
"executable": "secret_store",
"args": [
"get",
"secret"
],
"input": "stdin"
},
"set": {
"executable": "secret_store",
"args": [
"set",
"secret"
],
"input": "stdin",
"implementsPretest": false,
"return": "state"
},
"export": {
"executable": "secret_store",
"args": [
"export",
"secret"
],
"input": "stdin"
},
"exitCodes": {
"0": "Success",
"1": "Invalid arguments",
"2": "Invalid input",
"3": "Operation error"
},
"schema": {
"embedded": {
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/resources/Microsoft.Windows/SecretStoreSecret/v0.1.0/schema.json",
"title": "SecretStore Secret",
"description": "Manages individual secrets in the Microsoft.PowerShell.SecretStore vault on Windows. Supports creating, updating, removing, and exporting secrets with optional metadata.",
"type": "object",
"required": [
"name"
],
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"title": "Secret name",
"description": "The name of the secret. Required for get and set operations. For export, this is optional and wildcards (*) are supported."
},
Comment on lines +50 to +61
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The embedded schema marks name as required, but the schema description says name is optional for export (wildcards supported) and the implementation also supports export with no input. Having required: ["name"] can cause schema-based validation to reject valid export scenarios (e.g. an empty filter object). Consider removing the top-level required constraint and enforcing name at runtime only for get/set operations (as the code already does).

Copilot uses AI. Check for mistakes.
"secretType": {
"type": "string",
"title": "Secret type",
"description": "The type of the secret. Read-only; returned by get and export operations.",
"enum": [
"String",
"SecureString",
"ByteArray",
"PSCredential",
"Hashtable"
],
"readOnly": true
},
"value": {
"type": "string",
"title": "Secret value",
"description": "The value to set for the secret. Used only during set operations. Never returned by get or export."
},
"vaultName": {
"type": "string",
"title": "Vault name",
"description": "The name of the vault to use. Defaults to the SecretStore default vault if not specified."
},
"metadata": {
"type": "object",
"title": "Metadata",
"description": "Key-value metadata associated with the secret.",
"additionalProperties": {
"type": "string"
}
},
"_exist": {
"type": "boolean",
"title": "Exists",
"description": "Indicates whether the secret exists or should exist. Set to false to remove a secret."
}
}
}
}
}
106 changes: 106 additions & 0 deletions resources/secret_store/secretstorevaultconfig.dsc.resource.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"$schema": "https://aka.ms/dsc/schemas/v3/bundled/resource/manifest.json",
"description": "Manage the Microsoft.PowerShell.SecretStore vault configuration, including module installation, vault registration, authentication, password timeout, and interaction settings.",
"tags": [
"windows",
"secretstore",
"secretmanagement",
"vault",
"configuration"
],
"type": "Microsoft.Windows/SecretStoreVaultConfig",
"version": "0.1.0",
"get": {
"executable": "secret_store",
"args": [
"get",
"vault-config"
],
"input": "stdin"
},
"set": {
"executable": "secret_store",
"args": [
"set",
"vault-config"
],
"input": "stdin",
"implementsPretest": false,
"return": "state"
},
"test": {
"executable": "secret_store",
"args": [
"test",
"vault-config"
],
"input": "stdin"
},
"exitCodes": {
"0": "Success",
"1": "Invalid arguments",
"2": "Invalid input",
"3": "Operation error"
},
"schema": {
"embedded": {
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/resources/Microsoft.Windows/SecretStoreVaultConfig/v0.1.0/schema.json",
"title": "SecretStore Vault Configuration",
"description": "Manages the Microsoft.PowerShell.SecretStore vault configuration on Windows. Ensures modules are installed, vault is registered, and configuration (authentication, password timeout, interaction) matches desired state.",
"type": "object",
"additionalProperties": false,
"properties": {
"authentication": {
"type": "string",
"title": "Authentication type",
"description": "The authentication type for the SecretStore vault. 'Password' requires a password to unlock the vault. 'None' allows passwordless access.",
"enum": [
"None",
"Password"
],
"default": "Password"
},
"passwordTimeout": {
"type": "integer",
"title": "Password timeout (seconds)",
"description": "The number of seconds the vault remains unlocked after a password is provided. After this period, the vault is automatically locked. Set to -1 for no timeout.",
"default": 900
},
"interaction": {
"type": "string",
"title": "Interaction preference",
"description": "Controls whether the SecretStore prompts the user. 'Prompt' allows interactive prompts. 'None' suppresses all prompts (required for automation/DSC).",
"enum": [
"Prompt",
"None"
],
"default": "None"
},
"secretManagementInstalled": {
"type": "boolean",
"title": "SecretManagement module installed",
"description": "Indicates whether the Microsoft.PowerShell.SecretManagement module is installed. Read-only; returned by get operations.",
"readOnly": true
},
"secretStoreInstalled": {
"type": "boolean",
"title": "SecretStore module installed",
"description": "Indicates whether the Microsoft.PowerShell.SecretStore module is installed. Read-only; returned by get operations.",
"readOnly": true
},
"vaultRegistered": {
"type": "boolean",
"title": "Vault registered",
"description": "Indicates whether the SecretStore vault is registered with SecretManagement. Read-only; returned by get operations.",
"readOnly": true
},
"_exist": {
"type": "boolean",
"title": "Exists",
"description": "Indicates whether the SecretStore configuration exists on the system (modules installed and configured)."
}
}
}
}
}
Loading
Loading