Last active
August 29, 2015 14:04
-
-
Save andreaswasita/84bb3133bc7b915bc352 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cls | |
Import-module Azure | |
$subscription = Read-Host -Prompt 'Microsoft Azure Subscription:' | |
$storage = Read-Host -Prompt 'Storage Account Name:' | |
Set-azuresubscription -SubscriptionName $subscription -CurrentStorageAccountName $storage | |
#Get the latest image ; Windows Server 2012 Datacenter or mykloud2012datacenterimage | |
$images = Get-AzureVMImage ` | |
| where { $_.Label -like "Windows Server 2012 Datacenter" } ` | |
| Sort-Object -Descending -Property PublishedDate | |
$latestImage = $images[0] | |
$latestImage | |
#image | |
$myimage = Read-Host -Prompt 'Azure Image Name:' | |
#cloudservice | |
$service = Read-Host -Prompt 'Azure Service Name:' | |
#vmname | |
$name = Read-Host -Prompt 'Azure VM Name:' | |
#instance size: ExtraSmall, Small, Medium, Large, ExtraLarge, A5, A6, A7, A8, A9 | |
$instance = Read-Host -Prompt 'Instance Size:' | |
#admin | |
$username = Read-Host -Prompt 'Admin User Name:' | |
#password | |
$password = Read-Host -Prompt 'Password:' | |
#location | |
$location = Read-Host -Prompt 'Azure Location:' | |
#vm configuration | |
$myVM = New-AzureVMConfig -Name $name -InstanceSize $instance -ImageName $myimage -DiskLabel "OS" ` | |
| Add-AzureProvisioningConfig -Windows -Password $password -AdminUsername $username -DisableAutomaticUpdates | |
#createVM | |
New-AzureVM -ServiceName $service -VMs $myVM -Location $location |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment