I am new the KQL on Azure resource graph explorer kql queries, I have a requirement to get the SQLVM with associated disk. I wrote this query and getting below error.
Any help is highly appreciated.
Query:
resources | where type == "microsoft.sqlvirtualmachine/sqlvirtualmachines" | project id, vmid=properties.virtualMachineResourceId, name, img=properties.sqlImageOffer, sqlImgOffered=properties.sqlImageSku, sqlLicense=properties.sqlServerLicenseType | join (resources | where type == "microsoft.compute/disks" | project managedBy, diskSizeGB=properties.diskSizeGB, tier=properties.tier, diskIOPSRW=properties.diskIOPSReadWrite, diskMBpsReadWrite=properties.diskMBpsReadWrite, diskState=properties.diskState) on $left.vmid == $right.managedBy
Output:
Details:
Query is invalid. Please refer to the documentation for the Azure Resource Graph service and fix the error before retrying. (Code:InvalidQuery) join key 'vmid' is of a 'dynamic' type. Please use an explicit cast using extend operator in the join legs (for example, '... | extend vmid = tostring(vmid) | join (... | extend vmid = tostring(vmid)) on vmid') as join on a 'dynamic' type is not supported. (Code:Default)
Please help in solving this error.