Refresh GitHub App installation token before pushing to azure-sdk-for-net#10737
Merged
Conversation
Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/976a4f83-a1bd-415f-be94-7cef61cd4f69 Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix authentication issue causing git push failure
Refresh GitHub App installation token before pushing to azure-sdk-for-net
May 19, 2026
Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/9410e129-7681-41bf-886a-3d9f44856866 Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
commit: |
Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/6d407921-0181-48ea-92a4-e092bb0a3e5a Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/9c22b003-fc98-43a7-9d71-358418d8c3ed Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/3afb1f37-38bd-4b31-90b1-d527752293ae Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
jsquire
reviewed
May 20, 2026
jsquire
approved these changes
May 20, 2026
Member
jsquire
left a comment
There was a problem hiding this comment.
per offline conversation, this runs in a trusted DevOps environment and only on merge commits to main - which would have already passed team review and been evaluated for malicious intent. No concerns.
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.
Submit-AzureSdkForNetPr.ps1fails atgit pushwithInvalid username or token. Password authentication is not supported for Git operations.after regenerating Azure data-plane / mgmt libraries.#10710 fixed the URL scheme (
x-access-token:<token>) but didn't address token lifetime: theCreatePRjob mints a GitHub App installation token once up front, thenSubmit-AzureSdkForNetPr.ps1regenerates SDKs (118 files / 6353 insertions in the failing run) before pushing. Installation tokens expire after 1 hour, so the regen routinely outlives the token.Changes
Submit-AzureSdkForNetPr.ps1— Immediately beforegit push, invokeeng/common/scripts/login-to-github.ps1to mint a fresh installation token, then use it for both the push URL and (via$env:GH_TOKEN)gh pr create. The login script is invoked with the same params as thelogin-to-github.ymltemplate atpublish.yml#L221(-InstallationTokenOwners 'Azure' -VariableNamePrefix 'GH_TOKEN'). Existence of the refreshed token is checked viaTest-Path Env:GH_TOKENto avoid dereferencing the value. Falls back to the original$AuthTokenwith a warning when the login script is unavailable or fails (e.g., local/manual runs with a classic PAT).packages/http-client-csharp/eng/pipeline/publish.yml— Switch the step that runsSubmit-AzureSdkForNetPr.ps1fromPowerShell@2toAzureCLI@2(withazureSubscription: "AzureSDKEngKeyVault Secrets", the same subscriptionlogin-to-github.ymluses). TheazCLI auth from the upstreamAzureCLI@2-basedlogin-to-github.ymlstep does not persist into the next task, so the in-script call tologin-to-github.ps1previously failed to sign the JWT with Key Vault (ERROR: Please run 'az login' to setup account.). Running the script underAzureCLI@2gives it theazauth context it needs to mint a fresh installation token mid-run.