c# - 如何为 Azure 存储表集表服务属性端点构建规范资源?

标签 c# asp.net azure azure-table-storage

Azure 向 set table service properties 公开端点。此端点期望客户端传递 Authorization header ,其格式可以为 SharedKeyLite <account-name>:<signature>对于表服务,如所解释的 heresignature<date>\n<canonical-resource> 的 sha256 编码形式规范资源构建遵循以下规则:

  1. Beginning with an empty string (""), append a forward slash (/), followed by the name of the account that owns the resource being accessed.
  2. Append the resource's encoded URI path. If the request URI addresses a component of the resource, append the appropriate query string. The query string should include the question mark and the comp parameter (for example, ?comp=metadata). No other parameters should be included on the query string.

根据Authentication documentation .

我能够对 query tables 进行身份验证或entity operations 。但是,我始终无法对设置表服务属性端点进行身份验证。我通过从 "/<account-name>" 开始构建规范资源。根据规则 1,然后我附加另一个 "/"没有任何查询字符串,因为我相信请求 URI(即 https://<account-name>.table.core.windows.net/?restype=service&comp=properties )没有根据规则 2 寻址组件。这使得规范资源"/<account-name>/" .

是否有人设法对此端点进行身份验证?如果是这样怎么办?

注1:我尝试了其他方式(也附加了查询字符串,这使得规范资源 "/<account-name>/?comp=properties" ),但再次失败。

注 2:规则 2 要求附加编码的 URI 路径,但实际情况并非如此。

最佳答案

我能够部分解决该问题。问题是 Azure 存储模拟器的行为与实际存储服务不同。 Set Table Service Properties端点未在模拟器上验证请求,而它在服务本身上运行良好。针对表(读取、创建、删除)和实体(创建、读取、更新和删除)的其他请求在模拟器和服务上的行为相同。

规范资源的格式为"/<account-name>/?comp=properties" 。正如预期的那样,内容类型对身份验证没有影响。

关于c# - 如何为 Azure 存储表集表服务属性端点构建规范资源?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34606223/

相关文章:

c# - IEnumerable<> 到 IList<>

c# - 如何控制没有API的第三方应用程序?

javascript - 如何使用 ajax 触发 aspx.cs 文件中的方法

Azure AD B2C 审核日志 - 图形 API

c# - Unity中GameObject的引用脚本类

c# - 具有讽刺意味的是:如何让 KeyTerm 优先于变量?

javascript - 如何设置带有单选图标后缀文本的单选按钮列表?

c# - 如何使用 ASP.NET 和 MySql 创建安全登录

Azure Functions Core Tools 无法安装绑定(bind)所需的扩展

azure - 为什么 host.json 没有被复制到 F# Azure Functions 项目中的输出?