A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/Azure/azure-sdk-for-python/issues/15653 below:

[Tables] Delete Entity Returning Unauthorized, Query Entities Not · Issue #15653 · Azure/azure-sdk-for-python · GitHub

Describe the bug
After creating a TableClient from azure.data.tables.aio, a call to table_client.query_entities is successful. Just a few lines later, a call to table_client.delete_entity is not, and returns a ClientAutheniticationError: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.

I've tried this with azure.cosmosdb.table as well: Using similar calls, the query call is successful, but the delete call returns an AzureSigningError: Incorrect padding.

I have verified that the key is 88 characters long, ends with ==, and is DIRECTLY copied from the storage account in question. It obviously works for the query_entities call.

To Reproduce
Steps to reproduce the behavior:

  1. Create an Azure Storage Account, add a table to it, and name the table "Locator". Add a few entities with a column called LocatorHash, with any string value you like.
  2. Run the following code:
    from azure.data.tables.aio import TableClient
    from azure.core import MatchingConditions

    table_name = 'Locator'
    email_hash = '...' #Can be any string value contained in the LocatorHash column
    table_client = TableClient(account_url='https://<YOURACCOUNTNAME>.table.core.windows.net', table_name=table_name, credential=os.environ['STORAGE_ACCOUNT_ACCESS_KEY'])
    async with table_client:
        locator_entities = table_client.query_entities(filter=f"LocatorHash eq '{email_hash}'")
        coroutines = []
        async for locator_entity in locator_entities:
            logging.info(f"Deleting record: {locator_entity}")
            # error occurs on this line
            await table_client.delete_entity(row_key=locator_entity['RowKey'], partition_key=locator_entity['PartitionKey'], etag=locator_entity['_metadata']['etag'], match_condition=MatchConditions.Unconditionally)

Expected behavior
Entities are deleted rather than receiving an AuthError.

Screenshots

When using azure.data.tables.aio

When using azure.cosmosdb.table -- note, had to edit code to be synchronous


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4