Skip to content

Updated value of anon to be False#540

Open
anjaliratnam-msft wants to merge 6 commits intofsspec:mainfrom
anjaliratnam-msft:update-anon-default
Open

Updated value of anon to be False#540
anjaliratnam-msft wants to merge 6 commits intofsspec:mainfrom
anjaliratnam-msft:update-anon-default

Conversation

@anjaliratnam-msft
Copy link
Collaborator

We are updating the default value of anon to be False which means that anonymous authentication will not be used unless anon=True is explicitly passed in when instantiating AzureBlobFileSystem. DefaultAzureCredentials will now become the default authentication method. This resolves #348.

Copy link
Collaborator

@kyleknap kyleknap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I just had some smaller feedback.

@@ -315,25 +312,11 @@ def __init__(
if anon is not None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a particular reason, we did not just change the default of the os.getenv() call here to "false"? It would help keep the diff simpler here I think.

CHANGELOG.md Outdated
Unreleased
----------
- Added `**kwargs` to `AzureBlobFileSystem.exists()`
- **Breaking:** Adlfs now requires credentials as the default value for `anon` has changed to
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this changelog, let's:

  1. Hoist this entry to be top entry in this section since it will be the most important update
  2. Update the wording to the following to help make what's breaking a little more clear:
**Breaking:** Adlfs no longer uses anonymous authentication by default. It now defaults to using default Azure credentials for authentication. To continue using anonymous authentication please set `anon=True` when creating `AzureBlobFileSystem`.

README.md Outdated
Comment on lines +64 to +66
The value to use for whether to attempt anonymous access if no other credential is passed. By default (`None`), the
`AZURE_STORAGE_ANON` environment variable is checked. False values (`false`, `0`, `f`) will resolve to `False` and
anonymous access will not be attempted. Otherwise the value for `anon` resolves to True.
`AZURE_STORAGE_ANON` environment variable is checked. If the environment variable is set, values of (``false``, ``0``, ``f``) are ``False`` and everything else resolves to True. Anon will default to ``False`` if nothing
is provided and ``DefaultAzureCredential`` will be used for authentication.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we just narrow down the description here to just:

Set to `True` to use anonymous authentication. If not set, the `AZURE_STORAGE_ANON` environment variable will also be checked.

Mainly I'm not sure if we need to go into all of the details here as it makes the description sort of hard to follow.

README.md Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the very beginning here, it would be worth calling out that by default if no additional credentials/configuration are provided, DefaultAzureCredentials will be used so that is clear before we go into detail in the storage_options what you get if you don't configure any of this.

and self.account_key is None
and self.sas_token is None
and self.client_id is not None
and self.connection_string is None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was there a particular reason for adding connection_string check here? More just curious if there was something specific that you ran into or if this was more for correctness.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some test in test_connect_client was failing because it was using the connection string and since anon would now be false it was still trying to get the credentials.

],
)
def test_no_anon_warning(storage, env_vars, storage_options):
def test_anon_default(storage, env_vars, storage_options):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rename the test to test_anon_off as we are still configuring anon in some cases and this is more to make sure that anonymous connection is turned off in these cases.

skip_instance_cache=True,
**storage_options,
)
assert fs.anon is False
Copy link
Collaborator

@kyleknap kyleknap Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would also be worth adding an assertion similar to what we have in test_connect_client.py to detect whether we are actually providing credentials to the client. Mainly, while the fs.anon could be set to one value, there could be unintended behavior in the code where the credential was not actually passed to the client. I don't think we need to assert the exact credentials provided either it would be more if credential was set to any non-None value when instantiating the client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make DefaultAzureCredential as default credential method instead of anonymous access?

2 participants