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

この記事では、Azure Arc 対応サーバーに SSH 経由で接続しようとした場合に発生する可能性がある問題のトラブルシューティングと解決に関する情報を提供します。 一般的な情報については、「Azure Arc 対応サーバーへの SSH アクセス」を参照してください。

クライアント側の問題

これらの問題は、ユーザーの接続元のコンピューターで発生するエラーが原因です。

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

この問題は、接続に必要なクライアント側の 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'.

解決策:

  • --ssh-client-folder パラメーターを使用して、SSH クライアント実行可能ファイルを含むフォルダーへのパスを指定します。
  • フォルダーが Azure PowerShell の PATH 環境変数にあることを確認します

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

この問題は、インストールされている Azure PowerShell サブモジュール Az.Ssh.ArcProxy が、インストールされているバージョンの Az.Ssh でサポートされていない場合に発生します。 エラー:

  • 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 モジュールを更新する

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).

解決策:

ユーザーにプロキシを実行するアクセス許可がない

この問題は、接続に使用される 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

解決策:

  • プロキシ ファイルを実行するアクセス許可をユーザーが持っていることを確認します。

サーバー側の問題

パブリック プレビュー後に接続できない

ユーザーがパブリック プレビューに参加済みで、Arc エージェントおよび Azure CLI または PowerShell を一般公開リリースに更新した場合、接続が失敗する可能性があります。

解決策:

サーバーで 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 サービスが実行されていることを確認します。
  • ポート 22 (またはその他の既定以外のポート) の Arc 対応サーバーで機能が有効になっていることを確認します

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

解決策:

  • リソースに対する所有者ロールまたは共同作成者ロールがあることを確認するか、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.

解決策:

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

HybridConnectivity RP が登録されていない

この問題は、HybridConnectivity リソース プロバイダーがサブスクリプションに登録されていない場合に発生します。 エラー:

  • Azure Relay 情報の要求に失敗しました: (NoRegisteredProviderFound) コード: NoRegisteredProviderFound

解決策:

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

CLI ツールと Arc エージェントを更新した後に接続できない

この問題は、Arc エージェントが更新される前に、更新されたコマンドによって新しいサービス構成が作成されるときに発生します。 これは、バージョン 1.31 以降に更新する場合にのみ、1.31 より前のバージョンの Azure Arc に影響します。 エラー:

  • 不明なポート 65535 によって接続が閉じられた

    解決策:

    • 既存のサービス構成を削除し、次の接続時に CLI コマンドで再作成できるようにします。 az rest --method delete --uri https://management.azure.com/subscriptions/<SUB_ID>/resourceGroups/<RG_NAME>/providers/Microsoft.HybridCompute/machines/<VM_NAME>/providers/Microsoft.HybridConnectivity/endpoints/default/serviceconfigurations/SSH?api-version=2023-03-15 を実行します。

Arc 対応サーバーへの SSH を無効にします

この機能は、次のアクションを実行することで無効にできます。

  • Arc 対応サーバーから SSH ポートと SSH 機能を削除します: az rest --method delete --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\"}}'

  • 既定の接続エンドポイントを削除します: az rest --method delete --uri https://management.azure.com/subscriptions/<subscription>/resourceGroups/<resourcegroup>/providers/Microsoft.HybridCompute/machines/<arc enabled server name>/providers/Microsoft.HybridConnectivity/endpoints/default?api-version=2023-03-15

次のステップ