Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OidcClient.getCall failing in self-hosted Runners. #477

Closed
Powertrain opened this issue Jul 25, 2024 · 7 comments
Closed

OidcClient.getCall failing in self-hosted Runners. #477

Powertrain opened this issue Jul 25, 2024 · 7 comments
Assignees
Labels
needs-author-feedback More information is needed from author to address the issue. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@Powertrain
Copy link

Powertrain commented Jul 25, 2024

https://github.com/Azure/login/blob/6c251865b4e6290e7b78be643ea2d005bc51f69a/lib/main/index.js#L565C40-L565C50

Environments

  • GHES 3.11.5 in an Azure VM along with,
  • a self-hosted runner in an Azure VM with the software provided by the GHES instance.

Issue:

  • when used on a self-hosted runner, the job is unable to access the id-token variable's permissions. id-token has been set to both Write and Write-All in many iterations of the job to no success. Please make sure to give write permissions to id-token in the workflow.
  • the azure/login v2.1.1 action fails at line 570, the try-catch sends back Login failed with Error: Error message: Cannot read properties of undefined (reading 'message'). Double check if the 'auth-type' is correct. Refer to https://github.com/Azure/login#readme for more information.
  • the OIDC token URL appears to be generated , but
  • it fails at line 565: const id_token = yield OidcClient.getCall(id_token_url);

Is this a failure on the runner side, or a federated credential issue on the other end?

Thanks for any assistance.

@YanaXu YanaXu self-assigned this Jul 25, 2024
@YanaXu
Copy link
Collaborator

YanaXu commented Jul 25, 2024

Hi @Powertrain , please try the steps in #283 (comment).

@YanaXu YanaXu added needs-author-feedback More information is needed from author to address the issue. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jul 25, 2024
@Powertrain
Copy link
Author

Powertrain commented Aug 2, 2024

@YanaXu Thanks for the response!

Following the advice from #283

  • Both endpoints are available from the internet.
  • They are available when using a curl - v command from the runner machine.

However this still results in a failed run with the following information:

  • The id_token_url (Line 559) variable , when visited via a browser from my machine, or curl -v from the gitRunner machine is always the same response: The user 'System:PublicAccess;aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' is not authorized to access this resource.

@YanaXu
Copy link
Collaborator

YanaXu commented Aug 7, 2024

Hi @Powertrain, could you raise your question to this repo: https://github.com/actions/toolkit ?
This is the GitHub Action toolkit repo which Azure Login Action depends on.

@Powertrain
Copy link
Author

Powertrain commented Aug 8, 2024

@YanaXu

https://github.com/Azure/login/blob/v2.1.1/lib/main/index.js

Line: 545-546

Both ${error.statusCode} & ${error.result.message} are null. This causes the action to give a result of Error message: Cannot read properties of undefined (reading 'message')..

After branching my own version and changing the the output to Error Code : ${error} gives me an output:

Error: unable to verify the first certificate

Thanks for any assistance going forward.

@Powertrain
Copy link
Author

@YanaXu

https://github.com/Azure/login/blob/v2.1.1/lib/main/index.js

I am running into further issues with v2.1.1

Line: 4004 yield this.executeAzCliCommand(["--version"], true, execOptions); fails over and over again, The process '/usr/local/bin/az' failed with exit code 1.

When the line is commented out, the subsequent executeAzCliCommand commands will Successfully set the Azure environment.

Would you recommend swapping the version of Azure/Login I am using?

@YanaXu
Copy link
Collaborator

YanaXu commented Aug 12, 2024

@YanaXu

https://github.com/Azure/login/blob/v2.1.1/lib/main/index.js

I am running into further issues with v2.1.1

Line: 4004 yield this.executeAzCliCommand(["--version"], true, execOptions); fails over and over again, The process '/usr/local/bin/az' failed with exit code 1.

When the line is commented out, the subsequent executeAzCliCommand commands will Successfully set the Azure environment.

Would you recommend swapping the version of Azure/Login I am using?

@Powertrain could you run az --version --debug directly on your VM and send us the result?

@Powertrain
Copy link
Author

Powertrain commented Aug 12, 2024

@YanaXu

Thanks for the response!

Upgrading from azure-cli2.39 to azure-cli2.63 will run action/[email protected] again once complete.

@YanaXu YanaXu closed this as completed Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-author-feedback More information is needed from author to address the issue. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

2 participants