演習 - 新しい仮想マシンをテストする

完了

仮想マシンを作成すると、インターネット経由でアクセス可能なパブリック IP アドレスと、Azure データ センター内で使用されるプライベート IP アドレスが割り当てられます。 これらの値はいずれも、次のように create コマンドから返される JSON ブロックに表示されます。

{
   ...
  "privateIpAddress": "10.0.0.4",
  "publicIpAddress": "40.83.165.85",
   ...
}

SSH を使用した VM への接続

Secure Shell (ssh) ツールでパブリック IP アドレスを使用して Linux VM が稼働していることを簡単にテストできます。 ここでは、管理者名を azureuser に設定したので、この名前を指定する必要があります。 実行中のインスタンスのパブリック IP アドレスを必ず使用してください。

ssh azureuser@<public-ip-address>

Note

VM の作成の一環として SSH キー ペアを生成したので、パスワードは不要です。 初めて VM にシェルを実行すると、ホストの信頼性に関するプロンプトが表示されます。

これは、ホスト名を使用するのではなく、直接 IP アドレスにアクセスしようとしているためです。 "yes" と答えると、接続に有効なホストとして IP アドレスが保存され、接続を続行できます。

The authenticity of host '40.83.165.85 (40.83.165.85)' can't be established.
RSA key fingerprint is SHA256:hlFnTCAzgWVFiMxHK194I2ap6+5hZoj9ex8+/hoM7rE.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '40.83.165.85' (RSA) to the list of known hosts.

次に、リモート シェルが表示され、ここに Linux コマンドを入力できます。

Welcome to Ubuntu 18.04.3 LTS (GNU/Linux 5.0.0-1014-azure x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Wed Aug 21 20:32:04 UTC 2019

  System load:  0.0               Processes:           108
  Usage of /:   4.2% of 28.90GB   Users logged in:     0
  Memory usage: 9%                IP address for eth0: 10.0.0.5
  Swap usage:   0%

0 packages can be updated.
0 updates are security updates.

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

azureuser@SampleVM:~$

練習として psls などのいくつかのコマンドを試してみてください。 完了したら、exit または logout と入力して、仮想マシンからサインアウトします。