Skip to content

Commit af473a1

Browse files
authored
Merge pull request #271542 from maertendMSFT/master
Add document detailing how to use SSHArc with PowerShell remoting
2 parents 3127478 + 621ff0f commit af473a1

File tree

2 files changed

+59
-1
lines changed

2 files changed

+59
-1
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
title: SSH access to Azure Arc-enabled servers with PowerShell remoting
3+
description: Use PowerShell remoting over SSH to access and manage Azure Arc-enabled servers.
4+
ms.date: 04/08/2024
5+
ms.topic: conceptual
6+
ms.custom: references_regions
7+
---
8+
9+
# PowerShell remoting to Azure Arc-enabled servers
10+
SSH for Arc-enabled servers enables SSH based connections to Arc-enabled servers without requiring a public IP address or additional open ports.
11+
[PowerShell remoting over SSH](/powershell/scripting/security/remoting/ssh-remoting-in-powershell) is available for Windows and Linux machines.
12+
13+
## Prerequisites
14+
To leverage PowerShell remoting over SSH access to Azure Arc-enabled servers, ensure the following:
15+
- Ensure the requirements for SSH access to Azure Arc-enabled servers are met.
16+
- Ensure the requirements for PowerShell remoting over SSH are met.
17+
- The Azure PowerShell module or the Azure CLI extension for connecting to Arc machines is present on the client machine.
18+
19+
## How to connect via PowerShell remoting
20+
Follow the below steps to connect via PowerShell remoting to an Arc-enabled server.
21+
22+
#### [Generate a SSH config file with Azure CLI:](#tab/azure-cli)
23+
```bash
24+
az ssh config --resource-group <myRG> --name <myMachine> --local-user <localUser> --resource-type Microsoft.HybridCompute --file <SSH config file>
25+
```
26+
27+
#### [Generate a SSH config file with Azure PowerShell:](#tab/azure-powershell)
28+
```powershell
29+
Export-AzSshConfig -ResourceGroupName <myRG> -Name <myMachine> -LocalUser <localUser> -ResourceType Microsoft.HybridCompute/machines -ConfigFilePath <SSH config file>
30+
```
31+
---
32+
33+
#### Find newly created entry in the SSH config file
34+
Open the created or modified SSH config file. The entry should have a similar format to the following.
35+
```powershell
36+
Host <myRG>-<myMachine>-<localUser>
37+
HostName <myMachine>
38+
User <localUser>
39+
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"
40+
```
41+
#### Leveraging the -Options parameter
42+
Levering the [options](/powershell/module/microsoft.powershell.core/new-pssession#-options) parameter allows you to specify a hashtable of SSH options used when connecting to a remote SSH-based session.
43+
Create the hashtable by following the below format. Be mindful of the locations of quotation marks.
44+
```powershell
45+
$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"'}
46+
```
47+
Next leverage the options hashtable in a PowerShell remoting command.
48+
```powershell
49+
New-PSSession -HostName <myMachine> -UserName <localUser> -Options $options
50+
```
51+
52+
## Next steps
53+
54+
- Learn about [OpenSSH for Windows](/windows-server/administration/openssh/openssh_overview)
55+
- Learn about troubleshooting [SSH access to Azure Arc-enabled servers](ssh-arc-troubleshoot.md).
56+
- Learn about troubleshooting [agent connection issues](troubleshoot-agent-onboard.md).

articles/azure-arc/servers/toc.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@
131131
items:
132132
- name: SSH access to Azure Arc-enabled servers
133133
href: ssh-arc-overview.md
134+
- name: PowerShell remoting to Azure Arc-enabled servers
135+
href: ssh-arc-powershell-remoting.md
134136
- name: Troubleshoot SSH access to Azure Arc-enabled servers
135137
href: ssh-arc-troubleshoot.md
136138
- name: Extended Security Updates
@@ -217,4 +219,4 @@
217219
- name: Regional availability
218220
href: https://azure.microsoft.com/explore/global-infrastructure/products-by-region/?products=azure-arc&regions=all
219221
- name: Product feedback
220-
href: https://feedback.azure.com/d365community/forum/5c778dec-0625-ec11-b6e6-000d3a4f0858
222+
href: https://feedback.azure.com/d365community/forum/5c778dec-0625-ec11-b6e6-000d3a4f0858

0 commit comments

Comments
 (0)