Created
May 3, 2015 11:26
-
-
Save pkirch/3c5d985d399ed2029a08 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
# 101 | |
# Settings | |
$subscriptionName = "MSFT MVA Stage" # Get-AzureSubscription | |
$location = "West Europe" # Get-AzureLocation | |
$serviceName = "mvaconfig101" | |
$storageAccountName = $serviceName | |
$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 | | |
New-AzureVM -ServiceName $serviceName -Location $location | |
<# Output | |
OperationDescription OperationId OperationStatus | |
-------------------- ----------- --------------- | |
New-AzureStorageAccount e1349515-XXXX-9361-bec2-80773e1824ac Succeeded | |
New-AzureVM 70fc039e-XXXX-903c-bd85-6f102031da67 Succeeded | |
#> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment