Share via


Créer plusieurs volumes SAN élastiques dans un lot

Pour simplifier la création de plusieurs volumes en tant que lot, vous pouvez utiliser un .csv avec des valeurs préremplies pour créer autant de volumes de différentes tailles que vous le souhaitez.

Mettez en forme votre .csv avec cinq colonnes, ResourceGroupName, ElasticSanName, VolumeGroupName, Name et SizeGiB. La capture d’écran suivante fournit un exemple :

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

Vous pouvez ensuite utiliser le script suivant pour créer vos 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 

}