【问题标题】:How to use Azure Table Service SAS URL generated from the portal?如何使用从门户生成的 Azure 表服务 SAS URL?
【发布时间】:2017-02-03 19:31:17
【问题描述】:

我正在从 Azure 门户生成 SAS。

下面是代码,我用来插入到表存储中。

string SAS = "SAS Token from the portal";
StorageCredentials storagecred = new StorageCredentials(SAS);
var ctc = new CloudTableClient(
                new StorageUri(new Uri(
              "https://{myaccountname}.table.core.windows.net")),storagecred);
var table = ctc.GetTableReference("{tablename}");
table.CreateIfNotExists();

我收到禁止访问表错误 (403)。我是否传递了任何不正确的参数?我的理解是,生成 SAS 后,不需要帐户凭据。提供的 IP 地址是我的私有 IP。

【问题讨论】:

  • 看看StorageException,尤其是RequestInformation。您应该找到有关此 403 错误的更多详细信息。
  • @GauravMantri 在RequestInformation 中我收到一条消息 - 服务器无法验证请求。确保 Authorization 标头的值格式正确,包括签名。
  • 你不能把私有IP地址放在那里。你必须使用你的公共IP地址。 Azure 看不到你的私有 IP 地址。
  • @juunas 谢谢!问题在于 IP 地址,当我使用公共地址时,它起作用了。

标签: azure azure-table-storage


【解决方案1】:

您必须使用面向公众的 IP 地址,而不是私有地址,因为这不是 Azure 看到的。 10.x.x.x 地址都是私有地址,还有一些其他的块,比如 192.168.x.x。

【讨论】:

    猜你喜欢
    • 2017-08-16
    • 1970-01-01
    • 2022-08-19
    • 2020-10-12
    • 2020-02-11
    • 1970-01-01
    • 2023-03-03
    • 2020-03-08
    • 2021-05-12
    相关资源
    最近更新 更多