Azure Arc 対応サーバーへの PowerShell リモート処理

Arc 対応サーバー向けの SSH により、パブリック IP アドレスや追加のオープン ポートを必要とせずに、Arc 対応サーバーへの SSH ベースの接続が可能になります。 SSH 経由の PowerShell リモート処理は、Windows および Linux マシンで使用できます。

前提条件

Azure Arc 対応サーバーへの SSH アクセス経由で PowerShell リモート処理を利用するには、次のことを確認します。

  • Azure Arc 対応サーバーへの SSH アクセスの要件が満たされていることを確認します。
  • SSH 経由の PowerShell リモート処理の要件が満たされていることを確認します。
  • Arc マシンに接続するための Azure PowerShell モジュールまたは Azure CLI 拡張機能がクライアント コンピューターに存在しています。

PowerShell リモート処理を使って接続する方法

PowerShell リモート処理を使って Arc 対応サーバーに接続するには、以下の手順に従います。

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

SSH 構成ファイルで新しく作成されたエントリを検索する

作成または変更した SSH 構成ファイルを開きます。 エントリは次のような形式にする必要があります。

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"

-Options パラメーターの利用

options パラメーターを使うと、リモート SSH ベースのセッションに接続するときに使う SSH オプションのハッシュテーブルを指定できます。 次の形式に従ってハッシュテーブルを作成します。 引用符の位置に注意してください。

$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"'}

次に、PowerShell リモート コマンドでオプションのハッシュテーブルを利用します。

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

次のステップ