Hi @NehaBameta-3476,
As mentioned by @Maxim Sergeev , the recommended or new unified service for the managing and governing updates for all the machines is Update Management Center. If you need to query the Azure Resource Graph periodically then you may run Azure Resource Graph queries in an Azure Logic App as explained here.
If you are looking for a manual way to pull patching data from a VM via a PowerShell script then come up with general PowerShell script to get patch details and once run it inside the VM manually to check if it pulls required data or not and then have that PowerShell script as an Azure Automation runbook and remotely execute it in the required VM as explained here / here and then forward runbook logs to log analytics workspace as explained here.