An Azure Automation account doesn't deploy into a VNet and doesn't have any VNet dependencies - so you should be able to use it to target any Azure VMs (regardless of their location/VNet they are connected to).
That aside, considering that Azure Automation State Configuration has a retirement date set (September 30, 2027), rather than troubleshooting your existing setup, you might want to consider using Azure Machine Configuration instead. More at https://learn.microsoft.com/en-us/azure/governance/machine-configuration/overview
If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.
hth
Marcin