It's not possible to mix the Az and AzureRM module as fa as I know in the same PowerShell script.
For that reason I would add and use the Az modules only.
Get-AzVM is part of the Az.Compute module and this module is related to the Az.Account module you need to authenticate.
In your Automation Account verify the modules:
If the Az.Account and Az.Compute modules are missing you can add these 2 modules via Module Gallery to your Automation Account.
If this is done you are able to use the cmdlets of both modules in your PowerShell Runbook.
Just import the modules at the beginning of your script:
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)