【发布时间】:2021-05-22 18:47:43
【问题描述】:
我正在尝试使用 REST API 为 Azure 存储获取 user delegation SAS token。
我有一个帐户,该帐户具有存储帐户所需的角色,并且该帐户已成功通过身份验证并从登录端点返回了 Bearer 令牌。
当我请求用户授权密钥时,我不断收到以下错误:
<?xml version="1.0" encoding="utf-8"?>
<Error>
<Code>InvalidXmlNodeValue</Code>
<Message>The value for one of the XML nodes is not in the correct format.
RequestId:9b7a22e3-601e-0082-7bee-060981000000
Time:2021-02-19T18:38:48.1286734Z</Message>
<XmlNodeName>Expiry</XmlNodeName>
<XmlNodeValue>2021-02-19T19:30:00</XmlNodeValue>
</Error>
我提交的正文是从the Azure docs复制的:
<?xml version="1.0" encoding="utf-8"?>
<KeyInfo>
<Start>2021-02-19T18:30:00</Start>
<Expiry>2021-02-19T19:30:00</Expiry>
</KeyInfo>
知道我做错了什么或错过了什么导致失败吗?
在 Azure 上分配的角色是:
以及请求头:
Authorization: Bearer ...
x-ms-version: 2020-04-08
Content-Type: text/xml
User-Agent: PostmanRuntime/7.26.10
Accept: */*
Postman-Token: df276a57-747c-45dd-a849-15ac6ad7b45b
Host: ....blob.core.windows.net
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 147
【问题讨论】:
-
您可以尝试像这样格式化到期时间:
2021-02-19T19:30:00Z。参考docs.microsoft.com/en-us/rest/api/storageservices/… -
哦,这行得通!谢谢! @doris-lv
-
我修改了我的答案,介意接受它供其他人参考吗?
-
完成,再次感谢 :)
标签: azure azure-storage azure-sas