This error message appears in instances when there are some errors in the script and Azure cannot validate the script successfully.
Here are some useful links about how to create a VM from ARM template:
How to create a Linux virtual machine with Azure Resource Manager templates:
https://learn.microsoft.com/en-us/azure/virtual-machines/linux/create-ssh-secured-vm-from-template
You can find templates in Azure quickstart templates repository:
https://github.com/Azure/azure-quickstart-templates
You can start from this one and make updates as needed:
https://github.com/Azure/azure-quickstart-templates/tree/master/101-vm-simple-linux
In addition to the articles already provided above, something that can help you as starting point for your template, is the Azure Portal.
When you follow the wizard to create a VM, you have all the options to define the requirements.
Once requirements are defined in the Portal and before you create the VM, you will see the option to “Download a template for automation” in the very last TAB of the CreateVM blade.
From there, the downloaded template is pretty much ready. You will likely have to apply some minor changes so that the “az deployment sub validate” command will like it. E.g. password must for the admin account must be added; or the location has to be likely removed.
To debug the ARM template, the following document can help since it explain the template format and what is expected/supported in an ARM template itself:
https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/template-syntax