Επεξεργασία

Κοινή χρήση μέσω


Create multiple elastic SAN volumes in a batch

To simplify creating multiple volumes as a batch, you can use a .csv with pre-filled values to create as many volumes of varying sizes as you like.

Format your .csv with five columns, ResourceGroupName, ElasticSanName, VolumeGroupName, Name, and SizeGiB. The following screenshot provides an example:

Screenshot of an example csv file, with example column names and values.

Then you can use the following script to create your volumes.

$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 

}