Monday, July 14, 2014

Creating multiple VMs in WAP - Tenant Public API

I received a question this morning if it was possible to create many VMs at once using the tenant public API for Azure Pack.

The short answer is: yes.

If you want to know how to expose and configure the tenant public API in Azure Pack, then you can read a blog post, I wrote a couple of weeks ago:

Here’s the cmdlets for creating 5 virtual machines as a tenant, using the tenant public API in Azure Pack with PowerShell ISE:

### Import the PublishSettingsFile you have downloaded from the tenant portal

Import-WAPackPublishSettingsFile "C:\mvp.publishsettings"

### Get your VM Template and store it in a variable

$template = Get-WAPackVMTemplate -Name "GEN1 Template"

### Get your Virtual Network and store it in a variable

$vnet = Get-WAPackVNet -Name "LabNetwork"

### Get the credentials required for the local admin account for your VMs

$creds = Get-Credential

### Define an array. We will create 5 VMs in this example

$vms =@(1..5)

Foreach ($VM in $VMs)


$VM = "wapvm"+$VM

New-WAPackVM -Name $vm -Template $template -VMCredential $creds -VNet $vnet -Windows


Once the cmdlet has completed, you should have 5 virtual machines in the tenant portal, like wapvm1, wapvm2, wapvm3 and so on.

No comments: