Skip to content
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

Error using DefaultAzureCredential with TableServiceClient #35679

Open
russd2357 opened this issue May 16, 2024 · 4 comments
Open

Error using DefaultAzureCredential with TableServiceClient #35679

russd2357 opened this issue May 16, 2024 · 4 comments
Assignees
Labels
Azure.Identity Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-author-feedback More information is needed from author to address the issue. no-recent-activity There has been no recent activity on this issue. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team.

Comments

@russd2357
Copy link

Changing code to move away from using secrets to identity.

To Reproduce
Steps to reproduce the behavior:

  1. Create a CosmosDB account with Table API enabled
  2. Log into Azure using az login (using account with Owner privilege on the subscription)
  3. run this python code:
   try:
        creds = DefaultAzureCredential()
        table = TableServiceClient(
            endpoint=f"https://{cosmosdb_account_name}.table.cosmos.azure.com:443/",  
            credential=creds).get_table_client(table_name=cosmosdb_table)
        
        messageProcessingTime = datetime.utcnow() - datetime.strptime(jsonMessage["srcStamp"],date_format) 
        print(f'messageProcessingTime: {messageProcessingTime.total_seconds()}')

        // hydrate an entity for insertion into table
        
        response = table.create_entity(entity=entity)
        
        print (f"insert_entity response timestamp {str(response)}")
    except Exception as error:
        print(f"Error has happened : {error}")

**Expected behavior**
The table should be updated.  This code works just fine when I use a connection string to construct the TableServiceClient.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
This is the error message I get:   

Operation returned an invalid status 'Unauthorized'
Content: {"odata.error":{"code":"Unauthorized","message":{"lang":"en-us","value":"Authorization header doesn't confirm to the required format. Please verify and try again.\r\nActivityId: 0ad768a3-5ad9-4b23-8982-ce8bb4c14073, documentdb-dotnet-sdk/2.14.0 Host/64-bit MicrosoftWindowsNT/10.0.20348.0\nRequestID:0ad768a3-5ad9-4b23-8982-ce8bb4c14073\n"}}}
@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team. Tables labels May 16, 2024
Copy link

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @klaaslanghout.

@xiangyan99
Copy link
Member

Thanks for reaching out.

Could you enable logging and share the logs?

import logging
logging.basicConfig(level=logging.DEBUG)

@xiangyan99 xiangyan99 added Azure.Identity needs-author-feedback More information is needed from author to address the issue. and removed Tables labels May 17, 2024
@xiangyan99 xiangyan99 self-assigned this May 17, 2024
Copy link

Hi @russd2357. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

@github-actions github-actions bot removed the needs-team-attention This issue needs attention from Azure service team or SDK team label May 17, 2024
Copy link

Hi @russd2357, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

@github-actions github-actions bot added the no-recent-activity There has been no recent activity on this issue. label May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure.Identity Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-author-feedback More information is needed from author to address the issue. no-recent-activity There has been no recent activity on this issue. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team.
Projects
Status: Untriaged
Development

No branches or pull requests

2 participants