Skip to content

Fix my FIC CLI - #1508

Merged
mishrarish merged 9 commits into
Azure:masterfrom
igortsoi:igortsoi/fix-my-fic-azcli-extension
Oct 8, 2026
Merged

mishrarish merged 9 commits into
Azure:masterfrom
igortsoi:igortsoi/fix-my-fic-azcli-extension

Conversation

@igortsoi

@igortsoi Igor Tsoi (igortsoi) commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Adds az devops service-endpoint convert --azdo-subject "sc:////" to migrate Azure DevOps service connections to external federated credentials.

The command derives the organization URL from the subject, authenticates using the existing Azure CLI login, invokes the migration API, and reports the result or error. Includes command help and unit tests.

  • : This PR has a corresponding issue open in the Repository.
  • : Approach is signed off on the issue.

@igortsoi

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Commenter does not have sufficient privileges for PR 1508 in repo Azure/azure-devops-cli-extension

@igortsoi

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Commenter does not have sufficient privileges for PR 1508 in repo Azure/azure-devops-cli-extension

},
data=json.dumps({'serviceConnectionInput': azdo_subject}),
timeout=30
)

@bhaveshbhati Bhavesh Bhati (bhaveshbhati) Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the experience in the cli if someone runs this on a service connection which is already migrated.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CLI does not check whether the service connection is already migrated. It sends the migration request to Azure DevOps every time.

If the API returns success, the CLI prints its JSON response.
If the API returns a non-success status, the CLI raises Migration request failed (): .

logger.debug("Derived organization URL from --azdo-subject: %s", origin)
elif detect:
# Only use resolve_instance when auto-detection from git config is requested
origin = resolve_instance(detect=detect, organization=origin)

@bhaveshbhati Bhavesh Bhati (bhaveshbhati) Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should never go into elif branch here, right? It should be an error scenario here, if the intention is to get the org name from the service connection string.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is reachable when someone explicitly passes --detect true. That asks the CLI to resolve the organization from configuration or Git instead of deriving it from the subject.

It isn’t inherently an error. Resolution can fail if no valid organization is found.

Comment thread azure-devops/azext_devops/dev/team/service_endpoint.py
help="Federated credential subject of the Azure DevOps issuer, in "
"'sc://<organization>/<project>/<serviceConnectionName>' format. "
"The organization URL is derived from --azdo-subject when --organization is not provided.")
context.argument('origin',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on recent security incidents, it has been told to avoid such passing of non-trusted origins.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@triptijain2112

Copy link
Copy Markdown
Collaborator

Igor Tsoi (@igortsoi) Please update PR description with the changes done.

Comment thread azure-devops/azext_devops/dev/team/service_endpoint.py
Comment thread azure-devops/azext_devops/dev/team/service_endpoint.py Outdated
Comment thread azure-devops/azext_devops/dev/team/service_endpoint.py
Add sanitized migration acceptance and error recordings with CLI playback scenarios, update service endpoint unit tests, and document recording and replay requirements.
Comment thread azure-devops/azext_devops/dev/team/service_endpoint.py Outdated
Translate timeout, proxy, TLS, and connection failures into actionable CLI errors without retrying migration requests. Add focused transport-error and exception propagation tests.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mishrarish
mishrarish merged commit 50c66d9 into Azure:master Oct 8, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants