Repository navigation
Fix GitHub App Key Vault signing - #17271
Merged
mmitche merged 1 commit intoAug 6, 2026
Merged
Conversation
Use the Azure CLI exit code rather than treating non-fatal stderr warnings as command failures. Query the actual signature field and convert its standard Base64 representation to JWT-compatible Base64URL encoding. Co-authored-by: Copilot <[email protected]> Copilot-Session: 3eb6a0bd-11cc-4d7a-97ce-16e5d553f215
akoeplinger
approved these changes
Aug 6, 2026
missymessa
enabled auto-merge (squash)
August 6, 2026 19:29
akoeplinger
disabled auto-merge
August 6, 2026 19:30
akoeplinger
enabled auto-merge (squash)
August 6, 2026 19:30
This was referenced Aug 6, 2026
mmitche
reviewed
Aug 6, 2026
mmitche
approved these changes
Aug 6, 2026
mmitche
disabled auto-merge
August 6, 2026 19:41
Contributor
There was a problem hiding this comment.
Pull request overview
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Fixes GitHub App JWT signing via Azure Key Vault by avoiding failures from non-fatal Azure CLI stderr output and by correctly formatting the signature for JWT usage.
Changes:
- Determine
az keyvault key signsuccess using the process exit code rather than stderr handling. - Query the signature field directly from the Azure CLI output.
- Convert the returned signature from Base64 to Base64URL before composing the JWT.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| $digestBase64 = [Convert]::ToBase64String($digestBytes) | ||
|
|
||
| Write-Host "Signing JWT with key '$KeyName' in vault '$KeyVaultName'..." | ||
| $previousNativeCommandErrorPreference = $PSNativeCommandUseErrorActionPreference |
| $signatureUrl = az keyvault key sign ` | ||
| # Azure CLI can emit non-fatal Python warnings to stderr even when signing succeeds. | ||
| # Use the exit code to determine success for this invocation. | ||
| $PSNativeCommandUseErrorActionPreference = $false |
| if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($signatureUrl)) { | ||
| Write-PipelineTelemetryError -Category 'Build' -Message "'az keyvault key sign' exited with code $LASTEXITCODE for key '$KeyName' in vault '$KeyVaultName'. Verify the service connection identity has the 'Key Vault Crypto User' role (Sign action) on the key." | ||
| finally { | ||
| $PSNativeCommandUseErrorActionPreference = $previousNativeCommandErrorPreference |
| # Azure CLI can emit non-fatal Python warnings to stderr even when signing succeeds. | ||
| # Use the exit code to determine success for this invocation. | ||
| $PSNativeCommandUseErrorActionPreference = $false | ||
| $signatureBase64 = az keyvault key sign ` |
| --algorithm RS256 ` | ||
| --digest $digestBase64 ` | ||
| --query value ` | ||
| --query signature ` |
Comment on lines
+97
to
+98
| if ($signExitCode -ne 0 -or [string]::IsNullOrWhiteSpace($signatureBase64)) { | ||
| Write-PipelineTelemetryError -Category 'Build' -Message "'az keyvault key sign' exited with code $signExitCode for key '$KeyName' in vault '$KeyVaultName'. Verify the service connection identity has the 'Key Vault Crypto User' role (Sign action) on the key." |
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.
Summary
signaturefield returned byaz keyvault key signValidation
oneloc-localization-app-keywithout exposing signature materialdotnetinstallationgit diff --checkFixes the OneLocBuild failure observed in build 3041074.
Authored with GitHub Copilot CLI.