[英]Invalid authentication info error when using Azure AD and Azure Storage PUT API
我正在嘗試使用 Azure Active Directory (AAD) 身份驗證和 REST API 將文件上傳到 Azure 存儲中的容器。 我無法弄清楚下面的工作流程中缺少什么,但它總是失敗。
這個怎么運作:
client_secret
Contributor
角色
Storage Blob Data Contributor
角色是否可以縮小到容器級別,而不是在帳戶級別授予?GET
https://login.microsoftonline.com/<my_tenant>/oauth2/v2.0/token
x-www-form-urlencoded
grant_type
: client_credentials
client_id
: <client_id>
scope
: https://graph.microsoft.com/.default
client_secret
: <client_secret>
content-type
: application/x-www-form-urlencoded
{
"token_type": "Bearer",
"expires_in": 3599,
"ext_expires_in": 3599,
"access_token": "<auth_token>"
}
<auth_token>
發送 PUT 請求以將文件上傳到 Azure 存儲容器PUT
https://<stg-account-name>.blob.core.windows.net/<container-name>/<file-name>.json
binary
<file-name>.json
x-ms-blob-type
: BlockBlob
x-ms-version
: 2020-04-08
Authentication
: Bearer <auth_token>
<?xml version="1.0" encoding="utf-8"?>
<Error>
<Code>InvalidAuthenticationInfo</Code>
<Message>Server failed to authenticate the request. Please refer to the information in the www-authenticate header.
RequestId:<guid>
Time:2022-09-26T18:29:27.4477615Z</Message>
<AuthenticationErrorDetail>Signature validation failed. Signature verification failed.</AuthenticationErrorDetail>
</Error>
試過:
Bearer
關鍵字
x-ms-version
header 從2017-11-09
為2020-04-08
問題
編輯1
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.