Support Managed Identity login for self-hosted runner#336
Closed
Support Managed Identity login for self-hosted runner#336
Conversation
YanaXu
reviewed
Jun 9, 2023
YanaXu
reviewed
Jul 4, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR is going to support both system- and user- assigned managed identity login for self-hosted runners on Azure VM.
What's new
auth-typewith value list[SERVICE_PRINCIPAL, IDENTITY]to identify the type of authentication.auth-type: SERVICE_PRINCIPALwithclientId,tenantIdandclientSecretdetected in your input, we will attempt to login by using service principal with the secret.auth-type: SERVICE_PRINCIPALwithclientIdandtenantIddetected in your input, we will attempt to login by using OIDC.auth-type: IDENTITYwithclientIddetected in your input, we will attempt to login by using user-assigned managed identity.auth-type: IDENTITYwithoutclientIddetected in your input, we will attempt to login by using system-assigned managed identity.In order not to introduce breaking change, we set the default value of
auth-typeto beSERVICE_PRINCIPAL.About the parameter
subscription-idThis parameter used to be mandatory if
allow-no-subscriptionsis not enabled in previous version:login/src/common/LoginConfig.ts
Lines 79 to 81 in bed9773
However, the two parameters are not relevant.
allow-no-subscriptionsis used to login tenant-level account andsubscription-idis used to specify which subscription to work. Not specifying a subscription should be allowed, then the Action will use the current, active subscription. Hence the limitation is removed in this version with only warning being reported:login/src/Cli/AzureCliLogin.ts
Lines 178 to 184 in 19aba32
About reading
credsfrom JsonThe items in
credswill not overwrite the individual parametersclient-id,tenant-idandsubscription-id, but as supplementary.In the previous code,
credsis not compatible with individual parameters. We usecredsfor login using service principal with secret and individual parameters forOIDClogin:login/src/main.ts
Lines 78 to 93 in 990b22f
In the new version, we aim to fetch the user's input credentials as much as possible:
login/src/common/LoginConfig.ts
Lines 35 to 42 in b3bc91b
The changes for README.md is in Update README.md for Managed identity #344.