Skip to content

Commit a1615ed

Browse files
authored
Allow AzurePipelinesCredential to log ADO debugging headers (Azure#3028)
1 parent f06cb1a commit a1615ed

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

sdk/identity/azure_identity/src/azure_pipelines_credential.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@ use azure_core::{
1414
},
1515
};
1616
use serde::Deserialize;
17-
use std::{convert::Infallible, fmt, sync::Arc};
17+
use std::{borrow::Cow, convert::Infallible, fmt, sync::Arc};
1818

1919
// cspell:ignore fedauthredirect msedge oidcrequesturi
2020
const OIDC_VARIABLE_NAME: &str = "SYSTEM_OIDCREQUESTURI";
2121
const OIDC_VERSION: &str = "7.1";
2222
const TFS_FEDAUTHREDIRECT_HEADER: HeaderName = HeaderName::from_static("x-tfs-fedauthredirect");
2323

24-
// TODO: https://github.com/Azure/azure-sdk-for-rust/issues/682
2524
const ALLOWED_HEADERS: &[&str] = &["x-msedge-ref", "x-vss-e2eid"];
2625

2726
/// Enables authentication to Entra ID from Azure Pipelines.
@@ -60,11 +59,20 @@ impl AzurePipelinesCredential {
6059
"no system access token specified",
6160
)?;
6261

63-
let options = options.unwrap_or_default();
62+
let mut options = options.unwrap_or_default();
63+
options
64+
.credential_options
65+
.client_options
66+
.logging
67+
.additional_allowed_header_names
68+
// the logging policy constructor will remove any duplicates
69+
.extend(ALLOWED_HEADERS.iter().map(|&s| Cow::Borrowed(s)));
70+
6471
#[cfg(test)]
6572
let env = options.env.unwrap_or_default();
6673
#[cfg(not(test))]
6774
let env = Env::default();
75+
6876
let endpoint = env
6977
.var(OIDC_VARIABLE_NAME)
7078
.map_err(|err| azure_core::Error::with_error(

0 commit comments

Comments
 (0)