-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error retrieving MSI token from Function App #4631
Comments
It seems like the issue is that the regex is not taking AM/PM into account. Looking at the Managed Identities Overview documentation, the date format is:
|
Is there any workaround as of now for this? |
We've switched to using https://azure.github.io/azure-sdk-for-js/identity/classes/environmentcredential.html for now until this gets fixed. |
@kayone - Unfortunately, this wouldn't work for me since I am working in an Azure Function. My Azure Function's identity has access to a keyvault which is why I wanted to use this. If I have to store one secret to access another, what's the point. |
@saikrishnav we are using a function as wel. we use this as a fall back rather than a workaround. This way once it gets fixed we don't have to change all the code for getting secrets out, we just switch the auth provider and remove the environment variables. |
@kayone - I understand your point. Just trying to see if its possible to fix this directly. |
@saikrishnav We've gotten around this by referencing keyvault secrets at deployment time. In my ARM template, I'm pulling secrets from keyvault and just setting them as environment variables. Doing this means we don't need this library at all. Documentation can be found here: https://docs.microsoft.com/en-us/azure/app-service/app-service-key-vault-references |
We recently landed a fix that should help with this case (#5144), which should allow more date formats to be accepted. This fix will be part of the next release. |
Hey folks, has anyone had a chance to verify whether @jonathandturner's fix worked when using this credential in a Function App? Thanks! |
@daviwil
|
@ahmedspiir Have you updated to version |
My apologies, this was fixed after |
Hi all, the fix for this issue is included in Closing this issue in the meantime, but I'll be happy to reopen it should anyone reproduce the issue after installing the aforementioned update. |
Describe the bug
Error parsing the date/token returned from a Managed Identify installed on an Azure Function app running on a consumption plan.
To Reproduce
const credential = new DefaultAzureCredential(); client = new SecretsClient(vaultUri, credential); let secret = client.getSecret('secret');
Expected behavior
Should return the secret. It doesn't. It throws an error.
Additional context
Looking at the code, it appears that the date parsing isn't working. Initially this was in the identityClient code, (where the error has originally manifested from) however appears to have now been refactored here (currently).
https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/src/credentials/managedIdentityCredential.ts
Specifically, these lines
The text was updated successfully, but these errors were encountered: