ごった煮

色々な事を書いてます

Azure PowerShellで便利なコマンドをちょこっと紹介

前回, AzurePowerShellのことを紹介しましたが今回は, PowerShellを使ううえで便利なコマンドを並べてみます.

ポータルを開く

Azureポータルを直接開くコマンドです.

[shell] Show-AzurePortal [/shell]

Azure上に展開しているサービスを取得

[shell] Get-AzureService [/shell]

仮想マシン一覧を取得

[shell] Get-AzureVM [/shell]

仮想マシンを再起動する

[shell] Restart-AzureVM -ServiceName "仮想マシン名" -Name "過疎マシン名" [/shell]

or

[shell] Get-AzureVM -ServiceName "仮想マシン名" -Name "仮想マシン名" | Restart-AzureVM [/shell]

ちなみに, コマンドの最後に Formatを指定すると表示結果の体裁が切り替わります.

Formatは,

  • Format-Wide
  • Format-Table
  • Format-List
  • Format-Custom

があります.

基本的には, Format-Custom以外を使うかと思います.

[shell] コマンド | Format-Table [/shell] のような形でコマンドにパイプでFormatをつなげる形で使用します.