如何使用从门户生成的 Azure Table Service SAS URL?

How to use Azure Table Service SAS URL generated from the portal?

我正在从 Azure 门户生成 SAS。

下面是代码,我用来插入 table 存储。

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();

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

您必须使用您的 public-facing IP 地址,而不是私有地址,因为那不是 Azure 看到的。 10.x.x.x 地址都是私有地址,还有一些其他块,例如 192.168.x.x.