To do that you will have to balance server memory (RAM) on the Azure VM between MariaDb, SQL Server and the operating system. To achieve that you will have to perform an assessment of what are the memory needs of each database, then limit MariaDB and SQL Server memory usage and leave the operating system with enough RAM to operate. Probably you will be adding some tools and software that have their own software requirements also and that you need to take in consideration.
Another part of the hardware sizing you need to do is the IOPs required by database, the backup storage, and how to distribute CPU cores between the 2 database instances. This hardware sizing is time consuming, and the first weeks after you install both database engines on the same server, you will need to monitor and make adjustments to the limits you established as needed.
My suggestion is to put them on PaaS (Azure SQL), take the benefit of automated backups, automatic tuning, each database has its own memory, it is an easier migration plan with less complicated hardware sizing and easier administration post-migration.