Closed keznnelg closed 3 years ago
@keznnelg Thanks for reporting the issue! I have raised PR https://github.com/Azure/azure-powershell/pull/15557 to fix it.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithubtriage.
Author: | keznnelg |
---|---|
Assignees: | blueww |
Labels: | `Service Attention`, `Storage`, `customer-reported`, `needs-triage`, `question` |
Milestone: | - |
Description
Copy-AzStorageBlob fails with ArgumentOutOfRangeException for any BLOB of size less than 50,000 bytes.
This is due to the initial assignment of the blockLength variable in method StorageDataMovementCmdletBase.GetBlockLength (https://github.com/Azure/azure-powershell/blob/f258ced433f7d1a80c3d8918c26a4629133f4177/src/Storage/Storage/Blob/StorageDataMovementCmdletBase.cs#L179) being assigned the value of zero due to truncation of the fractional value less than one produced by the defined division computation.
This zero value is ultimately passed to HttpRange.ctor (https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/src/HttpRange.cs#L36) where the ArgumentOutOfRangeException is thrown.
The problematic call flow is as follows: 1) https://github.com/Azure/azure-powershell/blob/main/src/Storage/Storage/Blob/Cmdlet/CopyAzureStorageBlob.cs#L399 2) https://github.com/Azure/azure-powershell/blob/f258ced433f7d1a80c3d8918c26a4629133f4177/src/Storage/Storage/Blob/StorageDataMovementCmdletBase.cs#L179 3) https://github.com/Azure/azure-powershell/blob/main/src/Storage/Storage/Blob/Cmdlet/CopyAzureStorageBlob.cs#L410 4) https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/src/HttpRange.cs#L36 5) https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/src/HttpRange.cs#L41
You probably need to change the code for https://github.com/Azure/azure-powershell/blob/f258ced433f7d1a80c3d8918c26a4629133f4177/src/Storage/Storage/Blob/StorageDataMovementCmdletBase.cs#L186 from return ' blockLength; ' to ' return blockLength > 0 ? blockLength : contentLength '
Steps to reproduce
1) Have an existing container with a BLOB having size less than 50,000 bytes (or more appropriately stated....which when transmitted via HTTP produces a stated content length of less than 50,000). 2) Execute $destBlob = Copy-AzStorageBlob -SrcContainer "sourcecontainername" -SrcBlob "srcblobname" -DestContainer "destcontainername" -DestBlob "destblobname"
Step 2 is an example command from https://docs.microsoft.com/en-us/powershell/module/az.storage/copy-azstorageblob?view=azps-5.9.0. It obviously must be executed against a BLOB with size less than 50,000 bytes.
Environment data
Name Value
PSVersion 5.1.17763.1971
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.1971
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Module versions
ModuleType Version Name ExportedCommands
Script 2.5.1 Az.Accounts {Disable-AzDataCollection, Disable-AzContextAutosave, Enab... Script 2.3.0 Az.Accounts {Disable-AzDataCollection, Disable-AzContextAutosave, Enab... Script 2.2.8 Az.Accounts {Disable-AzDataCollection, Disable-AzContextAutosave, Enab... Script 2.2.6 Az.Accounts {Disable-AzDataCollection, Disable-AzContextAutosave, Enab... Script 1.7.0 Az.FrontDoor {New-AzFrontDoor, Get-AzFrontDoor, Set-AzFrontDoor, Remove... Script 3.4.0 Az.KeyVault {Add-AzKeyVaultCertificate, Update-AzKeyVaultCertificate, ... Script 3.3.0 Az.Resources {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzR... Script 3.7.0 Az.Storage {Get-AzStorageAccount, Get-AzStorageAccountKey, New-AzStor... Script 2.3.0 Az.Storage {Get-AzStorageAccount, Get-AzStorageAccountKey, New-AzStor...
ModuleType Version Name ExportedCommands
Script 1.0.1 Microsoft.PowerShell.Operation.V... {Get-OperationValidation, Invoke-OperationValidation}
Binary 1.0.0.1 PackageManagement {Find-Package, Get-Package, Get-PackageProvider, Get-Packa... Script 3.4.0 Pester {Describe, Context, It, Should...}
Script 1.0.0.1 PowerShellGet {Install-Module, Find-Module, Save-Module, Update-Module...} Script 2.0.0 PSReadline {Get-PSReadLineKeyHandler, Set-PSReadLineKeyHandler, Remov...
ModuleType Version Name ExportedCommands
Manifest 1.0.1.0 ActiveDirectory {Add-ADCentralAccessPolicyMember, Add-ADComputerServiceAcc... Manifest 1.0.0.0 AppBackgroundTask {Disable-AppBackgroundTaskDiagnosticLog, Enable-AppBackgro... Manifest 2.0.0.0 AppLocker {Get-AppLockerFileInformation, Get-AppLockerPolicy, New-Ap... Manifest 1.0.0.0 AppvClient {Add-AppvClientConnectionGroup, Add-AppvClientPackage, Add... Manifest 2.0.1.0 Appx {Add-AppxPackage, Get-AppxPackage, Get-AppxPackageManifest... Manifest 1.0 BestPractices {Get-BpaModel, Get-BpaResult, Invoke-BpaModel, Set-BpaResult} Manifest 2.0.0.0 BitsTransfer {Add-BitsFile, Complete-BitsTransfer, Get-BitsTransfer, Re... Manifest 1.0.0.0 BranchCache {Add-BCDataCacheExtension, Clear-BCCache, Disable-BC, Disa... Manifest 1.0.0.0 CimCmdlets {Get-CimAssociatedInstance, Get-CimClass, Get-CimInstance,... Manifest 1.0 ConfigCI {Get-SystemDriver, New-CIPolicyRule, New-CIPolicy, Get-CIP... Manifest 1.0 ConfigDefender {Get-MpPreference, Set-MpPreference, Add-MpPreference, Rem... Manifest 1.0 Defender {Get-MpPreference, Set-MpPreference, Add-MpPreference, Rem... Manifest 1.0.1.0 DeliveryOptimization {Get-DeliveryOptimizationStatus, Get-DeliveryOptimizationP... Binary 2.0.0.0 DFSR {New-DfsReplicationGroup, Get-DfsReplicationGroup, Set-Dfs... Manifest 1.0.0.0 DirectAccessClientComponents {Disable-DAManualEntryPointSelection, Enable-DAManualEntry... Script 3.0 Dism {Add-AppxProvisionedPackage, Add-WindowsDriver, Add-Window... Manifest 1.0.0.0 DnsClient {Resolve-DnsName, Clear-DnsClientCache, Get-DnsClient, Get... Manifest 1.0.0.0 EventTracingManagement {Start-EtwTraceSession, New-EtwTraceSession, Get-EtwTraceS... Manifest 2.0.0.0 International {Get-WinDefaultInputMethodOverride, Set-WinDefaultInputMet... Manifest 1.0.0.0 iSCSI {Get-IscsiTargetPortal, New-IscsiTargetPortal, Remove-Iscs... Manifest 2.0.0.0 IscsiTarget {Add-ClusteriSCSITargetServerRole, Add-IscsiVirtualDiskTar... Script 1.0.0.0 ISE {New-IseSnippet, Import-IseSnippet, Get-IseSnippet}
Manifest 1.0.0.0 Kds {Add-KdsRootKey, Get-KdsRootKey, Test-KdsRootKey, Set-KdsC... Manifest 1.0.1.0 Microsoft.PowerShell.Archive {Compress-Archive, Expand-Archive}
Manifest 3.0.0.0 Microsoft.PowerShell.Diagnostics {Get-WinEvent, Get-Counter, Import-Counter, Export-Counter... Manifest 3.0.0.0 Microsoft.PowerShell.Host {Start-Transcript, Stop-Transcript}
Manifest 1.0.0.0 Microsoft.PowerShell.LocalAccounts {Add-LocalGroupMember, Disable-LocalUser, Enable-LocalUser... Manifest 3.1.0.0 Microsoft.PowerShell.Management {Add-Content, Clear-Content, Clear-ItemProperty, Join-Path... Script 1.0 Microsoft.PowerShell.ODataUtils Export-ODataEndpointProxy
Manifest 3.0.0.0 Microsoft.PowerShell.Security {Get-Acl, Set-Acl, Get-PfxCertificate, Get-Credential...}
Manifest 3.1.0.0 Microsoft.PowerShell.Utility {Format-List, Format-Custom, Format-Table, Format-Wide...}
Manifest 3.0.0.0 Microsoft.WSMan.Management {Disable-WSManCredSSP, Enable-WSManCredSSP, Get-WSManCredS... Manifest 1.0 MMAgent {Disable-MMAgent, Enable-MMAgent, Set-MMAgent, Get-MMAgent... Manifest 1.0.0.0 MsDtc {New-DtcDiagnosticTransaction, Complete-DtcDiagnosticTrans... Manifest 2.0.0.0 NetAdapter {Disable-NetAdapter, Disable-NetAdapterBinding, Disable-Ne... Manifest 1.0.0.0 NetConnection {Get-NetConnectionProfile, Set-NetConnectionProfile}
Manifest 1.0.0.0 NetDiagnostics Get-NetView
Manifest 1.0.0.0 NetEventPacketCapture {New-NetEventSession, Remove-NetEventSession, Get-NetEvent... Manifest 2.0.0.0 NetLbfo {Add-NetLbfoTeamMember, Add-NetLbfoTeamNic, Get-NetLbfoTea... Manifest 1.0.0.0 NetNat {Get-NetNat, Get-NetNatExternalAddress, Get-NetNatStaticMa... Manifest 2.0.0.0 NetQos {Get-NetQosPolicy, Set-NetQosPolicy, Remove-NetQosPolicy, ... Manifest 2.0.0.0 NetSecurity {Get-DAPolicyChange, New-NetIPsecAuthProposal, New-NetIPse... Manifest 1.0.0.0 NetSwitchTeam {New-NetSwitchTeam, Remove-NetSwitchTeam, Get-NetSwitchTea... Manifest 1.0.0.0 NetTCPIP {Get-NetIPAddress, Get-NetIPInterface, Get-NetIPv4Protocol... Manifest 1.0.0.0 NetworkConnectivityStatus {Get-DAConnectionStatus, Get-NCSIPolicyConfiguration, Rese... Manifest 1.0.0.0 NetworkSwitchManager {Disable-NetworkSwitchEthernetPort, Enable-NetworkSwitchEt... Manifest 1.0.0.0 NetworkTransition {Add-NetIPHttpsCertBinding, Disable-NetDnsTransitionConfig... Manifest 1.0 NFS {Get-NfsMappedIdentity, Get-NfsNetgroup, Install-NfsMappin... Manifest 1.0.0.0 PcsvDevice {Get-PcsvDevice, Start-PcsvDevice, Stop-PcsvDevice, Restar... Binary 1.0.0.0 PersistentMemory {Get-PmemDisk, Get-PmemPhysicalDevice, Get-PmemUnusedRegio... Manifest 1.0.0.0 PKI {Add-CertificateEnrollmentPolicyServer, Export-Certificate... Manifest 1.0.0.0 PlatformIdentifier Get-PlatformIdentifier
Manifest 1.0.0.0 PnpDevice {Get-PnpDevice, Get-PnpDeviceProperty, Enable-PnpDevice, D... Manifest 1.1 PrintManagement {Add-Printer, Add-PrinterDriver, Add-PrinterPort, Get-Prin... Binary 1.0.11 ProcessMitigations {Get-ProcessMitigation, Set-ProcessMitigation, ConvertTo-P... Manifest 1.1 PSDesiredStateConfiguration {Set-DscLocalConfigurationManager, Start-DscConfiguration,... Script 1.0.0.0 PSDiagnostics {Disable-PSTrace, Disable-PSWSManCombinedTrace, Disable-WS... Binary 1.1.0.0 PSScheduledJob {New-JobTrigger, Add-JobTrigger, Remove-JobTrigger, Get-Jo... Manifest 1.5.2.6 PSWindowsUpdate {Add-WUOfflineSync, Get-WUHistory, Get-WUInstall, Get-WUIn... Manifest 2.0.0.0 PSWorkflow {New-PSWorkflowExecutionOption, New-PSWorkflowSession, nwsn} Manifest 1.0.0.0 PSWorkflowUtility Invoke-AsWorkflow
Manifest 2.0.0.0 RemoteDesktop {Get-RDCertificate, Set-RDCertificate, New-RDCertificate, ... Manifest 1.0.0.0 ScheduledTasks {Get-ScheduledTask, Set-ScheduledTask, Register-ScheduledT... Manifest 2.0.0.0 SecureBoot {Confirm-SecureBootUEFI, Set-SecureBootUEFI, Get-SecureBoo... Manifest 1.0.0.0 SecurityCmdlets {Backup-SecurityPolicy, Restore-SecurityPolicy, Backup-Aud... Script 1.0.0.0 ServerCore {Get-DisplayResolution, Set-DisplayResolution}
Script 2.0.0.0 ServerManager {Get-WindowsFeature, Install-WindowsFeature, Uninstall-Win... Cim 1.0.0.0 ServerManagerTasks {Get-SMCounterSample, Get-SMPerformanceCollector, Start-SM... Manifest 2.0.0.0 SmbShare {Get-SmbShare, Remove-SmbShare, Set-SmbShare, Block-SmbSha... Manifest 2.0.0.0 SmbWitness {Get-SmbWitnessClient, Move-SmbWitnessClient, gsmbw, msmbw... Manifest 2.0.0.0 SoftwareInventoryLogging {Get-SilComputer, Get-SilComputerIdentity, Get-SilSoftware... Manifest 1.0.0.0 StartLayout {Export-StartLayout, Import-StartLayout, Export-StartLayou... Manifest 2.0.0.0 Storage {Add-InitiatorIdToMaskingSet, Add-PartitionAccessPath, Add... Manifest 1.0.0.0 StorageBusCache {Clear-StorageBusDisk, Disable-StorageBusCache, Disable-St... Manifest 2.0.0.0 TLS {New-TlsSessionTicketKey, Enable-TlsSessionTicketKey, Disa... Manifest 1.0.0.0 TroubleshootingPack {Get-TroubleshootingPack, Invoke-TroubleshootingPack}
Manifest 2.0.0.0 TrustedPlatformModule {Get-Tpm, Initialize-Tpm, Clear-Tpm, Unblock-Tpm...}
Binary 2.1.639.0 UEV {Clear-UevConfiguration, Clear-UevAppxPackage, Restore-Uev... Manifest 1.0.0.0 UserAccessLogging {Enable-Ual, Disable-Ual, Get-Ual, Get-UalDns...}
Manifest 2.0.0.0 VpnClient {Add-VpnConnection, Set-VpnConnection, Remove-VpnConnectio... Manifest 1.0.0.0 Wdac {Get-OdbcDriver, Set-OdbcDriver, Get-OdbcDsn, Add-OdbcDsn...} Manifest 2.0.0.0 Whea {Get-WheaMemoryPolicy, Set-WheaMemoryPolicy}
Manifest 1.0.0.0 WindowsDeveloperLicense {Get-WindowsDeveloperLicense, Unregister-WindowsDeveloperL... Script 1.0 WindowsErrorReporting {Enable-WindowsErrorReporting, Disable-WindowsErrorReporti... Manifest 1.0.0.0 WindowsSearch {Get-WindowsSearchSetting, Set-WindowsSearchSetting}
Manifest 1.0.0.0 WindowsUpdate Get-WindowsUpdateLog
Manifest 1.0.0.2 WindowsUpdateProvider {Get-WUAVersion, Get-WULastInstallationDate, Get-WULastSca...
Debug output
I cannot get debug output. This is running in non-interactive mode of powershell and I cannot get around that.
ICloudBlob : Microsoft.Azure.Storage.Blob.CloudBlockBlob BlobType : BlockBlob Length : 42 IsDeleted : False BlobClient : Azure.Storage.Blobs.BlobClient BlobBaseClient : Azure.Storage.Blobs.Specialized.BlockBlobClient BlobProperties : Azure.Storage.Blobs.Models.BlobProperties RemainingDaysBeforePermanentDelete : ContentType : application/octet-stream LastModified : 7/26/2021 2:32:43 PM +00:00 SnapshotTime : ContinuationToken : VersionId : IsLatestVersion : AccessTier : Hot TagCount : 0 Tags : Context : Microsoft.WindowsAzure.Commands.Storage.AzureStorageContext Name : TestRoot.txt
VERBOSE: Performing the operation "Copy" on target "TestRoot.txt". 0 Copy-AzStorageBlob : Specified argument was out of the range of valid values. Parameter name: length At E:\Agents\ZxhwpR_temp\34a90939-ec71-456b-98b6-bf8a34f016b6.ps1:98 char:1
FullyQualifiedErrorId : ArgumentOutOfRangeException,Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet.CopyAzur eStorageBlob
VERBOSE: Transfer Summary
Total: 1.
Successful: 0.
Failed: 1.
Error output
WARNING: Upcoming breaking changes in the cmdlet 'Resolve-AzError' :
The
Resolve-Error
alias will be removed in a future release. Please change any scripts that use this alias to useResolve-AzError
instead.Note : Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell. InnerException : False Exception : System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: length at Azure.HttpRange..ctor(Int64 offset, Nullabled69.Mo
veNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.WindowsAzure.Commands.Storage.Common.LimitedConcurrencyTaskScheduler.<RunConcurrentT
ask>d26.MoveNext()
HelpLink :
ErrorDetails :
ErrorCategory : InvalidArgument: (:) [Copy-AzStorageBlob], ArgumentOutOfRangeException
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at , E:\Agents\ZxhwpR_temp\34a90939-ec71-456b-98b6-bf8a34f016b6.ps1: line 98
at , : line 1
1 length) at Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet.CopyAzureStorageBlob.<CopyFromUri>d__69.Mo veNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.WindowsAzure.Commands.Storage.Common.LimitedConcurrencyTaskScheduler.<RunConcurrentT ask>d__26.MoveNext() Message : Specified argument was out of the range of valid values. Parameter name: length StackTrace : at Azure.HttpRange..ctor(Int64 offset, Nullable
1 length) at Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet.CopyAzureStorageBlob.The Azure PowerShell team is listening, please let us know how we are doing: https://aka.ms/azpssurvey?Q_CHL=ERROR.