403 试图将 DB 导出到 Azure 中的存储帐户时出错。

问题描述 投票:0回答:1

我正在使用PowerShell命令导出一个DB。New-AzureRmSqlDatabaseExport.

我的命令是这样的

$name = 'admin'
$my_password = 'password'
$db = 'my-db'
$server = 'my-db-sqlserver'
$sa_key = 'storage_account_key' 
$sa_uri = 'https://testingimmutableblob.blob.core.windows.net/testdbimmutable/test_export.bacpac' 


New-AzureRmSqlDatabaseExport -ResourceGroupName 'my_resource' -ServerName $server -DatabaseName $db -StorageKeyType 'StorageAccessKey' -StorageKey $sa_key -StorageUri $sa_uri -AdministratorLogin $name -AdministratorLoginPassword $my_password

当我运行最后一条命令时,我得到了以下错误信息

Unexpected exception encountered while retrieving metadata for blob

我不知道是什么问题。我搜索了一下,发现有时候服务器上的时间会不匹配。我检查了一下,服务器上的时间似乎是正确的。我也进入了DB,并尝试使用界面导出它。我得到了完全相同的错误,这很有趣。

有什么想法吗?

Inner exception Microsoft.WindowsAzure.Storage.StorageException:The remote server returned an error: (403) Forbidden.; Inner exception System.Net.WebException:The remote server returned an error: (403) Forbidden.
azure powershell azure-sql-database azure-storage-blobs
1个回答
1
投票

请检查你的存储防火墙和虚拟网络,设置为 Allow access from All networks:enter image description here

或者将你的客户端IP添加到网络防火墙中。enter image description here

如果你只设置 Allow read access to storage logging from any network:enter image description here

当你访问存储空间时,你会得到403错误。enter image description here

希望这能帮助你。


0
投票

403的意思是禁止。这很可能与权限有关。请重新生成密钥。你是否使用的用户账户不是SQL Server管理员?

另一个建议是在用户名中添加服务器名称,比如[email protected]@dbservername。

© www.soinside.com 2019 - 2024. All rights reserved.