How to identify Ephemeral VMs in Azure

Pookat, Sanal (MBHC 21) 26 Reputation points
2021-07-26T03:56:34.553+00:00

How to identify Ephemeral VMs in Azure ? Like VMs used in ScaleSets or DataBricks or K8S pods, i want to run a set of queries on VMs but exclude these ephemeral VMs. I know about Ephemeral OS disks, are all ephemeral VMs expected to use them ?

My end goal is to create Resource graph queries like , all VMs with non-company-standard disks , All VMs with vulnerabilities etc. I don't want the results to include VMs created in a scale set, or in other managed environments like databricks

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

Accepted answer
  1. shiva patpi 13,251 Reputation points Microsoft Employee
    2021-07-26T19:11:07.02+00:00

    Hello @Pookat, Sanal (MBHC 21) ,
    Thanks for reaching out to Microsoft Q&A.
    To identify Ephemeral vs Non-Ephemeral VMs you can use the attribute called "Ephemeral Os disk".

    If the VM is ephemeral : Ephemeral OS Disk attribute value will be "OS Cache"
    If the VM is non-ephemeral: Ephemeral OS Disk attribute value will be "N/A"

    Ephemeral VM:
    117959-image.png

    Non-Ephemeral VM:
    118051-image.png

    ////////////////////////////////////////////

    Using Azure PowerShell how to differentiate Ephemeral vs Non-Ephemeral
    For Ephemeral:
    (Get-AzureRmVM -ResourceGroupName ephemeraldemo -Name ephemeralvm).StorageProfile.OsDisk.Caching
    Output: ReadOnly
    For Non-Ephemeral
    (Get-AzureRmVM -ResourceGroupName ephemeralnondemo -Name ephemeralnondemo).StorageProfile.OsDisk.Caching
    Output: ReadWrite
    For Ephemeral
    (Get-AzureRmVM -ResourceGroupName ephemeraldemo -Name ephemeralvm).StorageProfile.OsDisk.DiffDiskSettings
    Output: Local
    For Non-Ephemeral
    (Get-AzureRmVM -ResourceGroupName ephemeralnondemo -Name ephemeralnondemo ).StorageProfile.OsDisk.DiffDiskSettings
    Output: N/A

    /////////////////////////////

    Additional details:
    https://learn.microsoft.com/en-us/azure/virtual-machines/ephemeral-os-disks

    Kindly let us know if you have additional queries.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

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.