Prompts for ServiceName, also securely
passes Admin/Pass to Add-AzureProvisioningConfig
Creates 10 Servers hostname: Thing#
<#
.NOTES
Author:
Drew Robinson
Last
Updated: 9/2/2014
#>
# Change color to yellow, prompt human for Servicename, reset color back to default
[console]::ForegroundColor = "yellow"
$Servicename = Read-Host -Prompt "Please Enter Servicename
for this deployment: (servicename is the internet
facing name, [name].cloudapp.net)"
[console]::ResetColor()
# Get Credentials (secure)
$Cred=Get-Credential -Message
"Please Enter the Administrator Username and
Password for the VMs, note: you can't use Admin/Administrator, password must
be complex"
# Get-VM Images and filter Windows Server
2012 R2
$VMImages=Get-AzureVMImage |Where-Object {($_.PublisherName -ilike "Microsoft*" -and
$_.ImageFamily -ilike 'Windows Server
2012 R2 Datacenter') }
# 1..10 = array of of
10 things, $_ = put array # here
1..10 |ForEach {$VMName = "thing$_"
New-AzureVMConfig -Name $VMName -InstanceSize "ExtraSmall" -ImageName $vmimages[1].ImageName |Add-AzureProvisioningConfig
-Windows -AdminUsername $cred.UserName -Password
$Cred.GetNetworkCredential().password -TimeZone "Central
Standard Time" -Verbose |Add-AzureDataDisk -CreateNew -DiskSizeInGB '15'
-DiskLabel "disk 1" -LUN
'0' |New-AzureVM -location 'South
Central US' -servicename
$Servicename -Verbose
}
|
No comments:
Post a Comment