I'm looking to spin up VMs using the node/Javascript SDK for Azure. So far I've had luck with my code and it pretty much works as expected. However I would like to spin up generation 2 / HyperV v2 VMs instead of the default v1. Here's a snippet of my code:
return new Promise((resolve, reject) => {
let resourceClient = new ComputeManagementClient(credentials, azureSubscriptionID);
resourceClient.virtualMachines.createOrUpdate(reourceGroup, name, {
location: location,
osProfile: { computerName: name, adminUsername: 'admin', adminPassword: adminPassword, customData: Buffer.from(prepScript).toString('base64') },
hardwareProfile: { vmSize: 'Standard_B2s' },
HyperVGeneration: 'V2',
storageProfile: {
imageReference: { publisher: 'Canonical', offer: 'UbuntuServer', sku: '18.04-LTS', version: 'latest' },
osDisk: { name: name + '-disk', createOption: 'FromImage' }
},
networkProfile: {
networkInterfaces: [{ id: nic.id, primary: true }]
}
}, function (err, result) {
if (err) {
reject(err);
} else {
resolve(result);
}
});
}
The problem I'm having is with:
HyperVGeneration: 'V2'
as it seems to not even apply. Nor do I get any errors, just a V1 VM is created. The Azure Docs are kind of lacking here: https://learn.microsoft.com/en-us/javascript/api/@azure/arm-compute/hypervgeneration?view=azure-node-latest I've also tried the other parameters such as HyperVGenerationType / Types with the same result.