Azcopy的Azure Runbook替换

发布于 2025-02-05 20:32:02 字数 218 浏览 3 评论 0 原文

如何翻译此azcopy命令:

azcopy.exe同步” https://xxxxx.blob.core.core.windows.net/xxxxx/ .... ....

net/xxxxx /

我玩了 start-azurestorageblobcopy ,但无法与2 Uri的

R. Kim一起使用。

How do I translate this AzCopy command:

azcopy.exe sync "https://xxxxxx.blob.core.windows.net/xxxxx/...." "https://xxxxxx.blob.core.windows.net/xxxxx/...." --recursive

To an Azure Runbook command?

I played around with Start-AzureStorageBlobCopy but can't get it to work with 2 URI's

R. Kim

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沉鱼一梦 2025-02-12 20:32:02

cmdlet start-azurestorageblobcopy 是Azure RM模块的

  • 一部分您运行的书中的cmdlet将自动自动暂停。
  • 建议在运行簿脚本中使用 az 模块cmdlet。

您可以使用 start-azStorageBlobCopy cmdlet将blob从一个存储帐户复制到另一个存储帐户。

为了进行测试,我创建了一本具有下面脚本的PowerShell运行书籍(将所有BLOB从源存储帐户容器复制到目标存储帐户容器),并通过在自动化帐户上启用托管身份来将其连接到Azure帐户。

connect-azaccount -identity
$src=New-AzStorageContext -StorageAccountName <sourceStorageAccountName> -StorageAccountKey <sourcestorageaccountKey>
$dest=New-AzStorageContext -StorageAccountName <destinationstrgaccountName> -StorageAccountKey <destinationStorageAccountKey>
Get-AzStorageBlob -Container "<containerName>" -Context $src | Start-AzStorageBlobCopy -DestContainer "destcont" -DestContext $dest

Refer to 此文档有关启动azstorageblobcopy cmdlet和支持参数列表的更多信息。

另外,如果您想在运行书中 az复制,我建议您使用 Hybrid Run Book Worker 它可以让您预先安装Azcopy,然后在该工人上执行任何运行书。

有关自动化帐户中Azcopy的更多信息,您可以参考此类似的msdn线程

The Powershell Cmdlet Start-AzureStorageBlobCopy is part of Azure RM module as we know that AzureRM module is going to be retried on 29 February 2024.

  • If you use the Azure RM module related cmdlets in you run book the Job will be Suspended automatically.
  • It is recommended to use Az Module Cmdlets in your runbook scripts.

You can use Start-AzStorageBlobCopy cmdlet to copy the blobs from one storage account to another storage account.

To test this i have created a PowerShell run book with the script below (copying all the blobs from source storage account container to destination storage account container) and connected it to azure account by enabling managed identity on the automation account.

connect-azaccount -identity
$src=New-AzStorageContext -StorageAccountName <sourceStorageAccountName> -StorageAccountKey <sourcestorageaccountKey>
$dest=New-AzStorageContext -StorageAccountName <destinationstrgaccountName> -StorageAccountKey <destinationStorageAccountKey>
Get-AzStorageBlob -Container "<containerName>" -Context $src | Start-AzStorageBlobCopy -DestContainer "destcont" -DestContext $dest

Refer to this documentation for more information about the Start-AzStorageBlobCopy cmdlet and the list of support parameters.

Alternatively, if you want to AZ copy in your run book i would suggest you to use the Hybrid run book worker which would allow you to pre-install AzCopy and then execute any runbook on that worker.

For more information on Azcopy in Automation Account you can refer to this similar MSDN thread.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文