Az vm show --name <vm-name> --resource-group <resource-group> --query "storageProfile.dataDisks[].{name:name,lun:lun,caching:caching,disk:managedDisk.id}" --output tableLUN
A LUN, or logical unit number, identifies a data disk attachment on an Azure virtual machine. Azure records the LUN with each attached data disk so the VM, operating system, automation, and operators can distinguish disks and keep mount or application mappings consistent.
Source: Microsoft Learn - Azure managed disks overview Reviewed 2026-05-16
- Exam trap
- Assuming the disk name, drive letter, and LUN are the same thing.
- Production check
- Show the VM storage profile and verify every data disk has the expected LUN.
Article details and learning context
- Aliases
- disk LUN, logical unit number
- Difficulty
- intermediate
- CLI mappings
- 4
- Last verified
- 2026-05-16
Understand the concept
In plain English
A LUN is the numbered slot Azure uses for a data disk attached to a virtual machine. When you attach several managed disks to one VM, each disk needs a LUN so Azure and the guest operating system can tell them apart. The number is not the disk name and it is not a filesystem label. It is attachment metadata. Operators care about LUNs when mapping disks to mount points, troubleshooting missing volumes, expanding storage, restoring a VM, or moving workloads that expect a specific disk order.
Why it matters
LUNs matter because disk order mistakes can become application outages. Databases, SAP systems, file services, and line-of-business applications often expect data, logs, temp files, or backup volumes to appear in known locations. If a restored or migrated VM attaches disks with different LUNs, the operating system may mount the wrong volume or fail to mount it at all. Clear LUN documentation helps teams rebuild VMs, validate backup restores, automate disk attachments, and avoid guessing during incidents. It also separates Azure attachment state from guest filesystem state, which makes troubleshooting faster and safer. That context supports safer operational decisions. Keep mappings documented.
Technical context
Technically, a LUN lives in the VM storage profile for each data disk attachment. Azure records the disk resource ID, caching mode, create option, and logical unit number. The valid range depends on the VM size and the number of supported data disks. The operating system may expose the disk through device names, drive letters, UUIDs, or mount points, so teams should not rely only on discovery order. CLI and ARM output show the authoritative Azure-side LUN mapping, while guest tools confirm how the OS mounted the disk.
Exam context
Compare with
Where it is used
Where you see it
- In VM storage profile output, each data disk has a LUN that identifies its attachment slot beside disk name, caching mode, and resource ID during release review, incident triage, and ownership checks.
- In guest operating system checks, administrators map Azure LUNs to drive letters, mount points, UUIDs, or device paths before changing application storage during release review, incident triage, and ownership checks.
- During backup restore or migration, LUN values appear when teams must recreate disk order so databases and applications find expected volumes while operators compare evidence against the approved runbook.
Common situations
- Show VM data disk attachments and list each disk name, LUN, caching mode, and resource ID.
- Attach a managed disk to a specific LUN during controlled maintenance or recovery.
- Compare Azure disk mapping with guest operating system mount points before restarting an application.
Illustrative Azure scenarios
These examples show how the concept can affect design and operations. They are illustrative scenarios, not customer claims.
Scenario 01 Alpine Clinic lun implementation Scenario, objectives, solution, measured impact, and takeaway.
Alpine Clinic, a healthcare organization, needed to restore a database VM after a failed patch without mixing data, log, and backup disks. The team wanted a practical design that operators could support after handoff.
- Make LUN a documented governance checkpoint for production change reviews
- Reduce audit evidence collection from days to same-day review
- Standardize ownership tags, approval records, and exception handling
- Give platform reviewers clear proof before the rollout was approved
The cloud architecture group treated LUN as a governed design decision instead of a background configuration detail. They mapped the term to the correct subscription, workspace, storage, or application boundary, then connected it to RBAC, tagging, policy notes, and deployment records. Preserve LUN mapping from backup evidence before attaching restored managed disks. Engineers captured Azure CLI inventory before the change, compared it with the approved design, and stored the evidence beside the change ticket. They also wrote a short exception process so future teams could tell when the setting was intentionally selected, when it was temporary, and who had authority to change it.
- Restored the database 42 minutes faster
- Audit evidence collection dropped from two business days to under one hour
- Unapproved configuration drift findings fell by 38% in the next review cycle
- The production change board approved the rollout without emergency rework
A LUN is most useful when it turns an Azure setting into a clear governance decision with evidence, owners, and reviewable intent.
Scenario 02 Meridian Trading lun implementation Scenario, objectives, solution, measured impact, and takeaway.
Meridian Trading, a capital markets organization, needed to migrate risk-analysis VMs while keeping application volumes mounted in the expected order. The team wanted a practical design that operators could support after handoff.
- Use LUN to make production troubleshooting faster and less dependent on tribal knowledge
- Cut incident triage time by at least 35% during release or recovery events
- Give support teams repeatable checks they could run without project engineers
- Improve handoff quality between architecture, operations, and security teams
The operations team built a runbook around LUN and tied it to the alerts, logs, deployment steps, and resource views operators already used. They documented normal state, failure symptoms, and the safe commands for inspecting configuration without making destructive changes. Script disk attachment by LUN and compare guest mount points before startup. During the rollout, engineers rehearsed the checks in a nonproduction subscription, added examples of healthy output, and defined when to escalate to networking, identity, storage, or machine-learning owners. This made the concept practical for on-call staff rather than leaving it as architecture-only language.
- Avoided a planned weekend outage
- Average triage time for related incidents improved by 43%
- First-line support resolved 27% more tickets without escalation
- Post-change reviews found fewer missing screenshots and unclear approvals
LUN gives real operational value when teams connect it to runbooks, expected output, alerts, and escalation paths.
Scenario 03 BlueRiver Foods lun implementation Scenario, objectives, solution, measured impact, and takeaway.
BlueRiver Foods, a manufacturing organization, needed to standardize SAP application server disk maps after inconsistent manual portal changes. The team wanted a practical design that operators could support after handoff.
- Apply LUN to balance cost, performance, and reliability before scaling the workload
- Reduce avoidable monthly spend while preserving required service behavior
- Create measurable success criteria for latency, availability, or delivery time
- Make future optimization decisions visible to finance and engineering owners
The platform team used LUN during a design tradeoff review that included application owners, FinOps, security, and site reliability engineers. They compared the existing configuration with workload demand, recovery expectations, and expected growth. Document LUN-to-purpose mappings and enforce them in rebuild automation. Instead of approving a one-time fix, they converted the decision into reusable deployment guidance with tags, dashboards, and CLI checks. Cost owners received the pricing assumptions, operators received health and rollback steps, and developers received guardrails so future releases would not quietly undo the optimized design.
- Reduced disk-related incident tickets by 58%
- Monthly waste or rework tied to the design area dropped by 29%
- Performance or delivery targets were met for three consecutive reporting periods
- Engineering and finance teams agreed on a shared measurement baseline
LUN helps teams make better Azure tradeoffs when the decision is measured across cost, performance, reliability, and ownership.
Azure CLI
Azure CLI is useful for LUN work because the authoritative attachment mapping lives in VM resource configuration. CLI output shows data disks, LUNs, caching, and managed disk IDs in one repeatable evidence set.
Useful for
- Show VM data disk attachments and list each disk name, LUN, caching mode, and resource ID.
- Attach a managed disk to a specific LUN during controlled maintenance or recovery.
- Compare Azure disk mapping with guest operating system mount points before restarting an application.
- Export disk attachment evidence for backup tests, migration planning, or audit records.
Before you run a command
- Confirm the VM, resource group, subscription, disk name, and whether the disk is already attached elsewhere.
- Check the application runbook so you know which LUN maps to data, logs, temp files, or backups.
- Understand that attaching, detaching, or changing disks can disrupt applications and may require downtime.
- Capture the current VM storage profile before making any disk attachment change.
What the output tells you
- VM show output lists dataDisks with LUN, name, managedDisk ID, caching, and create option.
- Disk show output identifies the disk SKU, size, zone, encryption, and managedBy VM reference.
- Attach command output confirms that Azure accepted the requested LUN and linked disk resource.
- A mismatch between Azure LUNs and guest mount points indicates operating system configuration drift.
Mapped commands
LUN CLI operations
DirectAz disk show --name <disk-name> --resource-group <resource-group>Az vm disk attach --vm-name <vm-name> --resource-group <resource-group> --name <disk-name> --lun <lun-number>Az vm disk detach --vm-name <vm-name> --resource-group <resource-group> --name <disk-name>Architecture context
Technically, a LUN lives in the VM storage profile for each data disk attachment. Azure records the disk resource ID, caching mode, create option, and logical unit number. The valid range depends on the VM size and the number of supported data disks. The operating system may expose the disk through device names, drive letters, UUIDs, or mount points, so teams should not rely only on discovery order. CLI and ARM output show the authoritative Azure-side LUN mapping, while guest tools confirm how the OS mounted the disk.
- Security
- Security is indirect but important. A LUN does not grant access by itself; Azure RBAC, disk encryption, VM identity, network controls, and guest permissions control who can manage or read data. The risk comes from confusion. If operators attach the wrong disk to a VM, mount a sensitive volume in the wrong environment, or expose a recovered disk to a broader admin group, data leakage can follow. Use least-privilege permissions for disk attach operations, encrypt disks, tag sensitive volumes, and document LUN-to-purpose mappings. Treat disk attachment changes as privileged infrastructure actions, not routine housekeeping. That context supports safer operational decisions.
- Cost
- Cost impact is indirect. LUNs do not have a price, but the disks attached at those LUNs do. Confused disk mappings can leave expensive premium disks attached but unused, duplicate restored disks after incidents, or attach the wrong performance tier to the wrong workload. FinOps reviews should match each disk resource to a VM, LUN, owner, size, SKU, and business purpose. A clean LUN inventory helps teams find orphaned disks, oversized volumes, and stale recovery copies. The number is small, but it helps connect monthly disk spend to the workload that actually uses the capacity. That context supports safer operational decisions.
- Reliability
- Reliability depends on keeping disk mappings stable through resize, restore, failover, and migration. A VM can be running while an application is broken because the expected data disk is attached to the wrong LUN or mounted to the wrong path. Production runbooks should record disk names, resource IDs, LUNs, caching settings, mount points, and application roles. Backup restore tests should prove that those mappings survive recovery. Automation should attach disks deterministically instead of accepting accidental order. Reliable disk operations also account for VM-size limits, caching choices, and whether the application can tolerate detach or reattach events. That context supports safer operational decisions.
- Performance
- Performance depends on the disk SKU, size, caching setting, VM limits, and application layout; the LUN number itself is not a performance tier. Still, LUN mapping affects performance troubleshooting because teams must know which disk carries logs, data, temp files, or backups. If the wrong volume is attached or mounted, a database might run hot on a slower disk while a premium disk sits unused. Operators should correlate Azure disk metrics, VM storage profile output, and guest mount information. Clear LUN mapping makes it easier to tune caching, separate workloads, and avoid bottlenecks caused by mistaken disk placement. That context supports safer operational decisions.
- Operations
- Operations teams use LUNs when attaching disks, auditing VM storage profiles, troubleshooting missing volumes, and rebuilding systems from backups. The practical workflow is to inspect Azure-side data disk attachments, then compare them with guest OS disk identifiers and mount points. Change records should show which disk was attached, which LUN was selected, and why. For critical workloads, avoid manual portal-only changes with no evidence. Use CLI output to capture before-and-after state, especially before maintenance windows, restores, or VM size changes. Good operations keeps Azure metadata, guest configuration, and application documentation in sync. That context supports safer operational decisions. Keep mappings current.
Common mistakes
- Assuming the disk name, drive letter, and LUN are the same thing.
- Reattaching restored disks without preserving the LUN order expected by the application.
- Changing disk caching or attachment state without checking database or workload guidance.
- Leaving restored or detached managed disks running up cost because no one reconciled the mapping.