Skip to content
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

Add --allow-custom-scopes flag to skip scope validation. #369

Merged
merged 5 commits into from
Mar 5, 2024

Conversation

Haard30
Copy link
Contributor

@Haard30 Haard30 commented Mar 4, 2024

This PR adds a --allow-custom-scopes flag to skip scope validation for PAT. This allows addition undocumented ADO scopes.

Testing:

  1. PAT with just 1 invalid scope.
    Earlier
    image

With --allow-custom-scopes flag

image

microsoft-authentication-cli\dist on  user/haashah/add-no-validate-flag [!]
❯ .\azureauth.exe ado pat  --organization "office" --scope "lolwut" --display-name "Test PAT" --prompt-hint "Creating custom PAT test" --allow-custom-scopes
Skipping scopes validation.
<pat>
  1. PAT with 1 known and 1 invalid scope
❯ .\azureauth.exe ado pat  --organization "office" --scope "lolwut" --scope "vso.code" --display-name "Test PAT 2" --prompt-hint "Creating PAT for testing" --allow-custom-scopes
Skipping scopes validation.
One or more errors occurred. (Failed to create PAT: InvalidScope)
An unexpected error ocurred. Re-run with --verbosity=debug for more info.
  1. PAT with valid known ADO scope and valid unknown ADO scope.
❯ .\azureauth.exe ado pat  --organization "office" --scope "vso.governance" --scope "vso.code" --display-name "Non-public valid scope" --prompt-hint "Creating PAT for testing" --allow-custom-scopes
Skipping scopes validation.
<pat>
  1. Without --allow-custom-scopes flag
❯  .\azureauth.exe ado pat  --organization "office" --scope "vso.governance" --scope "vso.code" --display-name "Non-public valid scope" --prompt-hint "Creating PAT for testing"
vso.governance is not a known Azure DevOps PAT scope.
Consult https://aka.ms/azure-devops-pat-scopes for a list of known scopes.
Use --allow-custom-scopes to create a PAT with custom scopes.

@Haard30 Haard30 marked this pull request as ready for review March 4, 2024 23:55
@Haard30 Haard30 requested a review from a team as a code owner March 4, 2024 23:55
mvanchaa
mvanchaa previously approved these changes Mar 5, 2024
mijpeterson
mijpeterson previously approved these changes Mar 5, 2024
@reillysiemens
Copy link
Member

Consider renaming this option to --allow-custom-scopes as that might be a little bit more self-explanatory.

@Haard30 Haard30 changed the title Add --no-validate flag to skip scope validation. Add --allow-custom-scopes flag to skip scope validation. Mar 5, 2024
@Haard30 Haard30 dismissed stale reviews from mijpeterson and mvanchaa via 909fa37 March 5, 2024 00:45
shalinikhare27
shalinikhare27 previously approved these changes Mar 5, 2024
reillysiemens
reillysiemens previously approved these changes Mar 5, 2024
@Haard30 Haard30 merged commit 27d88ac into main Mar 5, 2024
11 checks passed
@Haard30 Haard30 deleted the user/haashah/add-no-validate-flag branch March 5, 2024 18:01
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.

6 participants