ms-rest-azure loginWithAppServiceMSI returning invalid token response
I am using this package in an azure function app, executing on a timer multiple times a day and out of the blue on 9/23/21 two of my three deployed environments started to throw
Error: Invalid token response, did not find tokenType
when trying to get a token to access keyvault
const msRestAzure = require('ms-rest-azure');
creds = await msRestAzure.loginWithAppServiceMSI({resource: 'https://vault.azure.net'});
we are on an older package version, currently using 2.5.9 but the mystery is why the issue only appeared in select environments. As a mitigation, I created keyvault references in the function app to retrieve my keys I need. But I'm at a loss for what would have caused the sudden loss of functionality.
The last code change to all environments was a year ago and everything has been executing without issue for that time, and our sandbox environment is still running without experiencing any issues.
Are there any suggestions for things to try or where I could look for additional information?
@sadasant Could you help to take a look at this ms-rest-azure loginWithAppServiceMSI issue ? Thanks
@qiaozha I can try!
@jsuhoversnik Hello, hello! I’ll be doing my best to help you.
I believe the error thrown comes from this location in the code: https://github.com/Azure/ms-rest-nodeauth/blob/684d9825afe25fc907e8d163d19c0996702d0a70/lib/credentials/msiAppServiceTokenCredentials.ts#L126
If so, the message should have printed a more complete error after Error: Invalid token response, did not find tokenType. We might find relevant information about what might have happened in the remaining section.
My current theory is that this was a temporary service issue. Has this continued to happen?