Hi,
I would suggest to have a look at my article about Log Alerts v2. I think it will be helpful as many things are configured on the alert rule rather in the query. Overall you query could be just:
InsightsMetrics
| where Namespace == "LogicalDisk" and Name == "FreeSpacePercentage"
| extend Disk=tostring(todynamic(Tags)["vm.azm.ms/mountId"])
| extend Val = toint(Val)
After that when you create alert rule you will select Compute or _ResourceId as dimension and you will include only the VMs you want. The same for Disk - selected as dimension and include only the Disks you want to be alerted upon. For comparing threshold, you will select Val column and enter your desired threshold. When you create the alert, you will get alerted per VM per Disk for the scoped VMs and disks.
If you want to filter inside the query it is still possible but not necessary:
InsightsMetrics
| where Namespace == "LogicalDisk" and Name == "FreeSpacePercentage" and Origin == "vm.azm.ms"
| extend Disk=tostring(todynamic(Tags)["vm.azm.ms/mountId"])
| where Disk in ('C:','D:','E:')
| extend Val = toint(Val)
I strongly recommend is that when you have alert rule to not define the threshold in the query. The same for summarization in the query when Log Alert v2 is used.
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.