Is ADO Pipeline "Powershell on target machine" able to connect to destination server using customize PSsessionconfiguration?

Tze Chun Ooi 85 Reputation points
2023-03-23T05:25:10.68+00:00

To restrict the WinRM, we usually disable all default endpoint to connect remotely with Local\Network Deny permission for each endpoint.

For who wish to use WinRM, we always create customize sessionconfiguration for specify account to connect.

However, I cannot find a way for ADO Pipeline to connect with "Powershell on target machine v3" to use custom pssessionconfiguration because no parameter to accept as below, I only can find PSsessionoption which do not have parameter name as "configurationname" to point the customize sessionconfiguration in WinRM connection.

Example:

Enter-pssession -computername <XXXXX> - configurationname <XXXXXXX>

Please advise if anyone has some idea on this.

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,121 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 43,931 Reputation points
    2023-03-23T16:19:04.7633333+00:00

    Hello there,

    The Set-PSSessionConfiguration cmdlet changes the properties of the session configurations on the local computer and not on the ADO

    PowerShell context expects the user name to be the fully qualified name (domain\username or machine_name\username).

    Once you use the fully qualified name format, you can able to successfully connect to the remote machine via PowerShell from the pipelines.

    Use this task to execute PowerShell scripts on remote machines using PSSession and Invoke-Command for remoting. PowerShellOnTargetMachines@3 - PowerShell on target machines v3 task https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/powershell-on-target-machines-v3?view=azure-pipelines

    Hope this resolves your Query !!

    --If the reply is helpful, please Upvote and Accept it as an answer–