Created
October 27, 2014 22:35
-
-
Save andreaswasita/c2f729f6e7d3dc209d10 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Windows Server 2012 Datacenter image | |
$images = Get-AzureVMImage ` | |
| where { $_.ImageFamily -eq “Windows Server 2012 R2 Datacenter” } ` | |
| Sort-Object -Descending -Property PublishedDate | |
$latestImage = $images[0] | |
$latestImage | |
$myimage = Read-Host -Prompt 'Azure Image Name:' | |
$service = Read-Host -Prompt 'Azure Service Name:' | |
$name = Read-Host -Prompt 'Azure VM Name:' | |
$instance = Read-Host -Prompt 'Instance Size:' | |
$username = Read-Host -Prompt 'Admin User Name:' | |
$password = Read-Host -Prompt 'Password:' | |
$location = Read-Host -Prompt 'Azure Location:' | |
$AS = Read-Host -Prompt 'Availability Set Name:' | |
$VNET = Read-Host -Prompt 'VNET Name:' | |
$domusername = Read-Host -Prompt 'Domain User Name:' | |
$dompassword = Read-Host -Prompt 'Domain Password:' | |
$domain = Read-Host -Prompt 'Domain Name:' | |
$joindomain = Read-Host -Prompt 'DOmain FQDN:' | |
$subnet = Read-Host -Prompt 'Subnet:' | |
$myVM = New-AzureVMConfig -Name $name -InstanceSize $instance -ImageName $myimage -DiskLabel "OS" -AvailabilitySetName $AS |Add-AzureProvisioningConfig -WindowsDomain -AdminUsername $username -Password $password -DomainUserName $domusername -Domain $domain -DomainPassword $dompassword -JoinDomain $joindomain -DisableAutomaticUpdates | | |
Set-AzureSubnet $subnet | |
New-AzureVM -ServiceName $service -VMs $myVM -Location $location -VNetName $VNET -Verbose |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment