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

feat: fallback to using the Azure CLI #11

Merged
merged 2 commits into from
Nov 10, 2024
Merged

feat: fallback to using the Azure CLI #11

merged 2 commits into from
Nov 10, 2024

Conversation

johnnyreilly
Copy link
Owner

@johnnyreilly johnnyreilly commented Nov 10, 2024

PR Checklist

Overview

Falls back to using the AZ CLI with execa if the initial attempt fails. Based upon https://github.com/jongio/azure-cli-awesome/blob/main/create-devops-pat.azcli

Output looks like this:

┌  📦🔑 Welcome to ado-npm-auth-lite 0.5.0! 📦🔑
│
│
●  options:
│  - pat: [NONE SUPPLIED - WILL ACQUIRE FROM AZURE API]
│  - config: ./ignore/.npmrc
│  - email: [NONE SUPPLIED - WILL USE DEFAULT]
│
│
●  Loading .npmrc at: /home/john/code/github/ado-npm-auth-lite/ignore/.npmrc
│
●  Parsed: 
│  - organisation: johnnyreilly
│  - urlWithoutRegistryAtStart: //pkgs.dev.azure.com/johnnyreilly/_packaging/npmrc-script-organization/npm/registry/
│  - urlWithoutRegistryAtEnd: //pkgs.dev.azure.com/johnnyreilly/_packaging/npmrc-script-organization/npm/
◇  ✅ Passed parsing project .npmrc.
│
│
●  Creating Azure CLI Token
◓  Creating Personal Access Token..│
●  Creating Personal Access Token with API: {
│    "displayName": "made by ado-npm-auth-lite at: 2024-11-10T17:41:11.033Z",
│    "scope": "vso.packaging",
│    "validTo": "2024-12-10T17:41:11.033Z",
│    "allOrgs": false
│  }
◓  Creating Personal Access Token...│
■  Error creating Personal Access Token with API: HTTP error! status: 401 - {"$id":"1","innerException":null,"message":"TF401444: Please sign-in at least once as Windows Live ID\\johnny_reilly@hotmail.com in a web browser to enable access to the service.","typeName":"Microsoft.TeamFoundation.Framework.Server.UnauthorizedRequestException, Microsoft.TeamFoundation.Framework.Server","typeKey":"UnauthorizedRequestException","errorCode":0,"eventId":3000}
│
●  Will re-attempt with Azure CLI
│
●  Creating Personal Access Token with Azure CLI: {
│    "displayName": "made by ado-npm-auth-lite at: 2024-11-10T17:41:11.033Z",
│    "scope": "vso.packaging",
│    "validTo": "2024-12-10T17:41:11.033Z",
│    "allOrgs": false
│  }
◒  Creating Personal Access Token.│
●  Created Personal Access Token with Azure CLI
◇  ✅ Passed creating Personal Access Token.
│
◇  ✅ Passed constructing user .npmrc.
│
│
●  Writing users .npmrc to: /home/john/.npmrc
◇  ✅ Passed writing user .npmrc.
│
└  📦🔑 Thanks for using ado-npm-auth-lite 0.5.0! 📦🔑

@johnnyreilly johnnyreilly merged commit 1e10db2 into main Nov 10, 2024
8 checks passed
@johnnyreilly johnnyreilly deleted the fallback branch November 10, 2024 17:44
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.

🚀 Feature: fallback to using the Azure CLI if API call fails
1 participant