Windows Azure Poweshell batch to create virtual machines
batch to create windows virtual machines 点击(此处)折叠或打开
- #The subscribe ID number..
- $ID = "MS-85"
- #The Storage account
- $STORAGE = "portalftest148"
- #The Location
- $location = "China North"
- #Switch the subscribe
- Select-AzureSubscription -SubscriptionName $ID
- #Create New Storage account
- New-AzureStorageAccount -StorageAccountName $STORAGE -Location $location
- #set Azure storage account default..
- Set-AzureSubscription -SubscriptionName $ID -CurrentStorageAccountName $STORAGE
- #Set System image
- $imageName = "55bc2b193643443bb879a78bda516fc8__Win2K8R2SP1-Datacenter-201403.01-zh.cn-127GB.vhd"
- #Create New Windows VM machine
- 147..148|ForEach {New-AzureVMConfig -Name ftest$_ -InstanceSize 'Small' -ImageName $imageName ` |
- Add-AzureProvisioningConfig –Windows –AdminUsername ‘testadmin’ -Password 'Passw0rd' ` |
- Add-AzureEndpoint -Name "Http" -Protocol "tcp" -PublicPort 80 -LocalPort 80
- Add-AzureEndpoint -Name "Ftp" -Protocol "tcp" -PublicPort 21 -LocalPort 21 |
- New-AzureVM -ServiceName ftest$_}
batch to create linux virtual machines
点击(此处)折叠或打开
- #The subscribe ID number..
- $ID = "MS-85"
- #The Storage account
- $STORAGE = "portalftest148"
- #The Location
- $location = "China North"
- #Switch the subscribe
- Select-AzureSubscription -SubscriptionName $ID
- #Create New Storage account
- New-AzureStorageAccount -StorageAccountName $STORAGE -Location $location
- #set Azure storage account default..
- Set-AzureSubscription -SubscriptionName $ID -CurrentStorageAccountName $STORAGE
- #Set System image
- $imageName = "55bc2b193643443bb879a78bda516fc8__Win2K8R2SP1-Datacenter-201403.01-zh.cn-127GB.vhd"
- #Create New Windows VM machine
- 147..148|ForEach {New-AzureVMConfig -Name ftest_ -InstanceSize $VMSIZE -ImageName $imageName ` |
- Add-AzureProvisioningConfig -Linux LinuxUser ‘testadmin’ -Password 'Passw0rd' ` |
- Add-AzureEndpoint -Name "Http" -Protocol "tcp" -PublicPort 80 -LocalPort 80 |
- Add-AzureEndpoint -Name "Ftp" -Protocol "tcp" -PublicPort 21 -LocalPort 21 |
- New-AzureVM -ServiceName ftest$_ -Location 'China North'}