Hi DiptiRanjan Swain,
Good catch! Glad the issue is resolved for you finally. I will have this answer promoted by reposting it. As an Original Poster (You) will not be able to accept your own answer. This is in the attempt to help others looking for a solution for a similar issue.
Thanks again for sharing the solution here. Have a good day!
Issue:
For automation purpose, my requirement is through API call fetch the AKS and ARO clusters from Azure on which "Defender for Containers" is enabled. Is there such API present or any alternative?
Solution:
securityresources
| where name == "56a83a6e-c417-42ec-b567-1e6fcb3d09a9"
| extend Status = tostring(properties["status"]["code"])
| extend ResourceName = tostring(properties ["resourceDetails"]["ResourceName"])
| where Status == "Healthy"
| distinct ResourceName, Status, resourceGroup, subscriptionId