次の方法で共有


Azure Arc 対応サーバーへの SSH アクセスのトラブルシューティング

Arc 対応サーバーの SSH を使用すると、パブリック IP アドレスや追加のオープン ポートを必要とせずに、Arc 対応サーバーへの SSH ベースの接続が可能になります。 この記事では、SSH 経由で Azure Arc 対応サーバーに接続しようとしたときに発生する可能性がある問題のトラブルシューティングに役立つ情報を提供します。

クライアント側の問題

このセクションの情報を使用して、接続しているコンピューターで発生したエラーによって発生する問題を解決します。

クライアント バイナリが見つからない

この問題は、接続に必要なクライアント側の SSH バイナリが見つからない場合に発生します。 この問題に関連するエラー メッセージは次のとおりです。

  • Failed to create ssh key file with error: \<ERROR\>.
  • Failed to run ssh command with error: \<ERROR\>.
  • Failed to get certificate info with error: \<ERROR\>.
  • Failed to create ssh key file with error: [WinError 2] The system cannot find the file specified.
  • Failed to create ssh key file with error: [Errno 2] No such file or directory: 'ssh-keygen'.

この問題を解決するには、次の手順を実行します。

Azure PowerShell モジュール バージョンの不一致

インストールされているバージョンの Az.Ssh が、インストールされている Azure PowerShell モジュール Az.Ssh.ArcProxy をサポートしていない場合は、次のエラーが表示されます。

  • This version of Az.Ssh only supports version 1.x.x of the Az.Ssh.ArcProxy PowerShell Module. The Az.Ssh.ArcProxy module {ModulePath} version is {ModuleVersion}, and it is not supported by this version of the Az.Ssh module. Check that this version of Az.Ssh is the latest available.

この問題を解決するには、次のコマンドを実行して、Az.Ssh モジュールと Az.Ssh.ArcProxy モジュールを最新バージョンに更新します。

Update-Module -Name Az.Ssh
Update-Module -Name Az.Ssh.ArcProxy

Az.Ssh.ArcProxy がインストールされていない

Az.Ssh.ArcProxy モジュールがクライアント コンピューターにインストールされていない場合は、次のエラーが表示されます。

  • Failed to find the PowerShell module Az.Ssh.ArcProxy installed in this machine. You must have the Az.Ssh.Proxy PowerShell module installed in the client machine in order to connect to Azure Arc resources. You can find the module in the PowerShell Gallery (see: https://aka.ms/PowerShellGallery-Az.Ssh.ArcProxy).

このエラーを解決するには、 PowerShell ギャラリーからモジュールをインストールします。 Install-Module -Name Az.Ssh.ArcProxy

プロキシを実行するためのアクセス許可が不十分

接続に使用される SSH プロキシを実行するアクセス許可がないアカウントの場合、次のエラーが表示されることがあります。

  • /bin/bash: line 1: exec: /usr/local/share/powershell/Modules/Az.Ssh.ArcProxy/1.0.0/sshProxy_linux_amd64_1.3.022941: cannot execute: Permission denied
  • CreateProcessW failed error:5 posix_spawnp: Input/output error

この問題を解決するには、管理マシンで SSH プロキシを実行するアクセス許可がユーザー アカウントにあることを確認します。

サーバー側の問題

このセクションの情報は、接続先の Arc 対応サーバーでエラーが発生した場合に発生する問題の解決に役立ちます。

サーバーで SSH トラフィックが許可されない

この問題は、SSHD がサーバー上で実行されていない場合、または SSH トラフィックがサーバーで許可されていない場合に発生します。 この場合、次のエラーが表示されることがあります。

  • {"level":"fatal","msg":"sshproxy: error copying information from the connection: read tcp 192.168.1.180:60887-\u003e40.122.115.96:443: wsarecv: An existing connection was forcibly closed by the remote host.","time":"2022-02-24T13:50:40-05:00"}
  • {"level":"fatal","msg":"sshproxy: error connecting to the address: 503 connection to localhost:22 failed: dial tcp [::1]:22: connectex: No connection could be made because the target machine actively refused it.. websocket: bad handshake","proxyVersion":"1.3.022941"}
  • SSH connection is not enabled in the target port {Port}.

この問題を解決するには、次の手順を実行します。

  • Arc 対応サーバーで SSHD サービスが実行されていることを確認します。
  • 次のコマンドを実行して、Arc 対応サーバーのポート 22 (またはその他の既定以外のポート) で機能が有効になっていることを確認します。
az rest --method put --uri https://management.azure.com/subscriptions/<subscription>/resourceGroups/<resourcegroup>/providers/Microsoft.HybridCompute/machines/<arc enabled server name>/providers/Microsoft.HybridConnectivity/endpoints/default/serviceconfigurations/SSH?api-version=2023-03-15 --body '{\"properties\": {\"serviceName\": \"SSH\", \"port\": 22}}'

Azure のアクセス許可の問題

この情報は、アクセス許可が不十分な場合に発生する問題の解決に役立ちます。

SSH 接続を有効にするためのロールの割り当てが正しくない

ターゲット リソースに貢献するための適切なロールの割り当てがない場合は、次のエラーが表示されます。

  • Client is not authorized to create a Default connectivity endpoint for {Name} in the Resource Group {ResourceGroupName}. This is a one-time operation that must be performed by an account with Owner or Contributor role to allow connections to target resource

このエラーを解決するには、Arc 対応サーバーに所有者ロールまたは共同作成者ロールがあることを確認するか、これらのロールの 1 つを持つユーザーに SSH 接続を設定するよう依頼します。

接続するロールの割り当てが正しくない

この問題は、ターゲット リソースに適切なロールの割り当てがない場合、特に read アクセス許可がない場合に発生します。 次のエラーが表示される場合があります。

  • Unable to determine the target machine type as Azure VM or Arc Server
  • Unable to determine that the target machine is an Arc Server
  • Unable to determine that the target machine is an Azure VM
  • Permission denied (publickey).
  • Request for Azure Relay Information Failed: (AuthorizationFailed) The client '\<user name\>' with object id '\<ID\>' does not have authorization to perform action 'Microsoft.HybridConnectivity/endpoints/listCredentials/action' over scope '/subscriptions/\<Subscription ID\>/resourceGroups/\<Resource Group\>/providers/Microsoft.HybridCompute/machines/\<Machine Name\>/providers/Microsoft.HybridConnectivity/endpoints/default' or the scope is invalid. If access was recently granted, please refresh your credentials.

この問題を解決するには、接続先の Arc 対応サーバーに仮想マシン ローカル ユーザー ログイン ロールがあることを確認します。 Microsoft Entra ログインを使用する場合は、仮想マシン ユーザー ログインロールまたは仮想マシン管理者ログイン ロールがあり、Microsoft Entra SSH ログイン拡張機能が Arc-Enabled サーバーにインストールされていることを確認します。

HybridConnectivity RP が登録されていない

HybridConnectivity リソース プロバイダーがサブスクリプションに登録されていない場合は、次のエラーが表示されることがあります。

  • Request for Azure Relay Information Failed: (NoRegisteredProviderFound) Code: NoRegisteredProviderFound

この問題を解決するには、サブスクリプションの HybridConnectivity リソース プロバイダーを登録します。

  • az provider register -n Microsoft.HybridConnectivity を実行します。
  • az provider show -n Microsoft.HybridConnectivityを実行して成功を確認し、registrationStateRegistered に設定されていることを確認します。
  • Arc 対応サーバーでハイブリッド エージェントを再起動します。

次のステップ