azureazure-virtual-machine

Can you find out if an Azure VM SKU has a temp disk, from the SKU?


I want to be able to find out if a particular SKU has a temp disk attached or not. I have tried using PowerShell and the Get-AzComputeResourceSku command, to list the capabilities, but there doesn't appear to be a property for it.

Same for the Resource SKU API - https://learn.microsoft.com/en-us/rest/api/compute/resource-skus/list?tabs=HTTP. (The PS command looks to use this API by the output)

I want to use the information in a Bicep deploy to decide on the layout of tempdb for a SQL Server on Azure VM deployment.

This seems such an obvious property to want to expose? Anyone achieved this?


Solution

  • You can check the temp disk information for a VM SKU with MaxResourceVolumeMB. The MaxResourceVolumeMB value provides information about the local temp disk size.

    Here is the PowerShell script to find the local temp disk information for all SKUs from specific locations.

    $location = "EastUS" 
    $vmskus = Get-AzComputeResourceSku | Where-Object { $_.Locations -contains $location -and $_.ResourceType -eq "virtualMachines" }
    
    $vmSkuinfo = @()
    
    foreach ($sku in $vmSkus) {
    
        $tempDiskCapability = $sku.Capabilities | Where-Object { $_.Name -eq "MaxResourceVolumeMB" }
    
        if ($tempDiskCapability) {
        
            $maxResourceVolumeMB = [int]$tempDiskCapability.Value
            $maxResourceVolumeGB = [math]::Round($maxResourceVolumeMB / 1024, 2)
            
            $osDiskCapability = $sku.Capabilities | Where-Object { $_.Name -eq "OSVhdSizeMB" }
    
            if ($osDiskCapability) {
            
                $osVhdSizeMB = [int]$osDiskCapability.Value
                $osVhdSizeGB = [math]::Round($osVhdSizeMB / 1024, 2)
            } else {
                $osVhdSizeMB = 0
                $osVhdSizeGB = 0
            }
    
            $vmSkuinfo += [pscustomobject]@{
                'VM SKU Name'          = $sku.Name
                'Location'             = $location
                'Local Temp Disk (MB)'  = $maxResourceVolumeMB
                'Local Temp Disk (GB)'  = $maxResourceVolumeGB
                'OS Disk Size (MB)'     = $osVhdSizeMB
                'OS Disk Size (GB)'     = $osVhdSizeGB
            }
        }
    }
    
    $CSVPath = "/home/venkatv/VM_SKU_DiskSizes.CSV"
    
    $vmSkuinfo | Export-CSV -Path $CSVPath -AutoSize
    
    Write-Output "Data exported to $CSVPath"
    
    

    Output:

    enter image description here

    Here is the information on the local temp disk and OS disk for specific SKUs.

    enter image description here

    Reference: Azure VM sizes with no local temporary disk