首页 > 解决方案 > Azure 存储身份验证失败 - 观众验证失败。观众不匹配。[天蓝色][OAuth]

问题描述

我正在尝试使用以下代码对 Azure 存储进行 REST 调用。 在此处输入图像描述

但它显示以下错误:

<?xml version="1.0" encoding="UTF-8"?>
<Error>
   <Code>AuthenticationFailed</Code>
   <Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\n' +
        'RequestId:11c07be7-301e-0003-556f-42091d000000\n' +
        'Time:2021-05-06T11:59:40.1049759Z</Message>
   <AuthenticationErrorDetail>Audience validation failed. Audience did not match.</AuthenticationErrorDetail>
</Error>

我已经分配了角色: 在此处输入图像描述

并设置 API 权限: 在此处输入图像描述

但是还是这个错误。任何人都可以帮忙吗?

标签: azureazure-active-directoryazure-storageazure-blob-storageazure-authentication

解决方案


您的访问令牌的受众不正确。(aud观众)应该看起来像https://xxxx.blob.core.windows.net

确保在请求访问令牌时scope是。https://{account-name}.blob.core.windows.net/user_impersonation

在此处输入图像描述


推荐阅读