In my case, it was because I was using AzureResourceManagerTemplateDeployment@3 without specifying the deployment scope. It is set to Resource Group by default and when I set it to Subscription, issue solved.