-
Notifications
You must be signed in to change notification settings - Fork 18
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
Fix GetNewSession function to cache credentials session correctly. Fixes #441 #442
Conversation
…n id is not known for CLI auth
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LalitTurbot Please see comments
azure/service.go
Outdated
@@ -49,6 +50,7 @@ func GetNewSession(ctx context.Context, d *plugin.QueryData, tokenAudience strin | |||
return cachedData.(*Session), nil | |||
} | |||
} | |||
logger.Info("Auth session not found in cache") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be info level, or debug instead? I don't know if we want to see this all the time in the logs.
azure/service.go
Outdated
@@ -153,7 +155,9 @@ func GetNewSession(ctx context.Context, d *plugin.QueryData, tokenAudience strin | |||
|
|||
// Get the subscription ID and tenant ID for "GRAPH" token audience | |||
case "CLI": | |||
logger.Info("GetNewSession__", "Get session authorizer from Azure CLI") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly here, should this be debug level instead?
azure/service.go
Outdated
authorizer, err = auth.NewAuthorizerFromCLIWithResource(resource) | ||
// authorizer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this comment mean?
azure/service.go
Outdated
|
||
if err != nil { | ||
logger.Debug("GetNewSession__", "NewAuthorizerFromCLIWithResource error", err) | ||
logger.Error("GetNewSession__", "Get token from Azure CLI error", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What level do we usually use, Warn or Error, for these types of messages?
azure/service.go
Outdated
d.ConnectionManager.Cache.SetWithTTL(cacheKey, sess, time.Until(*sess.Expires)) | ||
logger.Info("Session saved in cache with expiry in", "minutes", (time.Until(*sess.Expires)).Minutes()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to my other questions above, should this line and the one below it be debug level?
Integration test logs
Logs
Example query results
Results