nabehiro ブログ

開発・プログラミングに関して適当に書くブログ

Azure Virtual Machine をバックアップするPowerShellスクリプトを作ってみました

Azure Virtual Machine のディスクをバックアップする PowerShellスクリプトを作ってみました。

GitHub - nabehiro/AzureVMBackup: Azure Virtual Machine Backup Power Shell Script

バックアップ方法

  1. (起動していたら)Virtual Machine を停止
  2. Virtual Machine のディスクに関連付けられている OSディスク、データディスクをバックアップディレクトリにコピーする
  3. (停止したら)Virtual Machine を起動
  4. (設定でバックアップ保持数を指定していたら)古い順にバックアップを削除

使用方法

Using Blob Snapshots to Backup Azure Virtual Machines | greatrexpectations

# Configuration
# ================================================================
$subscriptionName = "<input here>"
$cloudServiceName = "<input here>"
$virtualMachineName = "<input here>"
$remainigBackupCount = 2
  • 実行(PowerShellの権限設定を要求されるかも)

実行を継続するかの確認がはいりますので、あやまって実行しちゃっても中断できます。

利用上の注意

結構テストをして正常に動作することを確認していますが、
プラットフォームだけに問題が発生しても責任は取れません。



Windows Azure Powershell のコマンドを、C# で普通に使えるようにしてほしいなぁ。
https://github.com/WindowsAzure/azure-sdk-tools