gpt4 book ai didi

Azure Powershell 命令无法在 Azure Blob 存储中存储 bacpac 文件

转载 作者:行者123 更新时间:2023-12-01 23:07:11 30 4
gpt4 key购买 nike

背景

我正在尝试设置一个 powershell 脚本来创建 .bacpac 文件并将其存储在 Azure 的 blob 存储中。我正在使用 Get-AzureRmSqldatabaseExport 命令并将其指向我的存储容器。

该命令运行,据我了解,该过程将在运行该命令六小时后开始。

问题

问题是,几分钟后,我收到一条错误消息,指出 Blob 存储仅具有读取权限,而不是同时具有读取和写入权限。

问题

如何修改 powershell 命令以允许写入存储容器?这是否与容器本身有关?我是否错误地使用了 blob,应该使用不同类型的存储类型?

更多信息

命令:

New-AzureRmSqlDatabaseExport -ResourceGroupName "rgnEverything" -ServerName "serverOne" -DatabaseName "databaseDev" -StorageKeyType "StorageAccessKey" -StorageKey "storageKeyOne" -StorageUri "storageUriOne" -AdministratorLogin "adminlogin" -AdministratorLoginPassword (ConvertTo-Secu
reString "password" -AsPlainText -Force)

我当前正在通过 Azure Cloud Shell 运行此命令

这是运行命令后 Get-AzureRmSqlDatabaseImportExportStatus 返回的内容:

OperationStatusLink : https://management.azure.com/subscriptions/e088f9f1-aeed-401e-b8db-8bac796c43cd/resourceGroups/SweetSpot/providers/Microsoft.Sql/servers/sweetspotgolfshop/databases/SweetSpotDev/importExportOp
erationResults/9226c1e7-5e55-4d34-ba96-954b857c318c?api-version=2014-04-01-Preview
ErrorMessage :
LastModifiedTime : 3/16/2018 3:24:38 PM
QueuedTime : 3/16/2018 3:24:35 PM
StatusMessage : Running, Progress = 0%
Status : InProgress

错误消息:

Get-AzureRmSqlDatabaseImportExportStatus : BadRequest: The ImportExport operation with Request Id '9226c1e7-5e55-4d34-ba96-954b857c318c' failed due to 'Error encountered during the service operation.
Blob https://cs2e088f9f1aeedx401exb8d.blob.core.windows.net/database-backup is not writeable.
The remote server returned an error: (404) Not Found.
The remote server returned an error: (404) Not Found.
'.
At line:1 char:1
+ Get-AzureRmSqlDatabaseImportExportStatus -OperationStatusLink "https: ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzureRmSqlDatabaseImportExportStatus], CloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Sql.ImportExport.Cmdlet.GetAzureSqlDatabaseImportExportStatus

存储 Uri:

-StorageUri "https://cs2e088f9f1aeedx401exb8d.blob.core.windows.net/database-backup"

最佳答案

您指定容器地址作为目标的问题。您需要输入文件的完整所需存储 url,而不仅仅是容器路径。

因此您的 -StorageUri 参数值应如下所示

https://mystorageName.blob.core.windows.net/databasebackup/MyDbName-2018-03-16.bacpac

此外,您需要在尝试备份之前确保容器已存在,导出时不会为您创建该容器。

关于Azure Powershell 命令无法在 Azure Blob 存储中存储 bacpac 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49323749/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com