Export All VM configuration (CPU, RAM) along with attached OS disk Size and Data disk size

Mr India 0 Reputation points
2024-09-06T03:45:38.8433333+00:00

How to export All VM configuration (CPU, RAM) along with attached OS disk Size and Data disk size, Microsoft please provide kql query for export required data.

Mail on the same!

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,018 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Prrudram-MSFT 28,201 Reputation points Moderator
    2024-09-06T10:26:30.1866667+00:00

    Hello @Mr India

    You can use the Azure Resource Graph Explorer to export VM configuration data, including CPU, RAM, OS disk size, and data disk size.

    The Azure Resource Graph Explorer allows you to run Kusto Query Language (KQL) queries against your Azure resources and export the results to a CSV file. To export VM configuration data using the Azure Resource Graph Explorer, you can follow these steps:

    1. Open the Azure Resource Graph Explorer in the Azure portal.
    2. Write a KQL query to retrieve the VM configuration data.
      Here's an example query:
    Resources | where type == 'microsoft.compute/virtualmachines' 
    | extend vmSize = tostring(properties.hardwareProfile.vmSize) 
    | extend osDiskSize = tostring(properties.storageProfile.osDisk.diskSizeGB) 
    | extend dataDiskSize = tostring(properties.storageProfile.dataDisks[0].diskSizeGB) 
    | project name, vmSize, osDiskSize, dataDiskSize 
    

    This query retrieves all virtual machines in your subscription and projects the name, VM size, OS disk size, and data disk size.

    1. Run the query and export the results to a CSV file. To export the results to a CSV file, click the "Export" button in the Azure Resource Graph Explorer and select "CSV (current view)".
    2. Open the CSV file in Excel or another spreadsheet program to view and analyze the data. I hope this helps! Let me know if you have any other questions.

    Sample queries:

    https://learn.microsoft.com/en-us/azure/virtual-machines/resource-graph-samples?tabs=azure-cli

    If I have answered your query, please click "Accept as answer" as a token of appreciation

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.