0

我正在尝试设置具有 azure 功能的服务,以便其他特殊应用程序注册可以调用它并具有读取任何内容的特殊访问权限。我才刚刚开始,所以我想我会让我的服务像这样简单地对自己进行身份验证:

var myAppId = "8d87ba47-3b51-4e24-a790-a966a0130ceb";
var authenticationContext = new AuthenticationContext(Settings.AadTenant, false);
var clientAssertionCertificate = new ClientAssertionCertificate(myAppId, ApplicationCertificate);
return authenticationContext.AcquireTokenAsync(myAppId, clientAssertionCertificate).Result.AccessToken;

当我运行它时,我收到以下错误:

Application '8d87ba47-3b51-4e24-a790-a966a0130ceb' is not assigned to a role for the application '8d87ba47-3b51-4e24-a790-a966a0130ceb'. 

我知道我已经把所有东西都连接好了,因为租户可以识别所有的 Id,所以问题可能出在我的 App Registration 的清单中。但我认为我已经正确设置了我的应用程序清单:

"appId": "8d87ba47-3b51-4e24-a790-a966a0130ceb",
"appRoles": [
    {
        "allowedMemberTypes": [ "Application" ],
        "description": "Some services can have global access",
        "displayName": "ProductivityService Auth",
        "id": "8d87ba47-3b51-4e24-a790-a966a0130ceb",
        "isEnabled": true,
        "value": "GlobalReadAccess"
    }
],

在这一点上,我不知道该怎么做。我不确定“value”参数中应该包含什么,但是我找不到有关“appRoles”中参数的任何详细信息,并且我找到的示例是针对授权用户的。我试过“Reader”和“Writer”,但结果相同。想法?

4

0 回答 0