-
Notifications
You must be signed in to change notification settings - Fork 34
Add credential support on PowerShell adapters #758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implementation seems to use the following snippet to determine whether to convert the input to a credential:
$_.Name -like '*Credential*' -and
$_.Value.Username -and
$_.Value.Password
However, I think we should probably consider checking the target property for whether it's expecting a credential or a secure string and then trigger handling.
If so, should we still check if the username/password is provided in such a way? |
Just rewrote the part, but I'm struggling a little with the following error message from the pipeline: Exception calling "Invoke" with "4" argument(s): "The 'ConvertTo-SecureString' command was found in the module The test I wrote earlier for Windows PowerShell seems to fail on this part. I have commented it out for now. I have seen this issue before with other modules that run under the agent and wasn't able to find a workaround for it. Any suggestions are welcome. |
@SteveL-MSFT or @michaeltlombardi Do you perhaps have time to take another stab at this PR? The logic has changed to validate against the target property that is passed in. |
PR Summary
This PR addresses #328. It adds a like check for credentials and searches the username and password fields as input.
PR Context
PowerShell adapters currently don't support creating PSCredential objects. Most DSC community-based DSC resources have the $Credential as input. Some others may vary; that's why the
-Like
operator is used.