所以我正在尝试对keyvault进行身份验证:
import * as msRestAzure from 'ms-rest-azure';
msRestAzure.loginWithServicePrincipalSecret(clientID, clientKey, domainID);
如何将资源指定为“https://vault.azure.net”?
答案 0 :(得分:0)
您可以使用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);
});