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

[V2] Add OIDC Test, Cut V2.0.0 #331

Merged
merged 5 commits into from
Aug 14, 2023
Merged

Conversation

JenGoldstrich
Copy link
Contributor

@JenGoldstrich JenGoldstrich commented Aug 11, 2023

Successful run of test: https://github.com/hashicorp/packer-plugin-azure/actions/runs/5837275042/job/15832492979, I've now configured the service principal in Azure to run on main after testing it on this branch. Once we merge I will tag the squashed merge commit as v2.0.0

@JenGoldstrich JenGoldstrich requested a review from a team as a code owner August 11, 2023 21:34
@JenGoldstrich JenGoldstrich added the version/bump major A PR that breaks backwards compatibility. label Aug 11, 2023
@JenGoldstrich JenGoldstrich force-pushed the add-oidc-test-and-cut-v2 branch from 6322ae6 to c93b915 Compare August 11, 2023 21:56
@JenGoldstrich
Copy link
Contributor Author

Merging this without approval due to the test previously being approved, and it otherwise being a version bump.

@JenGoldstrich JenGoldstrich merged commit 2e2bab5 into main Aug 14, 2023
@JenGoldstrich JenGoldstrich deleted the add-oidc-test-and-cut-v2 branch August 14, 2023 15:15
@adyavanapalli
Copy link
Contributor

@JenGoldstrich Using your code for the GitHub workflow, I see that the request JWT has an expiration time in only 5 minutes:

client_jwt will expire within 5 minutes, please use a JWT that is valid for at least 5 minutes

How did you get around this issue and/or do you have any suggestions to rectify this issue?

@JenGoldstrich
Copy link
Contributor Author

hey @adyavanapalli I believe you're using a version of the Azure plugin before 2.0.0, prior to 2.0.0 there was a check in the code that would block builds where the client jwt was less than 5 minute away from expiry, the initial OIDC auth token however would always throw an error for this. Can you confirm the version of the Azure plugin you are using, and if you're experiencing this on versions greater than or equal to 2.0.0 open a new issue with the version of packer and the Azure plugin you are using

@adyavanapalli
Copy link
Contributor

Hey @JenGoldstrich, you were absolutely right. v2.0.0 and above fixes that issue. Thank you for the quick response 😄 !

@ibeerens
Copy link

Hi @JenGoldstrich , I read the post "https://www.hashicorp.com/blog/version-2-packer-azure-plugin-now-available". I use Packer with the latest Azure plugin and use the OIDC connection.

After approximately 50 minutes the following error occurs:

==> azure-arm.windows11-avd: autorest/Client#Do: Preparing request failed: StatusCode=0 -- Original Error: clientCredentialsToken: received HTTP status 401 with response: {"error":"invalid_client","error_description":"AADSTS700024: Client assertion is not within its valid time range. Current time: 2024-02-27T14:01:33.3967841Z, assertion valid from 2024-02-27T12:47:05.0000000Z, expiry time of assertion 2024-02-27T12:52:05.0000000Z. Review the documentation at https://docs.microsoft.com/azure/active-directory/develop/active-directory-certificate-credentials . Trace ID: b4e5b623-f000-4983-876c-85b424ac8e00 Correlation ID: 1b880267-c308-4c21-a6f6-085e62971c0d Timestamp: 2024-02-27 14:01:33Z","error_codes":[700024],"timestamp":"2024-02-27 14:01:33Z","trace_id":"b4e5b623-f000-4983-876c-85b424ac8e00","correlation_id":"1b880267-c308-4c21-a6f6-085e62971c0d","error_uri":"https://login.microsoftonline.com/error?code=700024"}

It looks like a token expiration problem. Do you know how you can solve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
version/bump major A PR that breaks backwards compatibility.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants