summary import { VirtualMachine , ComputeManagementClient } from "@msinternal/compute-resource-manager" ; import { DefaultAzureCredential } from "@azure/identity" ; async function createAVMWithApplicationProfile ( ) { const subscriptionId = "{subscription-id}" ; const resourceGroupName = "myResourceGroup" ; const vmName = "myVM" ; const parameters = { applicationProfile : { galleryApplications : [ { configurationReference : "https://mystorageaccount.blob.core.windows.net/configurations/settings.config" , order : 1 , packageReferenceId : "/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdb/resourceGroups/myresourceGroupName2/providers/Microsoft.Compute/galleries/myGallery1/applications/MyApplication1/versions/1.0" , tags : "myTag1" } , { packageReferenceId : "/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1" } ] } , 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 : "{image_offer}" , publisher : "{image_publisher}" , sku : "{image_sku}" , 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 ) ; } createAVMWithApplicationProfile ( ) . catch ( console . error ) ;