gpt4 book ai didi

node.js - 错误:InvalidAuthenticationTokenTenant' The access token is from the wrong issuer

转载 作者:太空宇宙 更新时间:2023-11-04 03:30:02 25 4
gpt4 key购买 nike

我正在使用 Node js 向 Azure AD 进行身份验证以创建数据湖存储帐户,它可以登录,但对于帐户创建,它会给出错误:代码:'InvalidAuthenticationTokenTenant', 消息:“访问 token 来自错误的颁发者”https://sts.windows.n等”。它必须与租户\' https://sts.windows.net/ 匹配\' 与此子项关联脚本。

var msRestAzure = require('ms-rest-azure');
var adlsManagement = require("azure-arm-datalake-store");

msRestAzure.interactiveLogin(function(err, credentials) {

var accountName = 'testadlsacct';
var pathToEnumerate = '/myfolder';
var acccountClient = new adlsManagement.DataLakeStoreAccountClient(credentials, 'dxxxxxxx-dxxx-4xxx-bxxx-5xxxxxxxxx');
var filesystemClient = new adlsManagement.DataLakeStoreFileSystemClient(credentials);

var util = require('util');
var resourceGroupName = 'testrg';
var accountName = 'testadlsacct';
var location = 'eastus2';


var accountToCreate = {
tags: {
testtag1: 'testvalue1',
testtag2: 'testvalue2'
},
name: accountName,
location: location
};
var client= new adlsManagement.DataLakeStoreAccountClient(credentials, 'dxxxxxxxx-xxx-xxxx--xxxxxx');
client.account.create(resourceGroupName, accountName, accountToCreate, function (err, result, request, response)
//other code here
});

最佳答案

看看how ms-rest-azure's msRestAzure.interactiveLogin function is written ,似乎有一个“域”或租户参数,如果您是多个 Azure Active Directory(租户)的成员,则可以传递该参数。

您应该传入与您的订阅关联的租户。这应该在您收到的完整的当前错误消息中提供给您。租户可能类似于“contoso.com”、“contoso.onmicrosoft.com”,也可能是 GUID。

这通过明确提及应使用哪个目录来消除您的身份验证调用的歧义。

希望这会有所帮助!

关于node.js - 错误:InvalidAuthenticationTokenTenant' The access token is from the wrong issuer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39367820/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com