summary import { VirtualMachine , ComputeManagementClient } from "@msinternal/compute-resource-manager" ; import { DefaultAzureCredential } from "@azure/identity" ; async function createAVMWithPasswordAuthentication ( ) { const subscriptionId = "{subscription-id}" ; const resourceGroupName = "myResourceGroup" ; const vmName = "myVM" ; const parameters = { hardwareProfile : { vmSize : "Standard_D1_v2" } , location : "westus" , networkProfile : { networkInterfaces : [ { id : "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}" , primary : true } ] } , osProfile : { adminPassword : "{your-password}" , adminUsername : "{your-username}" , computerName : "myVM" } , storageProfile : { imageReference : { offer : "WindowsServer" , publisher : "MicrosoftWindowsServer" , sku : "2016-Datacenter" , version : "latest" } , osDisk : { name : "myVMosdisk" , caching : "ReadWrite" , createOption : "FromImage" , managedDisk : { storageAccountType : "Standard_LRS" } } } } ; const credential = new DefaultAzureCredential ( ) ; const client = new ComputeManagementClient ( credential , subscriptionId ) ; const result = await client . virtualMachines . beginCreateOrUpdateAndWait ( resourceGroupName , vmName , parameters ) ; console . log ( result ) ; } createAVMWithPasswordAuthentication ( ) . catch ( console . error ) ;