diff --git a/src/main.ts b/src/main.ts index 13ebea0c..41af5f09 100644 --- a/src/main.ts +++ b/src/main.ts @@ -95,7 +95,7 @@ async function main() { throw new Error("Credentials are not passed for Login action."); } } - //generic checks + //generic checks //servicePrincipalKey is only required in non-oidc scenario. if (!servicePrincipalId || !tenantId || !(servicePrincipalKey || enableOIDC)) { throw new Error("Not all values are present in the credentials. Ensure clientId, clientSecret and tenantId are supplied."); @@ -115,14 +115,15 @@ async function main() { let audience = core.getInput('audience', { required: false }); federatedToken = await core.getIDToken(audience); if (!!federatedToken) { - if (environment != "azurecloud") - throw new Error(`Your current environment - "${environment}" is not supported for OIDC login.`); let [issuer, subjectClaim] = await jwtParser(federatedToken); console.log("Federated token details: \n issuer - " + issuer + " \n subject claim - " + subjectClaim); } + else{ + throw new Error("Failed to fetch federated token."); + } } catch (error) { - core.error(`${error.message.split(':')[1]}. Please make sure to give write permissions to id-token in the workflow.`); + core.error(`${error}. Please make sure to give write permissions to id-token in the workflow.`); } }