-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Start-AzStorageBlobCopy - Copying a blob from Uri does not work #12287
Comments
This should be fairly easy to reproduce. I reproduced it on 4 systems. All were Windows 10 or Windows 2016, all using updated modules. |
For the way you get blob Uri for copy source, you use key credential, so the created blob Uri doesn't contain SAS. Then if your source blob is not public, the Uri doesn't has privilege to access the blob, so the copy will fail with the error above. Change your script as following (the changes are in the last 2 lines). It will create a source Blob Uri contains sas credential, and copy from the sas Uri. Let me know if the following script works for you. $SrcRGName = "PanzerRG1"
$SrcSAName = "panzersa1"
$SrcContainer = "container"
$SrcBlobStorageAccount = Get-AzStorageAccount -Name $SrcSAName -ResourceGroupName $SrcRGName
$SrcBlobCTX = $SrcBlobStorageAccount.Context
$SrcBlob = Get-AzStorageBlob -Blob "Excel.csv" -Container $SrcContainer -Context $SrcBlobCTX
$DestRGName = "PanzerRG2"
$DestSAName = "panzersa2"
$DestSAKey = Get-AzStorageAccountKey -ResourceGroupName $DestRGName -AccountName $DestSAName | Where-Object {$_.KeyName -eq 'Key1'} | Select-Object -ExpandProperty Value
$DestStorageContext = New-AzStorageContext -StorageAccountName $DestSAName -StorageAccountKey $DestSAKey
# use default sas setting, the created SAS Uri will expired in 1 hour. You can adjust per your requirements.
$srcBlobUri = $SrcBlob | New-AzStorageBlobSASToken -Permission r -FullUri
Start-AzStorageBlobCopy -AbsoluteUri $srcBlobUri -DestContainer $DestContainer -DestBlob $SrcBlob.Name -DestContext $DestStorageContext For example #5 of Start-AzStorageBlobCopy , it just show you how to input the |
Thanks; if the example as written relies on the blob being public, the example should include that. Getting the SAS token works. This is also an excellent opportunity to include that as an example, and correct Example #5. |
@Panzerbjrn |
As I suggested, make another example that includes it. So I take it this bug won't be fixed? |
@Panzerbjrn
So My above suggestion is update the the description of example #5 by add something like: "The Uri should have access to the source object. E.g: if the source is a none public Azure blob, the Uri should contain SAS token which has read access to the blob." How do you think? |
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithubtriage. |
@Panzerbjrn |
Description
When trying to copy a blob from URI (As in example 5 of the help file), an error comes back
Steps to reproduce
This produces this error:
Environment data
Module versions
Debug output
Error output
The text was updated successfully, but these errors were encountered: