访问令牌来自错误的发行者“ https://sts.windows.net”

时间:2019-05-29 09:47:40

标签: azure electron azure-resource-manager

我正在使用'azure-arm-resource'获取我的node js项目中所有的azure资源。

https://www.npmjs.com/package/azure-arm-resource

但是使用这个我会遇到一些错误,

 msRestAzure.interactiveLogin().then(credentials => {
  const azureResources = new resourceManagement.ResourceManagementClient(credentials, subscriptionId);

  azureResources.resources
    .list()
    .then(res => {
      if (filter) {
        return res.filter(r => r.kind === filter);
      } else {
        return res;
      }
    })
    .then(d => {
      console.log('Done Resources');
    });
});
console.log('Pulling...');
 }

错误

 Uncaught (in promise) Error: The access token is from the wrong issuer 
'https://sts.windows.net/xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx/'.
 It must match the tenant 'https://sts.windows.net/xxxx-xxx-xxxx-xxxx- 
 c3xxx4xxffd57xx7/' 
 associated with this subscription. Please use the authority (URL) 
 'https://login.windows.net/xxxx-xxxx-xxx-xxxx-xxxxxxxx' to get the token. 
  Note, if the subscription is transferred to another tenant there is no 
 impact to the services, but information about new tenant could take time to 
  propagate (up to an hour). If you just transferred your subscription and  
  this error message, please try back later.

Azure交互式登录中未定义的设备令牌凭证

2 个答案:

答案 0 :(得分:0)

这意味着订阅不属于您登录所使用的帐户的租户。

确保您登录时使用的帐户可以访问所使用的订阅。

答案 1 :(得分:0)

当您在门户网站上登录时,使用组织ID something@yourcompany-name.com时,它可以工作,但是当使用实时IDsomething@gmail.com时,我们需要传递TenantId。

主要目的是使用户易于登录。因此,我们从最小的必需参数开始。对于InteractiveLogin(),我认为它为零。但这是不正确的。使用liveID时必须提供TenantId或域。