-
Notifications
You must be signed in to change notification settings - Fork 4k
Collect Authentication Telemetry #27560
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
Conversation
Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status. |
Co-authored-by: Copilot <[email protected]>
f2c75d6
to
e90adbf
Compare
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.
Pull Request Overview
This PR introduces authentication telemetry collection by adding and passing a new CmdletContext property throughout the authentication workflow. Key changes include:
- Adding a new public ICmdletContext property in RMProfileClient and updating authentication methods to use it.
- Updating various components and test files to register and pass the _cmdletContext as part of authentication requests.
- Modifying methods in ContextAdapter and others to support the additional telemetry context.
Reviewed Changes
Copilot reviewed 52 out of 52 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
src/Accounts/Accounts/Models/RMProfileClient.cs | Added ICmdletContext property and updated Authenticate method. |
src/Accounts/Accounts/Environment/GetAzureRMEnvironment.cs | Instantiated RMProfileClient with new CmdletContext property. |
src/Accounts/Accounts/Default/SetAzureRMDefault.cs | Updated GetServiceClientCredentials call to include _cmdletContext. |
src/Accounts/Accounts/Default/GetAzureRmDefault.cs | Updated GetServiceClientCredentials call to include _cmdletContext. |
src/Accounts/Accounts/Context/GetAzureRMContext.cs | Modified RefreshContextsFromCache to pass _cmdletContext. |
src/Accounts/Accounts/CommonModule/EnvironmentExtensions.cs | Minor update to use default literal for improved readability. |
src/Accounts/Accounts/CommonModule/ContextAdapter.cs | Extended authentication helper methods to accept and pass cmdletContext. |
src/Accounts/Accounts/Common/AzureContextModificationCmdlet.cs | Updated object initialization to include CmdletContext property. |
Test Files | Updated tests to register AuthenticationTelemetry component. |
src/Accounts/Accounts/ChangeLog.md | Updated changelog to document telemetry changes. |
Co-authored-by: NoriZC <[email protected]>
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.
Pull Request Overview
This PR adds telemetry for authentication by introducing a new property and passing through a cmdlet context parameter in various client initializations. Key changes include:
- Updating RMProfileClient and related methods to accept a new CmdletContext.
- Modifying service client initialization calls to pass the _cmdletContext.
- Registering an AuthenticationTelemetry component in multiple modules and test setups.
Reviewed Changes
Copilot reviewed 50 out of 50 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
src/Accounts/Accounts/Subscription/GetAzureRMSubscription.cs | Updated RMProfileClient initialization to include WarningLog and CmdletContext, but contains a redundant WarningLog assignment. |
src/Accounts/Accounts/Rest/InvokeAzRestMethodCommand.cs | Modified client creation calls to pass _cmdletContext. |
src/Accounts/Accounts/Models/RMProfileClient.cs | Added CmdletContext property and updated Authenticate call with new optional parameters. |
src/Accounts/Accounts/Environment/GetAzureRMEnvironment.cs | Updated RMProfileClient initialization to include CmdletContext. |
src/Accounts/Accounts/Default/SetAzureRMDefault.cs, GetAzureRmDefault.cs | Updated GetServiceClientCredentials calls to pass _cmdletContext. |
src/Accounts/Accounts/Context/GetAzureRMContext.cs | Updated RefreshContextsFromCache to pass _cmdletContext. |
src/Accounts/Accounts/Common/AzureContextModificationCmdlet.cs | Updated RMProfileClient initialization to include CmdletContext. |
Remaining files (ChangeLog.md, ConnectAzureRmAccount.cs and test files) | Integrated AuthenticationTelemetry registration and updated test setups consistently. |
Comments suppressed due to low confidence (1)
src/Accounts/Accounts/Subscription/GetAzureRMSubscription.cs:67
- The WarningLog property is being assigned twice; please remove the redundant assignment on line 67 to prevent potential confusion or unexpected behavior.
_client.WarningLog = (s) => WriteWarning(s);
Description
The purpose of the PR is to send new property to Azure PowerShell telemetry to collection information of authentication
The details of auth-info-secondary
[{"TokenCredentialName":"SharedTokenCacheCredential","AuthenticationSuccess":true},{"TokenCredentialName":"SharedTokenCacheCredential","AuthenticationSuccess":false},{"TokenCredentialName":"SharedTokenCacheCredential","AuthenticationSuccess":false},{"TokenCredentialName":"SharedTokenCacheCredential","AuthenticationSuccess":false},{"TokenCredentialName":"SharedTokenCacheCredential","AuthenticationSuccess":true},{"TokenCredentialName":"SharedTokenCacheCredential","AuthenticationSuccess":false},{"TokenCredentialName":"SharedTokenCacheCredential","AuthenticationSuccess":false}]
API Change
Add Interface to Send Auth Info to Telemetry azure-powershell-common#421
Mandatory Checklist
Please choose the target release of Azure PowerShell. (⚠️ Target release is a different concept from API readiness. Please click below links for details.)
Check this box to confirm: I have read the Submitting Changes section of
CONTRIBUTING.md
and reviewed the following information:ChangeLog.md
file(s) appropriatelysrc/{{SERVICE}}/{{SERVICE}}/ChangeLog.md
.## Upcoming Release
header in the past tense.ChangeLog.md
if no new release is required, such as fixing test case only.