Your technology certification is waiting. Enroll in Cloud Class ®
$localcred = Get-Credential -Message "Type the name and password of the local administrator account."
$vmName = "test-SQL"
$location = "westus"
$rgName = "RG1" #name of your Resource Group
# Configure the OS disk
$OSdiskName = "OSDisk"
# $storageAcc is a retrieved or created Storage Account
$osDiskUri = $storageAcc.PrimaryEndpoints.Blob.ToString() + "vhds/" + $vmName + $OSdiskName + ".vhd"
# Configure VM info
$compName = $vmName
# choose a PublisherName from
# Get-AzureRmVMImagePublisher -Location $location
$pubName = "MicrosoftSQLServer"
# choose an Offer from
# Get-AzureRmVMImageOffer -Location $location -PublisherName $pubName
$offerName = "SQL2014SP1-WS2012R2"
# choose a SKU from
# Get-AzureRmVMImageSku -Location $location -PublisherName $pubName -Offer $offerName
$skuName = "Standard"
New-AzureRmVMConfig -VMName $vmName -VMSize "Standard_A1" |
Set-AzureRmVMOSDisk -Name $OSdiskName -VhdUri $osDiskUri -CreateOption FromImage |
Set-AzureRmVMOperatingSystem -Windows -ComputerName $compName -Credential $localcred -ProvisionVMAgent -TimeZone "Pacific Standard Time" |
Set-AzureRmVMSourceImage -PublisherName $pubName -Offer $offerName -Skus $skuName -Version "latest" |
Add-AzureRmVMNetworkInterface -Id $nic.Id |
New-AzureRmVM -ResourceGroupName $rgName -Location $location
# I haven't shown the creation of a NIC referenced by line 31
# also would probably want to change the VM size on line 27
# and add another disk to the config
Open in new window
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
WatchGuard DNSWatch reduces malware infections by detecting and blocking malicious DNS requests, improving your ability to protect employees from phishing attacks. Learn more about our newest service included in Total Security Suite today!