An Azure service that provides an event-driven serverless compute platform.
Getting wrong assertion issuer - sts.windows.net instead of login.microsoftonline.com
Devansh Agarwal
25
Reputation points
We had generated a token for a managed identity using the following code in Azure Function App -
const { ManagedIdentityCredential } = require('@azure/identity');
module.exports = async function (context, req) {
context.log('JavaScript HTTP trigger function processed a request.');
const clientId = req.query.clientId;
const resource = req.query.resource;
if (!clientId || !resource) {
context.res = {
status: 400,
body: "Please pass clientId and resource on the query string"
};
return;
}
try {
const credential = new ManagedIdentityCredential(clientId);
const tokenResponse = await credential.getToken(resource);
context.res = {
status: 200,
body: tokenResponse.token
};
} catch (error) {
context.res = {
status: 500,
body: `Error acquiring token: ${error.message}`
};
}
};
This managed identity is added as a federated credential in the App Registration. We use the token generated by the above code to make a call to the endpoint of the app registration ([https://login.microsoftonline.com/
Azure Functions
Azure Functions
Microsoft Security | Microsoft Entra | Other
Microsoft Security | Microsoft Entra | Other
Additional Microsoft Entra services and features related to identity, access, and network security
Locked Question. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.