Azure 向 set table service properties 公开端点。此端点期望客户端传递 Authorization
header ,其格式可以为 SharedKeyLite <account-name>:<signature>
对于表服务,如所解释的 here 。 signature
是 <date>\n<canonical-resource>
的 sha256 编码形式规范资源构建遵循以下规则:
- Beginning with an empty string (""), append a forward slash (/), followed by the name of the account that owns the resource being accessed.
- 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/