Edit

Share via


PowerShell remoting to Azure Arc-enabled servers

PowerShell remoting over SSH can be used to enable SSH connectivity on Arc-enabled servers.

Prerequisites

To use PowerShell remoting over SSH access to Azure Arc-enabled servers, you must:

Connect via PowerShell remoting

Complete the following steps to connect via PowerShell remoting to an Arc-enabled server.

Generate the SSH config file

az ssh config --resource-group <myRG> --name <myMachine> --local-user <localUser> --resource-type Microsoft.HybridCompute --file <SSH config file>

Find the newly created entry in the SSH config file

Open the created or modified SSH config file. The entry should have a similar format to the following sample file:

Host <myRG>-<myMachine>-<localUser>
    HostName <myMachine>
    User <localUser>
    ProxyCommand "<path to proxy>\.clientsshproxy\sshProxy_windows_amd64_1_3_022941.exe" -r "<path to relay info>\az_ssh_config\<myRG>-<myMachine>\<myRG>-<myMachine>-relay_info"

Use the -Options parameter

Using the -Options parameter allows you to specify a hashtable of SSH options used when connecting to a remote SSH-based session.

Create the hashtable using the format of the following sample. Be mindful of the locations of quotation marks.

$options = @{ProxyCommand = '"<path to proxy>\.clientsshproxy\sshProxy_windows_amd64_1_3_022941.exe -r <path to relay info>\az_ssh_config\<myRG>-<myMachine>\<myRG>-<myMachine>-relay_info"'}

Next, use the -Options hashtable in a PowerShell remoting command:

New-PSSession -HostName <myMachine> -UserName <localUser> -Options $options

Next steps