You can do it with Azure Policy:
- https://video2.skills-academy.com/en-us/azure/governance/policy/overview
- https://video2.skills-academy.com/en-us/azure/governance/policy/tutorials/create-custom-policy-definition
I recommend you to look at this learning path: