-
Notifications
You must be signed in to change notification settings - Fork 76
Use Azure Identity's TokenCredential for auth. #333
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
Remove older python package support
dylanw-oss
left a comment
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.
Thanks for fixing the feature gap!
|
@akharit, thanks for fixing it! Do you have an ETA when a new package will be available? |
30826d6 to
0e5b5d5
Compare
|
Ha, well this is silly but I had been using lib.auth() for most of my applications because it worked so seamlessly for interactive auth via device code without having to install an additional dependency in azure CLI from azure.datalake.store import lib
import polars as pl
token = lib.auth(
tenant_id=os.environ["SP_TENANT_ID"],
resource = 'https://storage.azure.com/'
)
# <interactive prompt for devicecode login>
# Ex. downstream, to read in data via polars
opts = {
"tenant_id": token.token["tenant"],
"client_id": token.token["client"],
"token": token.token["access_token"],
"account_name": "my_account"
}
lazy_data = pl.scan_parquet("az://some.path/here", storage_options=opts)perusing the azure-identity documents and trying a couple dozen combinations, I finally figured out a replacement. from azure.identity import DefaultAzureCredential
token_credential = DefaultAzureCredential(exclude_interactive_browser_credential=False, interactive_browser_tenant_id=os.environ["SP_TENANT_ID"])
access_token = token_credential.get_token('https://storage.azure.com/.default', tenant_id=os.environ["SP_TENANT_ID"])Hopefully, this will save someone reading a couple of hours of headaches trying to get this working. |
Use Azure Identity's TokenCredential for auth.
Remove older python package support
Will fix #332
This checklist is used to make sure that common guidelines for a pull request are followed.
Description of the change
General Guidelines
Not checking in the recordings. Fix needed wrt some fields like lease id, session id, token etc. that are causing the test run with recording to fail.