# Calculate the upload byte count from the right managed-disk source

> Why does a direct-copy target need a different size calculation from a local VHD upload?

- Canonical URL: https://update.dsesecurity.com/updates/dse-20260909-435-calculate-the-upload-byte-count-from-the-right-managed-disk-source/
- Publisher: Detection Systems & Engineering (DSE Security)
- Author: DSE Security Editorial Team
- Published: 2026-09-10T00:24:41+00:00
- Modified: 2026-09-10T02:04:57+00:00
- Last reviewed by DSE: 2026-09-09
- Resource type: Guide
- DSE priority: Information
- Topics: Business Continuity, IT
- Reading time: 2 minutes

## What you need to know

Why does a direct-copy target need a different size calculation from a local VHD upload?

## Potentially affected

Operators preparing Azure managed-disk copies with the documented PowerShell direct-upload workflow.

## DSE recommendation

Record whether the size input came from a local file or an Azure managed-disk resource.

## Article

## Source facts

For a local VHD upload, Microsoft’s PowerShell workflow takes the file’s length in bytes for UploadSizeInBytes. When copying an existing Azure managed disk, its reported byte count omits the footer, so the destination calculation must add 512 bytes; otherwise the copy fails. For an OS disk, the destination configuration must also specify the appropriate Hyper-V generation. Finishing data transfer alone does not make the upload disk attachable: its SAS must be revoked. [Microsoft Learn](https://learn.microsoft.com/en-us/azure/virtual-machines/windows/disks-upload-vhd-to-managed-disk-powershell).

## Applicability

Apply this distinction when adapting a direct-upload script into a region-copy or recovery workflow. Review the origin of every size value and the intended OS-disk generation before creating a target resource.

## DSE recommendation

Record whether the size input came from a local file or an Azure managed-disk resource. Have the operator annotate the size calculation with its source and units. Keep local-file and managed-resource paths explicit in automation, and compare the resulting request with the corresponding official example. Do not repair a failed copy by repeatedly changing capacity without explaining the discrepancy.

## Verification

Use a disposable representative disk to check the calculated upload size, destination generation when relevant, and transfer result. Complete the documented access-revocation step before checking attachment in an authorized test VM. Preserve the source resource ID, calculated byte count, and sanitized result without recording the SAS. Resolve unexplained size differences before using the workflow for recovery.

## Official references

[Microsoft Learn: Upload a VHD or copy a managed disk with Azure PowerShell](https://learn.microsoft.com/en-us/azure/virtual-machines/windows/disks-upload-vhd-to-managed-disk-powershell). Source reviewed September 9, 2026.

## Primary reference

- Name: Upload a VHD to Azure or copy a disk across regions - Azure PowerShell - Azure Virtual Machines | Microsoft Learn
- Authority: Microsoft Learn
- URL: https://learn.microsoft.com/en-us/azure/virtual-machines/windows/disks-upload-vhd-to-managed-disk-powershell
- Source publication date: Not stated by the source

## Citation and use

Preferred citation: “Calculate the upload byte count from the right managed-disk source,” DSE Security, https://update.dsesecurity.com/updates/dse-20260909-435-calculate-the-upload-byte-count-from-the-right-managed-disk-source/
Publishing principles: https://update.dsesecurity.com/updates/dse-updates-editorial-methodology/
Usage and citation policy: https://update.dsesecurity.com/usage/
Copyright © 2026 Detection Systems & Engineering. All rights reserved.
