Yes, it is possible but if it is a licensed edition of SQL Server then you may need to pay for the licensing once installed.
If this is a new VM then it would be easier to create a VM from an image that has SQL Server pre-installed and configured for licensing - https://learn.microsoft.com/en-us/azure/azure-sql/virtual-machines/windows/sql-vm-create-portal-quickstart
If you want to install SQL Server yourself then I would recommend to register the VM with the SQL IaaS extension. This will give you more management options including the option to pay for the SQL licensing on a per-minute basis if this is required.