Getting a key from KeyVault. UnhandledPromiseRejectionWarning: RestError: AKV10032: Invalid issuer. Expected one of ..
See original GitHub issue- Package Name: @azure/keyvault-secrets, @azure/identity"
- Package Version: ^4.1.0
- Operating system: MacOS
- nodejs
- version: 12.7.0
- browser
- name/version:
- [ x] typescript
- version: 3.8.2
- Is the bug related to documentation in
- README.md
- source code documentation
- SDK API docs on https://docs.microsoft.com
Describe the bug I was following the docs how to reading key-valut in NodeJs+TS https://docs.microsoft.com/en-gb/javascript/api/overview/azure/keyvault-keys-readme?view=azure-node-latest
After following the steps in create KV, assign SP, and access policy and running example I get an error. This one looks like Authentication problem. RestError: AKV10032: Invalid issuer. Expected one of … - found https://sts.windows.net/1ff9bcf8-6255-4717-b.../.
$: node index.js
(node:11788) UnhandledPromiseRejectionWarning: RestError: AKV10032: Invalid issuer. Expected one of https://sts.windows.net/72f988bf-86f1-.../, https://sts.windows.net/f8cdef31-a31e-4.../, https://sts.windows.net/e2d54eb5-3869-4.../, https://sts.windows.net/33e01921-4d.../, https://sts.windows.net/975f013f-7f24-47.../, found https://sts.windows.net/1ff9bcf8-6255-4717-b.../.
at new RestError (/~/nodejs-key-vault/node_modules/@azure/core-http/dist/index.js:2387:28)
at handleErrorResponse (/~/nodejs-key-vault/node_modules/@azure/core-http/dist/index.js:3238:17)
at /~/nodejs-key-vault/node_modules/@azure/core-http/dist/index.js:3177:18
at processTicksAndRejections (internal/process/task_queues.js:85:5)
(node:11788) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:11788) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior:
-
follow - https://docs.microsoft.com/en-gb/javascript/api/overview/azure/keyvault-keys-readme?view=azure-node-latest - ‘Getting a key’ section
-
run
const { DefaultAzureCredential } = require("@azure/identity");
const { KeyClient } = require("@azure/keyvault-keys");
const credential = new DefaultAzureCredential();
const vaultName = "<YOUR KEYVAULT NAME>";
const url = `https://${vaultName}.vault.azure.net`;
const client = new KeyClient(url, credential);
const keyName = "MyKeyName";
async function main() {
const latestKey = await client.getKey(keyName);
console.log(`Latest version of the key ${keyName}: `, latestKey);
const specificKey = await client.getKey(keyName, { version: latestKey.properties.version! });
console.log(`The key ${keyName} at the version ${latestKey.properties.version!}: `, specificKey);
}
main();
Expected behavior Login and display KV details
Screenshots If applicable, add screenshots to help explain your problem.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top GitHub Comments
yes, approach with ClientSecretCredential using:
worked well, thanks @sadasant
via CLI also I could get details
@shershen08 thank you for your response! Good luck on your project and keep in mind that you’re welcome here anytime 🌞