diff --git a/action.yml b/action.yml index 0cd2b373..79cc221b 100644 --- a/action.yml +++ b/action.yml @@ -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: diff --git a/lib/main.js b/lib/main.js index 498d6a24..311c1af2 100644 --- a/lib/main.js +++ b/lib/main.js @@ -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); } }); }