この記事の PowerShell スクリプトでは、複数の Azure Elastic SAN ボリュームをバッチとして簡単に作成できます。 スクリプトを使用するには、事前に入力された値を含む .csv ファイルを作成して、さまざまなサイズのボリュームを必要な数作成します。
ResourceGroupName、ElasticSanName、VolumeGroupName、Name、SizeGiB の 5 つの列を使用して、.csv ファイルの書式を設定します。 次のスクリーンショットは例を示しています。
次に、次のスクリプトを使用してボリュームを作成します。
$filePath = "D:\ElasticSan\TestCsv3.csv"
$BatchCreationList = Import-Csv -Path $filePath
foreach($creationParam in $BatchCreationList) {
# -AsJob can be added to make the operations parallel
# -ErrorAction can be added to change the behavior of the for loop when an error occurs
New-AzElasticSanVolume -ElasticSanName $creationParam.ElasticSanName -GroupName $creationParam.VolumeGroupName -Name $creationParam.Name -ResourceGroupName $creationParam.ResourceGroupName -SizeGiB $creationParam.SizeGiB #-ErrorAction Continue #-AsJob
}