Hi @sns
You can achieve this by 2 method
1) Apply an azure policy name : Refer Screen shot.

2) Search Defender on top search bar of azure portal - in left pane - Workload protection / Security Posture - Make sure your VM added in these .
-----------If this was helpful please accept as answer ------
