You can create a VM using Vnet with a deferent RG. You can test this using the below template.
If above is working, then it has to do something with the bicep code. You can review the json file to get an idea.
Please do not forget to "Accept the answer" wherever the information provided helps you to help others in the community.