This commit is contained in:
Balaga Gayatri 2021-11-01 17:16:12 +05:30
commit 5e589780d4
2 changed files with 6 additions and 4 deletions

View file

@ -27,7 +27,7 @@ inputs:
required: false
default: false
audience:
description: 'Provide audience field for access-token. Default value is 'api://AzureADTokenExchange' '
description: 'Provide audience field for access-token. Default value is api://AzureADTokenExchange '
required: false
default: 'api://AzureADTokenExchange'
branding:

View file

@ -61,7 +61,6 @@ function main() {
const allowNoSubscriptionsLogin = core.getInput('allow-no-subscriptions').toLowerCase() === "true";
//Check for the credentials in individual parameters in the workflow.
var servicePrincipalId = core.getInput('client-id', { required: false });
;
var servicePrincipalKey = null;
var tenantId = core.getInput('tenant-id', { required: false });
var subscriptionId = core.getInput('subscription-id', { required: false });
@ -103,7 +102,8 @@ function main() {
if (enableOIDC) {
console.log('Using OIDC authentication...');
//generating ID-token
federatedToken = yield core.getIDToken('api://AzureADTokenExchange');
let audience = core.getInput('audience', { required: false });
federatedToken = yield core.getIDToken(audience);
if (!!federatedToken) {
if (environment != "azurecloud")
throw new Error(`Your current environment - "${environment}" is not supported for OIDC login.`);
@ -111,6 +111,8 @@ function main() {
else {
throw new Error("Could not get ID token for authentication.");
}
let [issuer, subjectClaim] = yield jwtParser(federatedToken);
console.log("Federated token details: \n issuer- " + issuer + " \n subject claim - " + subjectClaim);
}
// Attempting Az cli login
if (environment == "azurestack") {
@ -199,7 +201,7 @@ function executeAzCliCommand(command, silent, execOptions = {}, args = []) {
yield exec.exec(`"${azPath}" ${command}`, args, execOptions);
}
catch (error) {
throw new Error(error);
core.error("Az-CLI" + error);
}
});
}