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

Improve auth CLI missing error #3349

Merged
merged 1 commit into from
Jun 13, 2024
Merged

Improve auth CLI missing error #3349

merged 1 commit into from
Jun 13, 2024

Conversation

danielrbradley
Copy link
Member

@danielrbradley danielrbradley commented Jun 13, 2024

Add context for why the CLI is expected and what operation is being attempted.

Fixes #3347

This will now print a message like:

Diagnostics:
  azure-native:features:SubscriptionFeatureRegistration (subscriptionFeatureRegistration):
    error: checking az cli version: could not find `az`: exec: "az": executable file not found in $PATH: MSI, OIDC, 
      client secret and client certificate authentication are not configured so we require the AZ CLI for authentication

Add context for why the CLI is expected and what operation is being attempted.

Fixes #3347
@danielrbradley danielrbradley requested a review from thomas11 June 13, 2024 08:33
@danielrbradley danielrbradley self-assigned this Jun 13, 2024
Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

Copy link

codecov bot commented Jun 13, 2024

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 56.82%. Comparing base (2c7da0a) to head (944884d).
Report is 1 commits behind head on master.

Files Patch % Lines
provider/pkg/provider/auth.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3349      +/-   ##
==========================================
- Coverage   56.82%   56.82%   -0.01%     
==========================================
  Files          66       66              
  Lines        8082     8083       +1     
==========================================
  Hits         4593     4593              
- Misses       3054     3055       +1     
  Partials      435      435              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@thomas11
Copy link
Contributor

The message is missing a period, semicolon or the like after $PATH. I know the linter says not to use full sentences in errors, but maybe we should here?

@danielrbradley
Copy link
Member Author

The message is missing a period, semicolon or the like after $PATH. I know the linter says not to use full sentences in errors, but maybe we should here?

Oh that was just me mocking up the diagnostics. It actually has a colon between. Updated the example.

@danielrbradley danielrbradley merged commit bb89e2d into master Jun 13, 2024
24 checks passed
@danielrbradley danielrbradley deleted the improve-auth-error branch June 13, 2024 18:44
@@ -123,11 +123,12 @@ func (k *azureNativeProvider) getAuthConfig() (*authConfig, error) {

needCli := needAzCli(builder)
if needCli {
requireCliHint := "MSI, OIDC, client secret and client certificate authentication are not configured so we require the AZ CLI for authentication"
Copy link
Member

Choose a reason for hiding this comment

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

AZ CLI

It's called Azure CLI in all official product docs. If you mean the command, then it's probably lowercase az.

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.

Auth throws non-descriptive error if the az CLI is not installed
3 participants