使用 Azure 自动化帐户,跨存储将文件从一个文件共享复制到另一个文件共享

Using Azure Automation Account, Copy files from one Fileshare to another Fileshare across Storage

我正在尝试将一个文件 (x) 从存储 (z) 的文件共享 (y) 复制到存储 (b) 的文件共享 (a)。

$StorageAccountName = "z"
$StorageAccessKey = 
"md226fZvTKPKaCd9TxDGPn4mitCPfvBvgzElwoqIgpbf2Pe09GKKfNJlMcK2EXXqRLqOrhBslybaE1Cpz2BcPg=="
$context1=New-AzureStorageContext $StorageAccountName $StorageAccessKey

$DestStorageAccountName = "b"
$DestStorageAccessKey = "xZjU0r5g5fU+/ieAbwc22OmVtFY5BJdQuF8OZsFd7hGHYLzQFGg9ZCpsVnQi5u6Wi/nigb8jdupUGo0YaXBphg=="
$destcontext1=New-AzureStorageContext $DestStorageAccountName $DestStorageAccessKey
$SrcPath = "https://z.file.core.windows.net/y/x"
$SrcShare = "y"
$DestPath = "https://b.file.core.windows.net/a"
$DestShare = "a"
Start-AzureStorageFileCopy -SrcFilePath $SrcPath -SrcShareName $SrcShare -DestShareName $DestShare - 
DestFilePath $DestPath -Context $context1 -DestContext $destcontext1 -Force

它给我如下错误:

Start-AzStorageFileCopy:给定的 path/prefix 'https:' 不是文件或目录的有效名称,或者不符合 Microsoft Azure 文件服务 REST API 的要求。

提前致谢!

请更改源路径和目标路径。在您的特定情况下,它们应该代表相对于共享的路径。

$StorageAccountName = "z"
$StorageAccessKey = 
"md226fZvTKPKaCd9TxDGPn4mitCPfvBvgzElwoqIgpbf2Pe09GKKfNJlMcK2EXXqRLqOrhBslybaE1Cpz2BcPg=="
$context1=New-AzureStorageContext $StorageAccountName $StorageAccessKey

$DestStorageAccountName = "b"
$DestStorageAccessKey = "xZjU0r5g5fU+/ieAbwc22OmVtFY5BJdQuF8OZsFd7hGHYLzQFGg9ZCpsVnQi5u6Wi/nigb8jdupUGo0YaXBphg=="
$destcontext1=New-AzureStorageContext $DestStorageAccountName $DestStorageAccessKey
$SrcPath = "test.txt" #assuming the name of the source file is "test.txt"
$SrcShare = "y"
$DestPath = "test.txt" #assuming you want to copy the file and keep the same name
$DestShare = "a"
Start-AzureStorageFileCopy -SrcFilePath $SrcPath -SrcShareName $SrcShare -DestShareName $DestShare - 
DestFilePath $DestPath -Context $context1 -DestContext $destcontext1 -Force

来自文档link

-SrcFilePath Specifies the path of the source file relative to the source directory or source share.

-DestFilePath Specifies the path of the destination file relative to the destination share.