因此,我正在尝试对密钥库进行身份验证:

import * as msRestAzure from 'ms-rest-azure';
msRestAzure.loginWithServicePrincipalSecret(clientID, clientKey, domainID);


如何将资源指定为“ https://vault.azure.net”?

最佳答案

您可以使用msRestAzure.loginWithAppServiceMSImsRestAzure.loginWithAppServiceMSI({resource: 'https://vault.azure.net'});

您可以检查此link

function getKeyVaultCredentials(){
    return msRestAzure.loginWithAppServiceMSI({resource: 'https://vault.azure.net'});
}

function getKeyVaultSecret(credentials) {
    let keyVaultClient = new KeyVault.KeyVaultClient(credentials);
    return keyVaultClient.getSecret(KEY_VAULT_URI, 'secret', "");
}

getKeyVaultCredentials().then(
    getKeyVaultSecret
).then(function (secret){
    console.log(`Your secret value is: ${secret.value}.`);
}).catch(function (err) {
    throw (err);
});

关于node.js - 在ms-rest-azure中,当我尝试获取身份验证 token 时,如何指定资源?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/48653488/

10-10 11:36