Skip to content

PowerShell adapter doesn't support [System.Security.SecureString] #1207

@Gijsreyn

Description

@Gijsreyn

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.

Summary

In certain scenarios, I do not require a full credential object to be passed. Instead, I'm declaring a class-based DSC resource property as such:

[DscProperty()]
[SecureString] $Token

However, trying to execute this through the adapter fails with the error:

2025-10-24T08:37:49.229612Z ERROR dsc_lib::dscresources::command_resource: 961: PID 68772: Exception: Exception setting "Token": "Cannot convert the value of type "System.String" to type "System.Security.SecureString"."

Steps to reproduce

Create a class-based DSC resource with a [SecureString] property and try to execute it.

Expected behavior

The class gets instantiated with the property as `[SecureString]`.

Actual behavior

Error is thrown.

Error details

Environment data

Name                           Value
----                           -----
PSVersion                      7.5.3
PSEdition                      Core
GitCommitId                    7.5.3
OS                             Microsoft Windows 10.0.26100
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Version

dsc 3.2.0-preview.6

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions