【问题标题】:Azure: Unable to copy data from one azure storage account from one subscription to another subscriptionAzure:无法将数据从一个 Azure 存储帐户从一个订阅复制到另一个订阅
【发布时间】:2021-09-20 16:34:23
【问题描述】:

我正在尝试将数据从一个订阅中的一个 Azure 存储帐户复制到不同订阅中的另一个 Azure 存储帐户。为此,我使用 powershell 脚本创建了一个 azure 函数。

此脚本在将内容从一个存储帐户复制到另一个存储帐户时工作正常,但不适用于不同的订阅。

$SrcStgAccURI = "https://trimarinestage.blob.core.windows.net/"
$SrcSASToken = "?sr=b&sv=2019-12-12&ss=b&srt=sco&sp=rlx&se=2024-09-23T16:19:37Z&st=2020-09-23T08:19:37Z&spr=https&sig=tVcutYO6P2ytRpiEahO92wCJZh8I5ORRS7JYKtI2ADU%3D"
$SrcFullPath = "$($SrcStgAccURI)?$($SrcSASToken)"

$DstStgAccURI = "https://backuptops.file.core.windows.net/"
$DstSASToken = "?sv=2020-08-04&ss=bfqt&srt=sco&sp=rwdlacuptfx&se=2025-09-13T23:07:44Z&st=2021-09-13T15:07:44Z&spr=https&sig=Dj9myrNkmNp5GCbs31yDiV5zsyz41EJfnY8sJ9oaAWM%3D"
$DstFullPath = "$($DstStgAccURI)?$($DstSASToken)"

出现以下错误:

2021-09-16T07:30:04.614 [错误] 执行“Functions.BackUp”(失败, Id=2e0f1798-8b9c-45fc-b652-7350daa4fceb,持续时间=42ms)不能 创建 BlobServiceClient 以获取 BlobContainerClient 使用 连接:存储

【问题讨论】:

  • 我正在使用以下代码:Write-Host "Backing up storage account..." ./azcopy.exe copy $SrcFullPath $DstFullPath --recursive --overwrite=ifsourcenewer

标签: azure-functions azure-storage-account


【解决方案1】:

我在我的环境中测试过,它对我有用。请使用以下格式的命令。

$SrcStgAccURI = "https://a********storragetest.blob.core.windows.net/"
$SrcSASToken = "sastoken with proper permissions"
$SrcFullPath = "$SrcStgAccURI"+"$SrcSASToken"
$DstStgAccURI = "https://a*********storageaccount234.file.core.windows.net/"
$DstSASToken = "sastoken with proper permissions"
$DstFullPath = "$DstStgAccURI"+"$DstSASToken"

使用具有以下权限的 SAS 令牌。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-08-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-24
    相关资源
    最近更新 更多