-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Sdk generation agent auth changes #40598
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
Merged
Merged
Changes from 22 commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
02b435c
Set Github actions env in sandbox to use workload identity auth
praveenkuttappan 9655685
Update manual dispatch inputs
praveenkuttappan 5e86029
Manual troubleshooting changes
praveenkuttappan a691ba5
Add github action env variable in sandbox
praveenkuttappan ecd7831
Add a step to verify token file
praveenkuttappan 3107394
network access changes
praveenkuttappan 93429f5
network access changes2
praveenkuttappan a4d2ae2
Add auth step inside sandbox
praveenkuttappan a080306
Additional network permission
praveenkuttappan 86c44d4
SDK generation agent with imports
praveenkuttappan f513048
Add default issue url for debug
praveenkuttappan f15aa81
Renamed yml
praveenkuttappan 9520a26
Reduce common import
praveenkuttappan f43a25b
Rename file
praveenkuttappan 0d31edd
Fix missing filename issue
praveenkuttappan 398f5f6
Add Azure login in workflow
praveenkuttappan 262a92f
Add Azure login in workflow
praveenkuttappan f637fb4
Rebuild workflow
praveenkuttappan 5ac9630
Force regenerate agent workflow
praveenkuttappan e2ac9e2
gh-aw rebuild
praveenkuttappan 83fe08b
gh-aw rebuild with gh token
praveenkuttappan 328de84
Remove debug lines
praveenkuttappan 671723e
Merge branch 'main' into sdk_generation_agent_auth_changes
praveenkuttappan 2cca95a
Update to load copilot token from keyvault
praveenkuttappan e76c225
Update to remove test changes to remove reference to kv
praveenkuttappan abfa283
Add azsdk into path and create a sahred import for azsdk install
praveenkuttappan 4787d60
Remove debug changes
praveenkuttappan fdccafc
Add a step to set repo secret from kv
praveenkuttappan 8e7e9a0
Add step to install gh aw cli
praveenkuttappan bfcc338
Checkout repo before auth step
praveenkuttappan 4b625c3
Reduce to use only one pat
praveenkuttappan bc13235
Revert to use the PAT
praveenkuttappan b9585ea
Use two PATs for agent workflow
praveenkuttappan 831bce8
Merge branch 'main' into sdk_generation_agent_auth_changes
praveenkuttappan 8f85eb4
Remove debug PR link
praveenkuttappan 583bc86
Merge branch 'sdk_generation_agent_auth_changes' of https://github.co…
praveenkuttappan ab468d6
Merge branch 'main' into sdk_generation_agent_auth_changes
praveenkuttappan a513873
Merge branch 'main' into sdk_generation_agent_auth_changes
praveenkuttappan 109b151
Remove redundant az login from workflow
praveenkuttappan 7af5006
Merge branch 'sdk_generation_agent_auth_changes' of https://github.co…
praveenkuttappan e3de0d0
Merge kv fetch and copilot token persist to one step
praveenkuttappan 4049948
Merge branch 'main' into sdk_generation_agent_auth_changes
praveenkuttappan 17acb5d
Merge branch 'main' into sdk_generation_agent_auth_changes
praveenkuttappan a846272
Merge branch 'main' into sdk_generation_agent_auth_changes
praveenkuttappan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| paths: | ||
| .github/workflows/*.lock.yaml: | ||
| .github/workflows/*.lock.yml: | ||
| ignore: | ||
| - ".+" | ||
77 changes: 38 additions & 39 deletions
77
.../workflows/sdk-generation-agent.lock.yaml → ...b/workflows/sdk-generation-agent.lock.yml
Large diffs are not rendered by default.
Oops, something went wrong.
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
67 changes: 67 additions & 0 deletions
67
.github/workflows/shared-github-aw-imports/global_networks_auth_import.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| --- | ||
timovv marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # No `on:` here — this is a shared component meant to be imported. | ||
| description: Steps to generate OIDC token and authenticate GitHub agent workflow | ||
| network: | ||
| allowed: | ||
| - defaults | ||
| - "login.microsoftonline.com" | ||
| - "dev.azure.com" | ||
| - "*.dev.azure.com" | ||
| - "*.applicationinsights.azure.com" | ||
| - "*.visualstudio.com" | ||
| - "management.azure.com" | ||
| steps: | ||
| - name: Acquire OIDC token for Azure | ||
| id: oidc | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const token = await core.getIDToken('api://AzureADTokenExchange'); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand why you did this, but I don't like us putting this into a file but for now until we have a better option we can use this for testing. |
||
| const fs = require('fs'); | ||
| fs.writeFileSync('/tmp/azure-oidc-token', token); | ||
|
|
||
| - name: Verify Azure CLI authentication | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| if ! command -v az >/dev/null 2>&1; then | ||
| echo "Azure CLI (az) is not installed on this runner." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [[ -z "${AZURE_CLIENT_ID:-}" || -z "${AZURE_TENANT_ID:-}" || -z "${AZURE_FEDERATED_TOKEN_FILE:-}" ]]; then | ||
| echo "Azure federated authentication variables are missing." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| FED_TOKEN=$(cat "$AZURE_FEDERATED_TOKEN_FILE") | ||
| if [[ -z "$FED_TOKEN" ]]; then | ||
| echo "Federated token file $AZURE_FEDERATED_TOKEN_FILE is empty." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Ensuring Azure CLI session is authenticated using workload identity..." | ||
| az login --service-principal \ | ||
| --username "$AZURE_CLIENT_ID" \ | ||
| --tenant "$AZURE_TENANT_ID" \ | ||
| --federated-token "$FED_TOKEN" \ | ||
| --allow-no-subscriptions >/tmp/az-login.json | ||
|
|
||
| if az account show --output json > /tmp/az-account.json 2>/tmp/az-account.err; then | ||
| echo "Azure CLI authentication verified. Active subscription (if any):" | ||
| jq -r '"- " + (.name // "No subscription") + " (" + (.id // "n/a") + ")"' /tmp/az-account.json || cat /tmp/az-account.json | ||
| else | ||
| echo "Unable to verify Azure CLI login status:" >&2 | ||
| cat /tmp/az-account.err >&2 || true | ||
| exit 1 | ||
| fi | ||
| --- | ||
|
|
||
| ## Workflow Behavior | ||
|
|
||
| Login using Azure CLI Login | ||
|
|
||
| - Run `mkdir -p /tmp/gh-aw/agent/.azure`. | ||
| - Set env variable AZURE_CONFIG_DIR=/tmp/gh-aw/agent/.azure | ||
| - Run `az login --service-principal --username $AZURE_CLIENT_ID --tenant $AZURE_TENANT_ID --federated-token $(cat /tmp/azure-oidc-token) --allow-no-subscriptions 2>&1` | ||
| - If authentication fails, call the `noop` safe output with the captured response (labelled `authentication_failed`) and stop further processing. | ||
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.