LoginSignup
0
1

More than 5 years have passed since last update.

PowerShellでGet-AzureRmVMのオプション「-status」について

Posted at

AzurePowerShellについて

AWSやAzureなどのパブリッククラウドは従来のオンプレミスやVPSと違い、
ポータル画面でインフラのコンフィグをかなり操作できますが、
やはりコマンドラインからの操作のほうがスケールを考えると効率的です。
特にAzureの場合はMicrosoftの製品群というだけあってPowerShellでの実行が推奨されています。
そのPowerShellでの拡張機能を別途インストール行いますが、そのモジュールをAzurePowerShellと呼びます。

Get-AzureRmVMのオプションについて

話を一気に展開しますが、Get-AzureRmVMに -status を加えるかどうかで出力の内容がかなり変わってきます。
AzureAutomationでVMサイズを自動的に変更するRunbookを作成する過程で気づきました。

  1. -status 有り

OSやVMagentや拡張機能の調子を確認したいときに-statusオプションをつけるようです。

ResourceGroupName          : 
Name                       : 
BootDiagnostics            :
  ConsoleScreenshotBlobUri : -93fdc6308d0f/RCalc.d0df67b4-b769-48ec-bad4-93fdc6308d0f.screenshot.bmp
  SerialConsoleLogBlobUri  : -93fdc6308d0f/RCalc.d0df67b4-b769-48ec-bad4-93fdc6308d0f.serialconsole.log
Disks[0]                   :
  Name                     : 
  Statuses[0]              :
    Code                   : 
    Level                  : 
    DisplayStatus          : 
    Time                   : 
Extensions[0]              :
  Name                     : 
  Type                     : 
  TypeHandlerVersion       : 
  Statuses[0]              :
    Code                   : 
    Level                  : 
    DisplayStatus          : 
    Message                :
Extensions[1]              :
  Name                     : 
  Type                     : 
  TypeHandlerVersion       : 
  Statuses[0]              :
    Code                   : 
    Level                  : 
    DisplayStatus          : 
    Message                : 
VMAgent                    :
  VmAgentVersion           : 
  ExtensionHandlers[0]     :
    Type                   : 
    TypeHandlerVersion     : 
    Status                 :
      Code                 : 
      Level                : 
      DisplayStatus        : 
      Message              : 
  ExtensionHandlers[1]     :
    Type                   : 
    TypeHandlerVersion     : 
    Status                 :
      Code                 : 
      Level                : 
      DisplayStatus        : 
      Message              : 
  Statuses[0]              :
    Code                   : 
    Level                  : 
    DisplayStatus          : 
    Message                : 
    Time                   : 
Statuses[0]                :
  Code                     : 
  Level                    : 
  DisplayStatus            : 
  Time                     : 
Statuses[1]                :
  Code                     : 
  Level                    : 
  DisplayStatus            :
  1. -status 無し

VMのディスク情報やマシンサイズを把握する場合はこちらのオプションは不要ということです。


RequestId                         :
StatusCode                        :
ResourceGroupName                 :
Id                                :
Name                              :
Type                              :
Location                          :
Tags                              :
DiagnosticsProfile                :
  BootDiagnostics                 :
    Enabled                       :
    StorageUri                    :
Extensions[0]                     :
  Id                              :
ttings
Extensions[1]                     :
  Id                              :
HardwareProfile                   :
  VmSize                          :
NetworkProfile                    :
  NetworkInterfaces[0]            :
    Id                            :
OSProfile                         :
  ComputerName                    :
  AdminUsername                   :
  LinuxConfiguration              :
    DisablePasswordAuthentication :
ProvisioningState                 :
StorageProfile                    :
  ImageReference                  :
    Publisher                     :
    Offer                         :
    Sku                           :
    Version                       :
  OsDisk                          :
    OsType                        :
    Name                          :
    Caching                       :
    CreateOption                  :
    DiskSizeGB                    :
NetworkInterfaceIDs[0]            :

-statusがある状態で、マシンサイズを取得しようとしても
オブジェクトにそれっぽいものが含まれていないので調べてみたらこんなところでした。
普通わざわざ入れないので多くの方は問題ないかと思うのですが一応書いておきます

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1