Skip to content

Revert defaulting use_azure_cli to True #325

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

Merged
merged 1 commit into from
Mar 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Note that many authentication variants are already supported natively.
- Workload identity OAuth2, using a `client_id`, `tenant_id`, and `federated_token_file` passed in by the user
- OAuth2, using a `client_id`, `client_secret`, and `tenant_id` passed in by the user
- A SAS key passed in by the user.
- Azure CLI. (If you want to ensure the IMDS authentication is used below, pass [`use_azure_cli=False`][obstore.store.AzureConfig.use_azure_cli] to `AzureStore`.)
- Azure CLI. (When constructing `AzureStore` you must set [`use_azure_cli`][obstore.store.AzureConfig.use_azure_cli] to `True`, either by passing `use_azure_cli=True` or by setting the `AZURE_USE_AZURE_CLI` environment variable to `"TRUE"`).
- IMDS Managed Identity Provider.

(A transcription of [this underlying code](https://github.com/apache/arrow-rs/blob/a00f9f43a0530b9255e4f9940e43121deedb0cc7/object_store/src/azure/builder.rs#L942-L1019)).
Expand Down
10 changes: 1 addition & 9 deletions docs/dev/overridden-defaults.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,4 @@ In general, we wish to follow the upstream `object_store` as closely as possible

However, there are occasionally places where we want to diverge from the upstream decision making, and we document those here.

## Azure CLI

We always check for Azure CLI authentication as a fallback.

If we stuck with the upstream `object_store` default, you would need to pass `use_azure_cli=True` to check for Azure CLI credentials.

The Azure CLI is the [second-to-last Azure authentication method checked](https://github.com/apache/arrow-rs/blob/9c92a50b6d190ca9d0c74c3ccc69e348393d9246/object_store/src/azure/builder.rs#L1015-L1016) checked. So this only changes the default behavior for people relying on instance authentication. For those people, they can still pass `use_azure_cli=False`.

See upstream discussion [here](https://github.com/apache/arrow-rs/issues/7204).
(Currently none).
2 changes: 0 additions & 2 deletions obstore/python/obstore/store/_azure.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,6 @@ class AzureConfig(TypedDict, total=False):
use_azure_cli: bool
"""Set if the Azure Cli should be used for acquiring access token.

Defaults to `True` (as a fallback).

<https://learn.microsoft.com/en-us/cli/azure/account?view=azure-cli-latest#az-account-get-access-token>.

**Environment variable**: `AZURE_USE_AZURE_CLI`.
Expand Down
9 changes: 0 additions & 9 deletions pyo3-object_store/src/azure/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ impl PyAzureStore {
kwargs: Option<PyAzureConfig>,
) -> PyObjectStoreResult<Self> {
let mut builder = MicrosoftAzureBuilder::from_env();
builder = PyAzureConfig::OVERRIDDEN_DEFAULTS().apply_config(builder);
let mut config = config.unwrap_or_default();
if let Some(container) = container.clone() {
// Note: we apply the bucket to the config, not directly to the builder, so they stay
Expand Down Expand Up @@ -261,14 +260,6 @@ impl PyAzureConfig {
Self(HashMap::new())
}

/// Default values that we opt into that differ from the upstream object_store defaults
#[allow(non_snake_case)]
fn OVERRIDDEN_DEFAULTS() -> Self {
let mut map = HashMap::with_capacity(1);
map.insert(AzureConfigKey::UseAzureCli.into(), true.into());
Self(map)
}

fn apply_config(self, mut builder: MicrosoftAzureBuilder) -> MicrosoftAzureBuilder {
for (key, value) in self.0.into_iter() {
builder = builder.with_config(key.0, value.0);
Expand Down
Loading