Meerdere elastische SAN-volumes maken in een batch
Om het maken van meerdere volumes als batch te vereenvoudigen, kunt u een .csv met vooraf ingevulde waarden gebruiken om zoveel volumes met verschillende grootten te maken als u wilt.
Maak uw .csv op met vijf kolommen, ResourceGroupName, ElasticSanName, VolumeGroupName, Name en SizeGiB. In de volgende schermopname ziet u een voorbeeld:
Vervolgens kunt u het volgende script gebruiken om uw volumes te maken.
$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
}