Skip to content

Instantly share code, notes, and snippets.

@goyalmohit
Created January 3, 2017 05:12
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 goyalmohit/10a9691d3e68f341ec1e914918b26c20 to your computer and use it in GitHub Desktop.
Save goyalmohit/10a9691d3e68f341ec1e914918b26c20 to your computer and use it in GitHub Desktop.
#Login into Microsoft Azure
add-azureaccount
#Create a new storage account, if not already having one
$storageAccountName = "qastoragenortheurope"
$storageAccountLocation = "north europe"
$storageAccountType = "Standard_LRS"
New-AzureStorageAccount -StorageAccountName $storageAccountName `
-Location $storageAccountLocation `
-Type $storageAccountType
#Set default storage account for current azure subscription
Set-AzureSubscription -SubscriptionId <your subscription id> `
-CurrentStorageAccountName "qastoragenortheurope"
#create quick azure vm
$adminUser = "itadmin"
$password = "itadmin@123"
$serviceName = "metavrsewebqa"
$location = "north europe"
$size = "Small"
$vmName = "metavrse-web-01"
$imageFamily = "Windows Server 2012 R2 Datacenter"
$imageName = Get-AzureVMImage |
where { $_.ImageFamily -eq $imageFamily } |
sort PublishedDate -Descending |
select -ExpandProperty ImageName -First 1
New-AzureQuickVM -Windows `
-ServiceName $serviceName `
-Name $vmName `
-ImageName $imageName `
-AdminUsername $adminUser `
-Password $password `
-InstanceSize $size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment