Imr*_*vel 5 azure azure-active-directory azure-blob-storage azure-functions azure-managed-identity
我正在使用适用于 .NET 的 Microsoft.Azure.Services.AppAuthentication 库 (v1.0.3),使用托管服务标识从 Azure Function 应用连接到 Blob 存储。授权码:
var tokenProvider = new AzureServiceTokenProvider();
string accessToken = await tokenProvider.GetAccessTokenAsync("https://storage.azure.com/");
var tokenCredential = new TokenCredential(accessToken);
var credentials = new StorageCredentials(tokenCredential);
var storageUri = new Uri($"https://{accountName}.blob.core.windows.net");
var client = new CloudBlobClient(storageUri, credentials);
Run Code Online (Sandbox Code Playgroud)
无论给定的 RBAC 角色如何,现有存储帐户都拒绝接受 MSI:
Microsoft.WindowsAzure.Storage.StorageException: Server failed to authenticate the request.
Make sure the value of Authorization header is formed correctly including the signature.
at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteAsyncInternal[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext, CancellationToken token)
at Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer.CreateIfNotExistsAsync(BlobContainerPublicAccessType accessType, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)
Run Code Online (Sandbox Code Playgroud)
storageException.RequestInformation.ExtendedErrorInformation.AdditionalDetails投诉的其他异常详细信息AuthenticationErrorDetail: Issuer validation failed. Issuer did not match.
当解码失败的 jwt 令牌时,发行者似乎没问题:
{
"aud": "https://storage.azure.com/",
"iss": "https://sts.windows.net/<my directory guid>/",
...
}
Run Code Online (Sandbox Code Playgroud)
当我创建新的相同设置的存储帐户时,相同的功能应用程序 MSI 和身份验证代码可以工作,甚至令牌中的发行者也完全相同。因此,客户端功能应用程序及其 MSI 标识并不是这里的罪魁祸首。
为什么这个存储帐户无法授权以及如何让它接受 MSI?
更新: 交叉发布到 MS 论坛,以引起 MS 的注意,以验证这是否是一个天蓝色的错误。
即使在与 MS 核实后,仍不清楚原因是什么,但将受影响的订阅移动到另一个 Azure AD 目录似乎已经解决了问题。
| 归档时间: |
|
| 查看次数: |
4728 次 |
| 最近记录: |