Have an Azure SQL machine with Premium SSD v2 with NVME . I am unable to determine which drive is which.

MCarr 0 Reputation points
2026-07-13T16:48:41.5833333+00:00

I have an Azure Imaged SQL machine that has a number of drives. I need to just increase one of the Data Disks that does not have enough space for the new database. All the PowerShell I have tried are not able to determine which Azure External Lun is the one i need to increase. All of the PowerShell return SCSIBus & SCSITargetId of Zero. This is preventing us from adding another database to the server.

Single Drive PowerShell

$driveLetter = "F"   # change to your drive letter
$partition = Get-Partition | Where-Object { $_.DriveLetter -eq $driveLetter }
$disk = Get-Disk -Number $partition.DiskNumber

# SCSITargetId on the disk's location corresponds to the LUN Azure assigned
$diskDrive = Get-WmiObject Win32_DiskDrive | Where-Object { $_.Index -eq $disk.Number }

[PSCustomObject]@{
    DriveLetter   = $driveLetter
    DiskNumber    = $disk.Number
    FriendlyName  = $disk.FriendlyName
    SerialNumber  = $disk.SerialNumber
    SCSIBus       = $diskDrive.SCSIBus
    SCSITargetId  = $diskDrive.SCSITargetId   # <-- this is the Azure LUN
    SCSILogicalUnit = $diskDrive.SCSILogicalUnit
}

Just looking at all the drive

SQL Server on Azure Virtual Machines

2 answers

Sort by: Oldest
  1. Ravi Kiran Pagidi 170 Reputation points
    2026-07-14T02:46:04.3266667+00:00

    Hi,

    Because this VM is using NVMe, the SCSI Bus/Target values showing as 0 is expected and is not the best field to use.

    For Azure remote NVMe disks on Windows, use SCSILogicalUnit. Microsoft documentation notes that for NVMe disks, the guest SCSILogicalUnit value is the Azure portal LUN value plus 1.

    So the mapping is:

    Azure LUN = SCSILogicalUnit - 1
    

    You can try this from inside the VM:

    $driveLetter = "F"
    
    $partition = Get-Partition | Where-Object DriveLetter -eq $driveLetter
    $guestDisk = Get-Disk -Number $partition.DiskNumber
    $wmiDisk = Get-CimInstance Win32_DiskDrive | Where-Object { $_.Index -eq $guestDisk.Number }
    
    [PSCustomObject]@{
        DriveLetter      = $driveLetter
        WindowsDiskNo    = $guestDisk.Number
        Model            = $wmiDisk.Model
        SerialNumber     = $wmiDisk.SerialNumber
        SCSILogicalUnit  = $wmiDisk.SCSILogicalUnit
        AzureLun         = $wmiDisk.SCSILogicalUnit - 1
    }
    

    Then from Azure PowerShell, match that LUN to the attached managed disk:

    $vm = Get-AzVM -ResourceGroupName "<rg-name>" -Name "<vm-name>"
    
    $vm.StorageProfile.DataDisks |
        Select-Object Name, Lun, DiskSizeGB, @{n="ManagedDiskId";e={$_.ManagedDisk.Id}} |
        Sort-Object Lun
    

    After you identify the correct Azure disk, take a snapshot/backup first, then increase that managed disk size in Azure. After resizing, rescan disks in Windows Disk Management and extend the partition/volume for the drive letter.

    If this drive is part of Storage Spaces or a spanned volume, do not resize based only on the drive letter. In that case, map the physical disks in the storage pool first, because one Windows volume may be backed by multiple Azure data disks.

    Was this answer helpful?

    0 comments No comments

  2. Christos Panagiotidis 3,551 Reputation points
    2026-07-14T08:05:17.0966667+00:00

    Hi, the zero SCSI values are expected on an NVMe-controller VM, so do not use SCSITargetId to choose the Azure disk. Map it using the NVMe namespace/serial information exposed by Windows and compare that with the managed disk properties in Azure. Before resizing, build a table of drive letter -> Windows disk number -> disk unique/serial identifier -> Azure managed-disk name/ID, and verify it twice. Take a database-aware backup/snapshot first. After increasing the managed disk size in Azure, rescan disks in Windows, extend the correct partition/volume, and confirm SQL Server sees the new space. Never resize based only on the order shown in Disk Management, because enumeration order can change after reboot.

    Was this answer helpful?

    0 comments No comments

Your answer

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