AzureVM (IaaS): Create SQLServer 2014 (CTP2) AzureVM via script with DataDisk etc.
Hallo @all,
der SQL Server 2014 steht vor der Tür und da braucht man für die eine oder andere Demo ein schnell aufgebautes Image. Händisches Installieren war gestern, ich verwendet seit geraumer Zeit die Variante. (angepaßt für das SQL 2014 CTP2 Image)
$adminuser = "Patrick"
$adminPassword = "..."
#$domainPassword = "..."
$newVmName = "SQL2014CTP2"
$storageAccount = "phstoragenortheu" # -> "https://phstoragenortheu.blob.core.windows.net/"
$cloudService = "phnortheuvms" # -> DNS: "phnortheuvms.cloudapp.net"
$affinityGroup = "NorthEUAG" # -> My AffinityGroup named by DataCenter location
$location = "North Europe" # DataCenter
# prerequisits
# 1. default / current storage account has been set:
# Set-AzureSubscription -SubscriptionName "Windows Azure MSDN - Visual Studio Ultimate" -CurrentStorageAccountName "phstoragenortheu"
# 2. AffinityGroup exist
#New-AzureAffinityGroup -Name $affinityGroup -Location $location
# 3. StorageAccount exist
#New-AzureStorageAccount -StorageAccountName $storageAccount -Label $storageAccount -AffinityGroup $affinityGroup
#Set-AzureStorageAccount -StorageAccountName $storageAccount -GeoReplicationEnabled $False
# for my AzureVMs i do not need Geo-Replication -> i use locally redundant Storage
# Get-AzureVMImage | select ImageName
# Select VM-Image: SQL2014 CTP2
$myVmImage = Get-AzureVMImage -ImageName "fb83b3509582419d99629ce476bcb5c8__SQL-Server-2014CTP2-CU1-12.0.1736.0-Evaluation-ENU-WS2012R2-CY13SU12"
# Build VM configuration for Azure
$myVM = New-AzureVMConfig -Name $newVmName -InstanceSize Large -ImageName $myVmImage.ImageName -DiskLabel ($newVmName+"-OSDisk") -MediaLocation ("https://"+$storageAccount+".blob.core.windows.net/vhds/"+$newVmName+"-OSDisk.vhd").ToString() |
Add-AzureProvisioningConfig -Windows -AdminUsername $adminuser -Password $adminPassword -DisableAutomaticUpdates |
Add-AzureDataDisk -CreateNew -DiskSizeInGB 100 -DiskLabel ($newVmName+"-DataDisk1") -LUN 0 -MediaLocation ("https://"+$storageAccount+".blob.core.windows.net/vhds/"+$newVmName+"-DataDisk1.vhd")
# new CloudService
# New-AzureVM –ServiceName $cloudService –VMs $myVM -AffinityGroup $affinityGroup
# add VM to existing CloudService
New-AzureVM –ServiceName $cloudService –VMs $myVM
Viel Spaß damit.
Patrick