Hi @Igor Levin
Welcome to Microsoft Q&A! Thanks for posting the question.
It usually takes about 30 minutes for the policy to be fully effective after its assignment. During this time, the policy may not function properly (it might function partially or may not be in effect at all). Could you retest the effect after about 30 minutes of policy assignment? You may refer to this Q&A thread for a similar issue.
---
Edit: 01/17/2022
The reason for "deny" effect not working with Microsoft.Compute/virtualMachines/storageProfile.osDisk.osType
is as below:
>. This property is not added when creating the VM creation request but is auto populated after the VM has been created. You can verify absence of this property in the request in Portal by clicking on "Download a template for automation" on the "Review + create" page. Therefore, when submitting the request, the policy does not deny the VM creation, as this property is not present in the request against which the evaluation is done (create mode). After the VM has been created, during the next policy evaluation, the VM is put in non-compliance state because the property is available now. Here are more details of this behavior: Optional or auto-generated resource property that bypasses policy evaluation.
Please let me know if you have any question.
---
Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.