Created
December 23, 2014 23:21
-
-
Save techbunny/3900c85a1cbd53b8ee4c to your computer and use it in GitHub Desktop.
The Imperfect Lab: Deploying VMs
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
# Set Your Subscription and Storage Account | |
Set-AzureSubscription -SubscriptionName "Visual Studio Ultimate with MSDN" -CurrentStorageAccount "imperfectstore" | |
# Set basic variables for your VM. In this case, this is the adminstrator name and password, as well as the name of the Windows Server 2012 R2 image available at the time of this exercise. You'll want to make sure to get the current name of whatever OS you want to install. | |
$un = "adminname" | |
$pwd = "secretpassword" | |
$image = "a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-201411.01-en.us-127GB.vhd" | |
# Pick up that VM image the full list with: | |
Get-AzureVMImage | Select ImageName | |
# Configure a few more variables using the New-AzureVMConfig. In this case, I'm settting the server name and instance size, pulling in the username and password variable I set with the lines above and specifying the pre-existing subnet I want to use. | |
$newVM = New-AzureVMConfig -Name "Server2" -InstanceSize "Small" -Image $image | |
| Add-AzureProvisioningConfig -Windows -AdminUserName $un -Password $pwd | |
| Set-AzureSubnet -SubnetNames "FirstSubnet" | |
# Finally, kick off the VM creation with one of the following options: | |
# Into an Existing Cloud Service: | |
New-AzureVM -VMs $newVM -ServiceName "imperfectcore" | |
# Into an New Cloud Service: | |
New-AzureVM -VMs $newVM -ServiceName "newcloudservice" -Location "West US" -VNetName "imperfectnet" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment