Windows Azure Poweshell batch to create virtual machines
batch to create windows virtual machines 

点击(此处)折叠或打开


  1. #The subscribe ID number..
  2. $ID = "MS-85"
  3. #The Storage account
  4. $STORAGE = "portalftest148"
  5. #The Location
  6. $location = "China North"
  7. #Switch the subscribe
  8. Select-AzureSubscription -SubscriptionName $ID
  9. #Create New Storage account
  10. New-AzureStorageAccount -StorageAccountName $STORAGE -Location $location
  11. #set Azure storage account default..
  12. Set-AzureSubscription -SubscriptionName $ID -CurrentStorageAccountName $STORAGE
  13. #Set System image 
  14. $imageName = "55bc2b193643443bb879a78bda516fc8__Win2K8R2SP1-Datacenter-201403.01-zh.cn-127GB.vhd"
  15. #Create New Windows VM machine
  16. 147..148|ForEach {New-AzureVMConfig -Name ftest$_ -InstanceSize 'Small' -ImageName $imageName ` |
  17. Add-AzureProvisioningConfig –Windows –AdminUsername ‘testadmin’ -Password 'Passw0rd' ` |
  18. Add-AzureEndpoint -Name "Http" -Protocol "tcp" -PublicPort 80 -LocalPort 80 
  19. Add-AzureEndpoint -Name "Ftp" -Protocol "tcp" -PublicPort 21 -LocalPort 21 |
  20. New-AzureVM -ServiceName ftest$_}

batch to create linux virtual machines 

点击(此处)折叠或打开

  1. #The subscribe ID number..
  2. $ID = "MS-85"
  3. #The Storage account
  4. $STORAGE = "portalftest148"
  5. #The Location
  6. $location = "China North"
  7. #Switch the subscribe
  8. Select-AzureSubscription -SubscriptionName $ID
  9. #Create New Storage account
  10. New-AzureStorageAccount -StorageAccountName $STORAGE -Location $location
  11. #set Azure storage account default..
  12. Set-AzureSubscription -SubscriptionName $ID -CurrentStorageAccountName $STORAGE
  13. #Set System image
  14. $imageName = "55bc2b193643443bb879a78bda516fc8__Win2K8R2SP1-Datacenter-201403.01-zh.cn-127GB.vhd"
  15. #Create New Windows VM machine
  16. 147..148|ForEach {New-AzureVMConfig -Name ftest_ -InstanceSize $VMSIZE -ImageName $imageName ` |
  17. Add-AzureProvisioningConfig -Linux LinuxUser ‘testadmin’ -Password 'Passw0rd' ` |
  18. Add-AzureEndpoint -Name "Http" -Protocol "tcp" -PublicPort 80 -LocalPort 80 |
  19. Add-AzureEndpoint -Name "Ftp" -Protocol "tcp" -PublicPort 21 -LocalPort 21 |
  20. New-AzureVM -ServiceName ftest$_ -Location 'China North'}




10-04 03:41