Skip to content

Instantly share code, notes, and snippets.

@pkirch
Created May 3, 2015 13:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pkirch/6220a3d43e35afbf582d to your computer and use it in GitHub Desktop.
Save pkirch/6220a3d43e35afbf582d to your computer and use it in GitHub Desktop.
# Microsoft Virtual Academy
# Automatisierte Konfiguration in Azure im Überblick
# 402 - http://aka.ms/mva-1505-402
# Settings
$subscriptionName = "MSFT MVA Live" # Get-AzureSubscription
$location = "West Europe" # Get-AzureLocation
$serviceName = "mvaconfig402"
$storageAccountName = "mvaconfig401" # Reuse storage account with already published PS configurations.
$adminUsername = "adm_demo"
$adminPassword = "Azureisttoll!"
$imageFamily = "Windows Server 2012 R2 Datacenter"
$vmName = $serviceName
$instanceSize = "Medium" # Get-AzureRoleSize
# In case you have more than one Azure subscription, select one.
Select-AzureSubscription -SubscriptionName $subscriptionName
# Get latest image for defined image family.
# MVA03-Images.ps1 / https://gist.github.com/pkirch/058d757a799fa0087241
$imageName = Get-AzureVMImage |
Where-Object -Property ImageFamily -eq $imageFamily |
Sort-Object -Property PublishedDate -Descending |
Select-Object -ExpandProperty ImageName -First 1
# Create storage account and set is as current.
#New-AzureStorageAccount -Location $location -StorageAccountName $storageAccountName -Type Standard_LRS
Set-AzureSubscription -SubscriptionName $subscriptionName -CurrentStorageAccountName $storageAccountName
# Create new VM configuration, add provisioning data to it, and start it.
New-AzureVMConfig -ImageName $imageName -InstanceSize $instanceSize -Name $vmName |
Add-AzureProvisioningConfig -Windows -AdminUsername $adminUsername -Password $adminPassword |
Add-AzureEndpoint -LocalPort 80 -Name HTTP -Protocol tcp -PublicPort 80 |
Set-AzureVMDSCExtension -ConfigurationArchive "IISInstall.ps1.zip" -ConfigurationName "IISInstall" |
Set-AzureVMDSCExtension -ConfigurationArchive "ADDSInstall.ps1.zip" -ConfigurationName "ADDSInstall" |
New-AzureVM -ServiceName $serviceName -Location $location
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment