Last active
August 29, 2015 14:20
-
-
Save pkirch/3ae9a222c06b7b30e704 to your computer and use it in GitHub Desktop.
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
# Microsoft Virtual Academy | |
# Automatisierte Konfiguration in Azure im Überblick | |
# 200 - http://aka.ms/mva-1505-200 | |
# Settings | |
$subscriptionName = "MSFT MVA Live" # Get-AzureSubscription | |
$location = "West Europe" # Get-AzureLocation | |
$serviceName = "mvaconfig200" | |
$storageAccountName = $serviceName | |
$adminUsername = "adm_demo" | |
$adminPassword = "Azureisttoll!" | |
$imageFamily = "Windows Server 2012 R2 Datacenter" | |
$vmName = $serviceName | |
$instanceSize = "Medium" # Get-AzureRoleSize | |
Select-AzureSubscription -SubscriptionName $subscriptionName | |
# Get latest image for defined image family. | |
$imageName = Get-AzureVMImage | | |
Where-Object -Property ImageFamily -eq $imageFamily | | |
Sort-Object -Property PublishedDate -Descending | | |
Select-Object -ExpandProperty ImageName -First 1 | |
# Create new VM configuration and add provisioning data to it. | |
$vmConfig1 = New-AzureVMConfig -ImageName $imageName -InstanceSize $instanceSize -Name $vmName | | |
Add-AzureProvisioningConfig -Windows -AdminUsername $adminUsername -Password $adminPassword | |
Get-AzureEndpoint -VM $vmConfig1 | |
# Add port 80 to VM configuration. | |
Add-AzureEndpoint -LocalPort 80 -Name HTTP -Protocol tcp -PublicPort 80 -VM $vmConfig | |
Get-AzureEndpoint -VM $vmConfig1 | |
# Try to remove RDP and WinRM endpoints. | |
Add-AzureProvisioningConfig -Windows -NoRDPEndpoint -NoWinRMEndpoint -VM $vmConfig | |
Get-AzureEndpoint -VM $vmConfig1 | |
# Create second VM configuration without RDP and WinRM endpoints. | |
$vmConfig2 = New-AzureVMConfig -ImageName $imageName -InstanceSize $instanceSize -Name $vmName | | |
Add-AzureProvisioningConfig -Windows -AdminUsername $adminUsername -Password $adminPassword -NoRDPEndpoint -NoWinRMEndpoint | | |
Add-AzureEndpoint -LocalPort 80 -Name HTTP -Protocol tcp -PublicPort 80 | |
Get-AzureEndpoint -VM $vmConfig2 | |
# Add default endpoints again. | |
Add-AzureProvisioningConfig -Windows -VM $vmConfig2 | |
Get-AzureEndpoint -VM $vmConfig2 | |
# New-AzureVM -ServiceName $serviceName -Location $location -VM $vmConfig1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment