Giter Site home page Giter Site logo

azure-sdk-for-js-keyvault-secret-get-set-managedid's Issues

Error: credentials must be one of: ApplicationTokenCredentials, UserTokenCredentials, DeviceTokenCredentials, MSITokenCredentials

I am following this sample code to get secret key from the azure key-vault using Azure function but I am getting this error message.
The msRestAzure.loginWithAppServiceMSI return value of type MSIAppServiceTokenCredentials and when it call client.getSecret(vaultUri, secretName, secretVersion), I am getting the error message.
Node module I am using:
"azure-keyvault": "^3.0.4",
"ms-rest-azure": "^3.0.0",

Here is the code:
return msRestAzure.loginWithAppServiceMSI({resource: 'https://vault.azure.net'})
.then((credentials) => {
const client = new KeyVault.KeyVaultClient(credentials);
return client.getSecret(vaultUri, secretName, secretVersion)
.then((result) => {
return result;
})
});

The response from the msRestAzure.loginWithAppServiceMSI
MSIAppServiceTokenCredentials {
resource: 'https://vault.azure.net',
msiEndpoint: 'http://179.16.0.6:8081/msi/token',
msiSecret: 'ABDAERDF-10ab-4fa0-8cd7-8f829dbc1fb5',
msiApiVersion: '2017-09-01'
}

Error message from client.getSecret(vaultUri, secretName, secretVersion)
2019-08-12T18:29:49.667689275Z: [INFO] Error: credentials must be one of: ApplicationTokenCredentials, UserTokenCredentials, DeviceTokenCredentials, MSITokenCredentials
2019-08-12T18:29:49.668238579Z: [INFO] �[40m�[32minfo�[39m�[22m�[49m: Host.Function.Console[0]
2019-08-12T18:29:49.668250979Z: [INFO] at KeyVaultCredentials.authenticator (/home/site/wwwroot/node_modules/azure-keyvault/node_modules/ms-rest-azure/lib/credentials/keyVaultCredentials.js:63:16)
2019-08-12T18:29:49.668255379Z: [INFO] �[40m�[32minfo�[39m�[22m�[49m: Host.Function.Console[0]
2019-08-12T18:29:49.668259179Z: [INFO] at KeyVaultCredentials.handleUnauthorized (/home/site/wwwroot/node_modules/azure-keyvault/node_modules/ms-rest-azure/lib/credentials/keyVaultCredentials.js:175:15)
2019-08-12T18:29:49.668263079Z: [INFO] �[40m�[32minfo�[39m�[22m�[49m: Host.Function.Console[0]
2019-08-12T18:29:49.668266779Z: [INFO] at nextHandler (/home/site/wwwroot/node_modules/azure-keyvault/node_modules/ms-rest-azure/lib/credentials/keyVaultCredentials.js:118:19)
2019-08-12T18:29:49.669685690Z: [INFO] �[40m�[32minfo�[39m�[22m�[49m: Host.Function.Console[0]
2019-08-12T18:29:49.669700290Z: [INFO] at Request.defaultRequest [as _callback] (/home/site/wwwroot/node_modules/ms-rest/lib/requestPipeline.js:125:16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.