Hi Vamsi,
I had to use a different method to solve this. I re-created the user assigned managed identity in the original resource group, made it owner of the resource group the template was in and then I was able to delete the template. Thanks for your support!
Kind regards,
Robin