diff --git a/src/Authentication.Abstractions/AuthTelemetryRecord.cs b/src/Authentication.Abstractions/AuthTelemetryRecord.cs
index a45707ad53..34d56c3a3c 100644
--- a/src/Authentication.Abstractions/AuthTelemetryRecord.cs
+++ b/src/Authentication.Abstractions/AuthTelemetryRecord.cs
@@ -35,6 +35,8 @@ public class AuthTelemetryRecord : IAuthTelemetryRecord
///
public bool AuthenticationSuccess { get; set; } = false;
+ public bool correlationId { get; set; }
+
///
/// Additional properties for AuthenticationInfo
///
@@ -64,11 +66,11 @@ public AuthTelemetryRecord(IAuthTelemetryRecord other, bool? isSuccess = null)
///
/// Prefix of properties of the first record of authentication telemetry record.
///
- public const string AuthInfoTelemetryHeadKey = "auth-info-head";
+ public const string AuthTelemetryPropertyHeadPrefix = "auth-info-head";
///
/// Key of the left records of authentication telemetry.
///
- public const string AuthInfoTelemetrySubsequentKey = "auth-info-sub";
+ public const string AuthTelemetryPropertyTailKey = "auth-info-tail";
}
}
diff --git a/src/Authentication.Abstractions/Interfaces/IAuthTelemetryRecord.cs b/src/Authentication.Abstractions/Interfaces/IAuthTelemetryRecord.cs
index 5c3b673cb6..d9f75692e9 100644
--- a/src/Authentication.Abstractions/Interfaces/IAuthTelemetryRecord.cs
+++ b/src/Authentication.Abstractions/Interfaces/IAuthTelemetryRecord.cs
@@ -28,5 +28,7 @@ public interface IAuthTelemetryRecord : IExtensibleModel
/// Authentication process succeed or not.
///
bool AuthenticationSuccess { get; set; }
+
+ bool correlationId { get; set; }
}
}
diff --git a/src/Authentication.Abstractions/Interfaces/IAuthenticationFactory.cs b/src/Authentication.Abstractions/Interfaces/IAuthenticationFactory.cs
index 7c7eeca126..9d24b8ec39 100644
--- a/src/Authentication.Abstractions/Interfaces/IAuthenticationFactory.cs
+++ b/src/Authentication.Abstractions/Interfaces/IAuthenticationFactory.cs
@@ -46,6 +46,30 @@ IAccessToken Authenticate(
IAzureTokenCache tokenCache,
string resourceId = AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId);
+ ///
+ /// Returns IAccessToken if authentication succeeds or throws an exception if authentication fails.
+ ///
+ /// the Id of current authentication request
+ /// The azure account object
+ /// The azure environment object
+ /// The AD tenant in most cases should be 'common'
+ /// The AD account password
+ /// The prompt behavior
+ /// The prompt action used in DeviceFlow authentication
+ /// Token Cache
+ /// Optional, the AD resource id
+ ///
+ IAccessToken Authenticate(
+ string requestId,
+ IAzureAccount account,
+ IAzureEnvironment environment,
+ string tenant,
+ SecureString password,
+ string promptBehavior,
+ Action promptAction,
+ IAzureTokenCache tokenCache,
+ string resourceId = AzureEnvironment.Endpoint.ActiveDirectoryServiceEndpointResourceId);
+
///
/// Returns IAccessToken if authentication succeeds or throws an exception if authentication fails.
///
@@ -99,6 +123,6 @@ IAccessToken Authenticate(
///
/// Get the information to be recorded in Telemetry
///
- AuthenticationTelemetry GetDataForTelemetry();
+ AuthenticationTelemetry GetDataForTelemetry(string requestId);
}
}
diff --git a/src/Common/AzurePSCmdlet.cs b/src/Common/AzurePSCmdlet.cs
index fb2d13a4b9..08cd400d40 100644
--- a/src/Common/AzurePSCmdlet.cs
+++ b/src/Common/AzurePSCmdlet.cs
@@ -842,7 +842,7 @@ protected void LogQosEvent()
_qosEvent.ParameterSetName = this.ParameterSetName;
_qosEvent.FinishQosEvent();
- _qosEvent.AuthTelemetry = AzureSession.Instance.AuthenticationFactory.GetDataForTelemetry();
+ _qosEvent.AuthTelemetry = AzureSession.Instance.AuthenticationFactory.GetDataForTelemetry(_clientRequestId);
if (!IsUsageMetricEnabled && (!IsErrorMetricEnabled || _qosEvent.IsSuccess))
{
diff --git a/src/Common/MetricHelper.cs b/src/Common/MetricHelper.cs
index 4fb9b01b71..6e99e16528 100644
--- a/src/Common/MetricHelper.cs
+++ b/src/Common/MetricHelper.cs
@@ -295,15 +295,15 @@ public void SetPSHost(PSHost host)
private static void PopulateAuthenticationPropertiesFromQos(AuthenticationTelemetry telemetry, IDictionary eventProperties)
{
var record = telemetry.Head;
- eventProperties[$"{AuthTelemetryRecord.AuthInfoTelemetryHeadKey}-{nameof(record.TokenCredentialName).ToLower()}"] = record.TokenCredentialName;
- eventProperties[$"{AuthTelemetryRecord.AuthInfoTelemetryHeadKey}-{nameof(record.AuthenticationSuccess).ToLower()}"] = record.AuthenticationSuccess.ToString();
+ eventProperties[$"{AuthTelemetryRecord.AuthTelemetryPropertyHeadPrefix}-{nameof(record.TokenCredentialName).ToLower()}"] = record.TokenCredentialName;
+ eventProperties[$"{AuthTelemetryRecord.AuthTelemetryPropertyHeadPrefix}-{nameof(record.AuthenticationSuccess).ToLower()}"] = record.AuthenticationSuccess.ToString();
foreach (var property in record.ExtendedProperties)
{
- eventProperties[$"{AuthTelemetryRecord.AuthInfoTelemetryHeadKey}-{property.Key.ToLower()}"] = property.Value;
+ eventProperties[$"{AuthTelemetryRecord.AuthTelemetryPropertyHeadPrefix}-{property.Key.ToLower()}"] = property.Value;
}
- eventProperties[AuthTelemetryRecord.AuthInfoTelemetrySubsequentKey] = JsonConvert.SerializeObject(telemetry.Tail);
+ eventProperties[AuthTelemetryRecord.AuthTelemetryPropertyTailKey] = JsonConvert.SerializeObject(telemetry.Tail);
}
private void PopulatePropertiesFromQos(AzurePSQoSEvent qos, IDictionary eventProperties, bool populateException = false)