This is how I deploy a VM using Azure Powershell. I am wondering how to convert it to use the classical deployment model using New-AzResource
$VirtualMachine = New-AzVMConfig -VMName $VMName -VMSize $VMSize
$VirtualMachine = Set-AzVMOperatingSystem -VM $VirtualMachine -Windows -ComputerName $ComputerName -Credential $Credential -ProvisionVMAgent -EnableAutoUpdate
$VirtualMachine = Add-AzVMNetworkInterface -VM $VirtualMachine -Id $NIC.Id
$VirtualMachine = Set-AzVMSourceImage -VM $VirtualMachine -PublisherName 'MicrosoftWindowsServer' -Offer 'WindowsServer' -Skus '2019-Datacenter' -Version latest
New-AzVM -ResourceGroupName $resourceGroupName -Location $Location -VM $VirtualMachine -Verbose -edgeZone $edgezoneName
My attempt:
New-AzResource -Location $location `
-Properties @{VM=$VirtualMachine} `
-ResourceName $VMName `
-ResourceType "Microsoft.ClassicCompute/virtualMachines" `
-ResourceGroupName $resourceGroupName `
-Force `
-Verbose
After doing research found that MICRSOFT DOCUMENTATION
and also same suggested by @Jul_DW,
As of February 28, 2020, customers who didn't utilize IaaS VMs through ASM in the month of February 2020 can no longer create VMs (classic).
So that we are no longer able to create classic vms instead of that we can use Azure Resource Manager.
For more information to create VM using PowerShell please refer this MICROSOFT DOCUMENTATION.