Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-azure-data-tables for openSUSE:Factory checked in at 2025-05-07 19:21:21 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-azure-data-tables (Old) and /work/SRC/openSUSE:Factory/.python-azure-data-tables.new.30101 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-azure-data-tables" Wed May 7 19:21:21 2025 rev:19 rq:1275245 version:12.7.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-azure-data-tables/python-azure-data-tables.changes 2024-11-22 23:53:51.795243145 +0100 +++ /work/SRC/openSUSE:Factory/.python-azure-data-tables.new.30101/python-azure-data-tables.changes 2025-05-07 19:21:38.224134794 +0200 @@ -1,0 +2,8 @@ +Wed May 7 05:55:09 UTC 2025 - John Paul Adrian Glaubitz <adrian.glaub...@suse.com> + +- New upstream release + + Version 12.7.0 + + For detailed information about changes see the + CHANGELOG.md file provided with this package + +------------------------------------------------------------------- Old: ---- azure_data_tables-12.6.0.tar.gz New: ---- azure_data_tables-12.7.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-azure-data-tables.spec ++++++ --- /var/tmp/diff_new_pack.wiMg2S/_old 2025-05-07 19:21:40.308221723 +0200 +++ /var/tmp/diff_new_pack.wiMg2S/_new 2025-05-07 19:21:40.320222223 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-azure-data-tables # -# Copyright (c) 2024 SUSE LLC +# Copyright (c) 2025 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %{?sle15_python_module_pythons} Name: python-azure-data-tables -Version: 12.6.0 +Version: 12.7.0 Release: 0 Summary: Microsoft Azure Azure Data Tables Client Library for Python License: MIT ++++++ azure_data_tables-12.6.0.tar.gz -> azure_data_tables-12.7.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure_data_tables-12.6.0/CHANGELOG.md new/azure_data_tables-12.7.0/CHANGELOG.md --- old/azure_data_tables-12.6.0/CHANGELOG.md 2024-11-21 17:18:16.000000000 +0100 +++ new/azure_data_tables-12.7.0/CHANGELOG.md 2025-05-06 01:15:52.000000000 +0200 @@ -1,5 +1,15 @@ # Release History +## 12.7.0 (2025-05-06) + +### Features Added + +* Added support for configuring custom audiences for `TokenCredential` authentication when initializing a `TableClient` or `TableServiceClient`. ([#40487](https://github.com/Azure/azure-sdk-for-python/pull/40487)) + +### Other Changes + +* Python 3.8 is no longer supported. Please use Python version 3.9 or later. + ## 12.6.0 (2024-11-21) ### Features Added diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure_data_tables-12.6.0/PKG-INFO new/azure_data_tables-12.7.0/PKG-INFO --- old/azure_data_tables-12.6.0/PKG-INFO 2024-11-21 17:20:04.909414800 +0100 +++ new/azure_data_tables-12.7.0/PKG-INFO 2025-05-06 01:17:46.753986000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: azure-data-tables -Version: 12.6.0 +Version: 12.7.0 Summary: Microsoft Azure Azure Data Tables Client Library for Python Home-page: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/tables/azure-data-tables Author: Microsoft Corporation @@ -11,13 +11,13 @@ Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 Classifier: License :: OSI Approved :: MIT License -Requires-Python: >=3.8 +Requires-Python: >=3.9 Description-Content-Type: text/markdown License-File: LICENSE Requires-Dist: azure-core>=1.29.4 @@ -43,7 +43,7 @@ The Azure Tables SDK can access an Azure Storage or CosmosDB account. ### Prerequisites -* Python 3.8 or later is required to use this package. +* Python 3.9 or later is required to use this package. * You must have an [Azure subscription][azure_subscription] and either * an [Azure Storage account][azure_storage_account] or * an [Azure Cosmos Account][azure_cosmos_account]. @@ -82,7 +82,7 @@ * Shared Key * Connection String * Shared Access Signature Token -* TokenCredential(AAD)(Supported on Storage) +* TokenCredential (Microsoft Entra ID)(Supported on Storage) ##### Creating the client from a shared key To use an account [shared key][azure_shared_key] (aka account key or access key), provide the key as a string. This can be found in your storage account in the [Azure Portal][azure_portal_account_url] under the "Access Keys" section or by running the following Azure CLI command: @@ -106,7 +106,7 @@ ``` ##### Creating the client from a connection string -Depending on your use case and authorization method, you may prefer to initialize a client instance with a connection string instead of providing the account URL and credential separately. To do this, pass the connection string to the client's `from_connection_string` class method. If the connection string does not specify a fully qualified endpoint URL (`"TableEndpoint"`), or URL suffix (`"EndpointSuffix"`), the endpoint will be assumed to be an Azure Storage account, and the URL automatically formatted accordingly. +Depending on your use case and authorization method, you may prefer to initialize a client instance with a connection string instead of providing the account URL and credential separately. To do this, pass the connection string to the client's `from_connection_string` class method. If the connection string does not specify a fully qualified endpoint URL (`"TableEndpoint"`), or URL suffix (`"EndpointSuffix"`), the endpoint will be assumed to be an Azure Storage account, and the URL automatically formatted accordingly. For Tables Storage, the connection string can be found in your storage account in the [Azure Portal][azure_portal_account_url] under the "Access Keys" section or with the following Azure CLI command: @@ -132,7 +132,7 @@ ``` ##### Creating the client from a SAS token -To use a [shared access signature (SAS) token][azure_sas_token], provide the token as a string. If your account URL includes the SAS token, omit the credential parameter. You can generate a SAS token from the Azure Portal under [Shared access signature](https://docs.microsoft.com/rest/api/storageservices/create-service-sas) or use one of the `generate_*_sas()` functions to create a sas token for the account or table: +To use a [shared access signature (SAS) token][azure_sas_token], provide the token as a string. If your account URL includes the SAS token, omit the credential parameter. You can generate a SAS token from the Azure Portal under [Shared access signature](https://learn.microsoft.com/rest/api/storageservices/create-service-sas) or use one of the `generate_*_sas()` functions to create a sas token for the account or table: ```python from datetime import datetime, timedelta @@ -156,11 +156,12 @@ ``` ##### Creating the client from a TokenCredential -Azure Tables provides integration with Azure Active Directory(Azure AD) for identity-based authentication of requests to the Table service when targeting a Storage endpoint. With Azure AD, you can use role-based access control(RBAC) to grant access to your Azure Table resources to users, groups, or applications. + +Azure Tables provides integration with Microsoft Entra ID for identity-based authentication of requests to the Table service when targeting a Storage endpoint. With Microsoft Entra ID, you can use role-based access control (RBAC) to grant access to your Azure Table resources to users, groups, or applications. To access a table resource with a TokenCredential, the authenticated identity should have either the "Storage Table Data Contributor" or "Storage Table Data Reader" role. -With the `azure-identity` package, you can seamlessly authorize requests in both development and production environments. To learn more about Azure AD integration in Azure Storage, see the [azure-identity README](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/identity/azure-identity/README.md) +With the `azure-identity` package, you can seamlessly authorize requests in both development and production environments. To learn more about Microsoft Entra ID integration in Azure Storage, see the [azure-identity README](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/identity/azure-identity/README.md) ```python from azure.data.tables import TableServiceClient @@ -173,6 +174,33 @@ print(f"{properties}") ``` +###### Configure client for an Azure sovereign cloud + +When TokenCredential authentication is used, all clients are configured to use the Azure public cloud by default. To configure a client for a sovereign cloud, you should provide the correct `audience` keyword argument when creating the client. The following table lists some known audiences: + +| Cloud | Audience | +|-------|----------| +| Azure Public | https://storage.azure.com / https://cosmos.azure.com | +| Azure US Government | https://storage.azure.us / https://cosmos.azure.us | +| Azure China | https://storage.chinacloudapi.cn / https://cosmos.chinacloudapi.cn | + +The following example shows how to configure the `TableServiceClient` to connect to Azure US Government: + +```python +from azure.data.tables import TableServiceClient +from azure.identity import AzureAuthorityHosts, DefaultAzureCredential + +# Authority can also be set via the AZURE_AUTHORITY_HOST environment variable. +credential = DefaultAzureCredential(authority=AzureAuthorityHosts.AZURE_GOVERNMENT) + +table_service_client = TableServiceClient( + endpoint="https://<my_account_name>.table.core.usgovcloudapi.net", + credential=credential, + audience="https://storage.azure.us" +) +``` + + ## Key concepts Common uses of the Table service included: * Storing TBs of structured data capable of serving web scale applications @@ -324,7 +352,7 @@ ### General Azure Tables clients raise exceptions defined in [Azure Core][azure_core_readme]. -When you interact with the Azure table library using the Python SDK, errors returned by the service respond ot the same HTTP status codes for [REST API][tables_rest] requests. The Table service operations will throw a `HttpResponseError` on failure with helpful [error codes][tables_error_codes]. +When you interact with the Azure table library using the Python SDK, errors returned by the service respond to the same HTTP status codes for [REST API][tables_rest] requests. The Table service operations will throw a `HttpResponseError` on failure with helpful [error codes][tables_error_codes]. For examples, if you try to create a table that already exists, a `409` error is returned indicating "Conflict". ```python @@ -390,7 +418,7 @@ * Committing many requests in a single transaction: [sample_batching.py](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/tables/azure-data-tables/samples/sample_batching.py) ([async version](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/tables/azure-data-tables/samples/async_samples/sample_batching_async.py)) ### Additional documentation -For more extensive documentation on Azure Tables, see the [Azure Tables documentation][Tables_product_doc] on docs.microsoft.com. +For more extensive documentation on Azure Tables, see the [Azure Tables documentation][Tables_product_doc] on learn.microsoft.com. ## Known Issues A list of currently known issues relating to Cosmos DB table endpoints can be found [here](https://aka.ms/tablesknownissues). @@ -405,43 +433,43 @@ <!-- LINKS --> [source_code]:https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/tables/azure-data-tables [Tables_pypi]:https://aka.ms/azsdk/python/tablespypi -[Tables_ref_docs]:https://docs.microsoft.com/python/api/overview/azure/data-tables-readme?view=azure-python -[Tables_product_doc]:https://docs.microsoft.com/azure/cosmos-db/table-introduction +[Tables_ref_docs]:https://learn.microsoft.com/python/api/overview/azure/data-tables-readme?view=azure-python +[Tables_product_doc]:https://learn.microsoft.com/azure/cosmos-db/table-introduction [Tables_samples]:https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/tables/azure-data-tables/samples [migration_guide]:https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/tables/azure-data-tables/migration_guide.md [azure_subscription]:https://azure.microsoft.com/free/ -[azure_storage_account]:https://docs.microsoft.com/azure/storage/common/storage-account-create?tabs=azure-portal -[azure_cosmos_account]:https://docs.microsoft.com/azure/cosmos-db/create-cosmosdb-resources-portal +[azure_storage_account]:https://learn.microsoft.com/azure/storage/common/storage-account-create?tabs=azure-portal +[azure_cosmos_account]:https://learn.microsoft.com/azure/cosmos-db/create-cosmosdb-resources-portal [pip_link]:https://pypi.org/project/pip/ -[azure_create_cosmos]:https://docs.microsoft.com/azure/cosmos-db/create-cosmosdb-resources-portal -[azure_cli_create_cosmos]:https://docs.microsoft.com/azure/cosmos-db/scripts/cli/table/create -[azure_portal_create_cosmos]:https://docs.microsoft.com/azure/cosmos-db/create-cosmosdb-resources-portal -[azure_portal_create_account]:https://docs.microsoft.com/azure/storage/common/storage-account-create?tabs=azure-portal -[azure_powershell_create_account]:https://docs.microsoft.com/azure/storage/common/storage-account-create?tabs=azure-powershell -[azure_cli_create_account]: https://docs.microsoft.com/azure/storage/common/storage-account-create?tabs=azure-cli - -[azure_cli_account_url]:https://docs.microsoft.com/cli/azure/storage/account?view=azure-cli-latest#az-storage-account-show -[azure_powershell_account_url]:https://docs.microsoft.com/powershell/module/az.storage/get-azstorageaccount?view=azps-4.6.1 -[azure_portal_account_url]:https://docs.microsoft.com/azure/storage/common/storage-account-overview#storage-account-endpoints +[azure_create_cosmos]:https://learn.microsoft.com/azure/cosmos-db/create-cosmosdb-resources-portal +[azure_cli_create_cosmos]:https://learn.microsoft.com/azure/cosmos-db/scripts/cli/table/create +[azure_portal_create_cosmos]:https://learn.microsoft.com/azure/cosmos-db/create-cosmosdb-resources-portal +[azure_portal_create_account]:https://learn.microsoft.com/azure/storage/common/storage-account-create?tabs=azure-portal +[azure_powershell_create_account]:https://learn.microsoft.com/azure/storage/common/storage-account-create?tabs=azure-powershell +[azure_cli_create_account]: https://learn.microsoft.com/azure/storage/common/storage-account-create?tabs=azure-cli + +[azure_cli_account_url]:https://learn.microsoft.com/cli/azure/storage/account?view=azure-cli-latest#az-storage-account-show +[azure_powershell_account_url]:https://learn.microsoft.com/powershell/module/az.storage/get-azstorageaccount?view=azps-4.6.1 +[azure_portal_account_url]:https://learn.microsoft.com/azure/storage/common/storage-account-overview#storage-account-endpoints -[azure_sas_token]:https://docs.microsoft.com/azure/storage/common/storage-sas-overview -[azure_shared_key]:https://docs.microsoft.com/rest/api/storageservices/authorize-with-shared-key +[azure_sas_token]:https://learn.microsoft.com/azure/storage/common/storage-sas-overview +[azure_shared_key]:https://learn.microsoft.com/rest/api/storageservices/authorize-with-shared-key [odata_syntax]:https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/tables/azure-data-tables/samples/README.md#writing-filters -[azure_core_ref_docs]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-core/latest/azure.core.html +[azure_core_ref_docs]: https://azuresdkdocs.z19.web.core.windows.net/python/azure-core/latest/azure.core.html [azure_core_readme]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md [python_logging]: https://docs.python.org/3/library/logging.html -[tables_error_codes]: https://docs.microsoft.com/rest/api/storageservices/table-service-error-codes +[tables_error_codes]: https://learn.microsoft.com/rest/api/storageservices/table-service-error-codes [msft_oss_coc]:https://opensource.microsoft.com/codeofconduct/ [msft_oss_coc_faq]:https://opensource.microsoft.com/codeofconduct/faq/ [contact_msft_oss]:mailto:openc...@microsoft.com -[tables_rest]: https://docs.microsoft.com/rest/api/storageservices/table-service-rest-api +[tables_rest]: https://learn.microsoft.com/rest/api/storageservices/table-service-rest-api [create_entity]:https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/tables/azure-data-tables/samples/sample_insert_delete_entities.py#L67-L73 [delete_entity]:https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/tables/azure-data-tables/samples/sample_insert_delete_entities.py#L89-L92 @@ -450,11 +478,19 @@ [get_entity]:https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/tables/azure-data-tables/samples/sample_update_upsert_merge_entities.py#L67-L71 [upsert_entity]:https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/tables/azure-data-tables/samples/sample_update_upsert_merge_entities.py#L155-L163 - - # Release History +## 12.7.0 (2025-05-06) + +### Features Added + +* Added support for configuring custom audiences for `TokenCredential` authentication when initializing a `TableClient` or `TableServiceClient`. ([#40487](https://github.com/Azure/azure-sdk-for-python/pull/40487)) + +### Other Changes + +* Python 3.8 is no longer supported. Please use Python version 3.9 or later. + ## 12.6.0 (2024-11-21) ### Features Added diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure_data_tables-12.6.0/README.md new/azure_data_tables-12.7.0/README.md --- old/azure_data_tables-12.6.0/README.md 2024-11-21 17:18:16.000000000 +0100 +++ new/azure_data_tables-12.7.0/README.md 2025-05-06 01:15:52.000000000 +0200 @@ -16,7 +16,7 @@ The Azure Tables SDK can access an Azure Storage or CosmosDB account. ### Prerequisites -* Python 3.8 or later is required to use this package. +* Python 3.9 or later is required to use this package. * You must have an [Azure subscription][azure_subscription] and either * an [Azure Storage account][azure_storage_account] or * an [Azure Cosmos Account][azure_cosmos_account]. @@ -55,7 +55,7 @@ * Shared Key * Connection String * Shared Access Signature Token -* TokenCredential(AAD)(Supported on Storage) +* TokenCredential (Microsoft Entra ID)(Supported on Storage) ##### Creating the client from a shared key To use an account [shared key][azure_shared_key] (aka account key or access key), provide the key as a string. This can be found in your storage account in the [Azure Portal][azure_portal_account_url] under the "Access Keys" section or by running the following Azure CLI command: @@ -79,7 +79,7 @@ ``` ##### Creating the client from a connection string -Depending on your use case and authorization method, you may prefer to initialize a client instance with a connection string instead of providing the account URL and credential separately. To do this, pass the connection string to the client's `from_connection_string` class method. If the connection string does not specify a fully qualified endpoint URL (`"TableEndpoint"`), or URL suffix (`"EndpointSuffix"`), the endpoint will be assumed to be an Azure Storage account, and the URL automatically formatted accordingly. +Depending on your use case and authorization method, you may prefer to initialize a client instance with a connection string instead of providing the account URL and credential separately. To do this, pass the connection string to the client's `from_connection_string` class method. If the connection string does not specify a fully qualified endpoint URL (`"TableEndpoint"`), or URL suffix (`"EndpointSuffix"`), the endpoint will be assumed to be an Azure Storage account, and the URL automatically formatted accordingly. For Tables Storage, the connection string can be found in your storage account in the [Azure Portal][azure_portal_account_url] under the "Access Keys" section or with the following Azure CLI command: @@ -105,7 +105,7 @@ ``` ##### Creating the client from a SAS token -To use a [shared access signature (SAS) token][azure_sas_token], provide the token as a string. If your account URL includes the SAS token, omit the credential parameter. You can generate a SAS token from the Azure Portal under [Shared access signature](https://docs.microsoft.com/rest/api/storageservices/create-service-sas) or use one of the `generate_*_sas()` functions to create a sas token for the account or table: +To use a [shared access signature (SAS) token][azure_sas_token], provide the token as a string. If your account URL includes the SAS token, omit the credential parameter. You can generate a SAS token from the Azure Portal under [Shared access signature](https://learn.microsoft.com/rest/api/storageservices/create-service-sas) or use one of the `generate_*_sas()` functions to create a sas token for the account or table: ```python from datetime import datetime, timedelta @@ -129,11 +129,12 @@ ``` ##### Creating the client from a TokenCredential -Azure Tables provides integration with Azure Active Directory(Azure AD) for identity-based authentication of requests to the Table service when targeting a Storage endpoint. With Azure AD, you can use role-based access control(RBAC) to grant access to your Azure Table resources to users, groups, or applications. + +Azure Tables provides integration with Microsoft Entra ID for identity-based authentication of requests to the Table service when targeting a Storage endpoint. With Microsoft Entra ID, you can use role-based access control (RBAC) to grant access to your Azure Table resources to users, groups, or applications. To access a table resource with a TokenCredential, the authenticated identity should have either the "Storage Table Data Contributor" or "Storage Table Data Reader" role. -With the `azure-identity` package, you can seamlessly authorize requests in both development and production environments. To learn more about Azure AD integration in Azure Storage, see the [azure-identity README](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/identity/azure-identity/README.md) +With the `azure-identity` package, you can seamlessly authorize requests in both development and production environments. To learn more about Microsoft Entra ID integration in Azure Storage, see the [azure-identity README](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/identity/azure-identity/README.md) ```python from azure.data.tables import TableServiceClient @@ -146,6 +147,33 @@ print(f"{properties}") ``` +###### Configure client for an Azure sovereign cloud + +When TokenCredential authentication is used, all clients are configured to use the Azure public cloud by default. To configure a client for a sovereign cloud, you should provide the correct `audience` keyword argument when creating the client. The following table lists some known audiences: + +| Cloud | Audience | +|-------|----------| +| Azure Public | https://storage.azure.com / https://cosmos.azure.com | +| Azure US Government | https://storage.azure.us / https://cosmos.azure.us | +| Azure China | https://storage.chinacloudapi.cn / https://cosmos.chinacloudapi.cn | + +The following example shows how to configure the `TableServiceClient` to connect to Azure US Government: + +```python +from azure.data.tables import TableServiceClient +from azure.identity import AzureAuthorityHosts, DefaultAzureCredential + +# Authority can also be set via the AZURE_AUTHORITY_HOST environment variable. +credential = DefaultAzureCredential(authority=AzureAuthorityHosts.AZURE_GOVERNMENT) + +table_service_client = TableServiceClient( + endpoint="https://<my_account_name>.table.core.usgovcloudapi.net", + credential=credential, + audience="https://storage.azure.us" +) +``` + + ## Key concepts Common uses of the Table service included: * Storing TBs of structured data capable of serving web scale applications @@ -297,7 +325,7 @@ ### General Azure Tables clients raise exceptions defined in [Azure Core][azure_core_readme]. -When you interact with the Azure table library using the Python SDK, errors returned by the service respond ot the same HTTP status codes for [REST API][tables_rest] requests. The Table service operations will throw a `HttpResponseError` on failure with helpful [error codes][tables_error_codes]. +When you interact with the Azure table library using the Python SDK, errors returned by the service respond to the same HTTP status codes for [REST API][tables_rest] requests. The Table service operations will throw a `HttpResponseError` on failure with helpful [error codes][tables_error_codes]. For examples, if you try to create a table that already exists, a `409` error is returned indicating "Conflict". ```python @@ -363,7 +391,7 @@ * Committing many requests in a single transaction: [sample_batching.py](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/tables/azure-data-tables/samples/sample_batching.py) ([async version](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/tables/azure-data-tables/samples/async_samples/sample_batching_async.py)) ### Additional documentation -For more extensive documentation on Azure Tables, see the [Azure Tables documentation][Tables_product_doc] on docs.microsoft.com. +For more extensive documentation on Azure Tables, see the [Azure Tables documentation][Tables_product_doc] on learn.microsoft.com. ## Known Issues A list of currently known issues relating to Cosmos DB table endpoints can be found [here](https://aka.ms/tablesknownissues). @@ -378,43 +406,43 @@ <!-- LINKS --> [source_code]:https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/tables/azure-data-tables [Tables_pypi]:https://aka.ms/azsdk/python/tablespypi -[Tables_ref_docs]:https://docs.microsoft.com/python/api/overview/azure/data-tables-readme?view=azure-python -[Tables_product_doc]:https://docs.microsoft.com/azure/cosmos-db/table-introduction +[Tables_ref_docs]:https://learn.microsoft.com/python/api/overview/azure/data-tables-readme?view=azure-python +[Tables_product_doc]:https://learn.microsoft.com/azure/cosmos-db/table-introduction [Tables_samples]:https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/tables/azure-data-tables/samples [migration_guide]:https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/tables/azure-data-tables/migration_guide.md [azure_subscription]:https://azure.microsoft.com/free/ -[azure_storage_account]:https://docs.microsoft.com/azure/storage/common/storage-account-create?tabs=azure-portal -[azure_cosmos_account]:https://docs.microsoft.com/azure/cosmos-db/create-cosmosdb-resources-portal +[azure_storage_account]:https://learn.microsoft.com/azure/storage/common/storage-account-create?tabs=azure-portal +[azure_cosmos_account]:https://learn.microsoft.com/azure/cosmos-db/create-cosmosdb-resources-portal [pip_link]:https://pypi.org/project/pip/ -[azure_create_cosmos]:https://docs.microsoft.com/azure/cosmos-db/create-cosmosdb-resources-portal -[azure_cli_create_cosmos]:https://docs.microsoft.com/azure/cosmos-db/scripts/cli/table/create -[azure_portal_create_cosmos]:https://docs.microsoft.com/azure/cosmos-db/create-cosmosdb-resources-portal -[azure_portal_create_account]:https://docs.microsoft.com/azure/storage/common/storage-account-create?tabs=azure-portal -[azure_powershell_create_account]:https://docs.microsoft.com/azure/storage/common/storage-account-create?tabs=azure-powershell -[azure_cli_create_account]: https://docs.microsoft.com/azure/storage/common/storage-account-create?tabs=azure-cli - -[azure_cli_account_url]:https://docs.microsoft.com/cli/azure/storage/account?view=azure-cli-latest#az-storage-account-show -[azure_powershell_account_url]:https://docs.microsoft.com/powershell/module/az.storage/get-azstorageaccount?view=azps-4.6.1 -[azure_portal_account_url]:https://docs.microsoft.com/azure/storage/common/storage-account-overview#storage-account-endpoints +[azure_create_cosmos]:https://learn.microsoft.com/azure/cosmos-db/create-cosmosdb-resources-portal +[azure_cli_create_cosmos]:https://learn.microsoft.com/azure/cosmos-db/scripts/cli/table/create +[azure_portal_create_cosmos]:https://learn.microsoft.com/azure/cosmos-db/create-cosmosdb-resources-portal +[azure_portal_create_account]:https://learn.microsoft.com/azure/storage/common/storage-account-create?tabs=azure-portal +[azure_powershell_create_account]:https://learn.microsoft.com/azure/storage/common/storage-account-create?tabs=azure-powershell +[azure_cli_create_account]: https://learn.microsoft.com/azure/storage/common/storage-account-create?tabs=azure-cli + +[azure_cli_account_url]:https://learn.microsoft.com/cli/azure/storage/account?view=azure-cli-latest#az-storage-account-show +[azure_powershell_account_url]:https://learn.microsoft.com/powershell/module/az.storage/get-azstorageaccount?view=azps-4.6.1 +[azure_portal_account_url]:https://learn.microsoft.com/azure/storage/common/storage-account-overview#storage-account-endpoints -[azure_sas_token]:https://docs.microsoft.com/azure/storage/common/storage-sas-overview -[azure_shared_key]:https://docs.microsoft.com/rest/api/storageservices/authorize-with-shared-key +[azure_sas_token]:https://learn.microsoft.com/azure/storage/common/storage-sas-overview +[azure_shared_key]:https://learn.microsoft.com/rest/api/storageservices/authorize-with-shared-key [odata_syntax]:https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/tables/azure-data-tables/samples/README.md#writing-filters -[azure_core_ref_docs]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-core/latest/azure.core.html +[azure_core_ref_docs]: https://azuresdkdocs.z19.web.core.windows.net/python/azure-core/latest/azure.core.html [azure_core_readme]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md [python_logging]: https://docs.python.org/3/library/logging.html -[tables_error_codes]: https://docs.microsoft.com/rest/api/storageservices/table-service-error-codes +[tables_error_codes]: https://learn.microsoft.com/rest/api/storageservices/table-service-error-codes [msft_oss_coc]:https://opensource.microsoft.com/codeofconduct/ [msft_oss_coc_faq]:https://opensource.microsoft.com/codeofconduct/faq/ [contact_msft_oss]:mailto:openc...@microsoft.com -[tables_rest]: https://docs.microsoft.com/rest/api/storageservices/table-service-rest-api +[tables_rest]: https://learn.microsoft.com/rest/api/storageservices/table-service-rest-api [create_entity]:https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/tables/azure-data-tables/samples/sample_insert_delete_entities.py#L67-L73 [delete_entity]:https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/tables/azure-data-tables/samples/sample_insert_delete_entities.py#L89-L92 @@ -422,5 +450,3 @@ [query_entities]:https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/tables/azure-data-tables/samples/sample_query_table.py#L75-L89 [get_entity]:https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/tables/azure-data-tables/samples/sample_update_upsert_merge_entities.py#L67-L71 [upsert_entity]:https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/tables/azure-data-tables/samples/sample_update_upsert_merge_entities.py#L155-L163 - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure_data_tables-12.6.0/azure/data/tables/_authentication.py new/azure_data_tables-12.7.0/azure/data/tables/_authentication.py --- old/azure_data_tables-12.6.0/azure/data/tables/_authentication.py 2024-11-21 17:18:16.000000000 +0100 +++ new/azure_data_tables-12.7.0/azure/data/tables/_authentication.py 2025-05-06 01:15:52.000000000 +0200 @@ -26,7 +26,7 @@ """ Represents a fatal error when attempting to sign a request. In general, the cause of this exception is user error. For example, the given account key is not valid. - Please visit https://docs.microsoft.com/en-us/azure/storage/common/storage-create-storage-account for more info. + Please visit https://learn.microsoft.com/en-us/azure/storage/common/storage-create-storage-account for more info. """ @@ -160,8 +160,8 @@ class BearerTokenChallengePolicy(BearerTokenCredentialPolicy): """Adds a bearer token Authorization header to requests, for the tenant provided in authentication challenges. - See https://docs.microsoft.com/azure/active-directory/develop/claims-challenge for documentation on AAD - authentication challenges. + See https://learn.microsoft.com/azure/active-directory/develop/claims-challenge for documentation on Microsoft + Entra authentication challenges. :param credential: The credential. :type credential: ~azure.core.TokenCredential @@ -209,30 +209,44 @@ return False if self._discover_tenant: - self.authorize_request(request, scope, tenant_id=challenge.tenant_id) + if isinstance(scope, str): + self.authorize_request(request, scope, tenant_id=challenge.tenant_id) + else: + self.authorize_request(request, *scope, tenant_id=challenge.tenant_id) else: - self.authorize_request(request, scope) + if isinstance(scope, str): + self.authorize_request(request, scope) + else: + self.authorize_request(request, *scope) return True @overload -def _configure_credential(credential: AzureNamedKeyCredential) -> SharedKeyCredentialPolicy: ... +def _configure_credential( + credential: AzureNamedKeyCredential, cosmos_endpoint: bool = False, audience: Optional[str] = None +) -> SharedKeyCredentialPolicy: ... @overload -def _configure_credential(credential: SharedKeyCredentialPolicy) -> SharedKeyCredentialPolicy: ... +def _configure_credential( + credential: SharedKeyCredentialPolicy, cosmos_endpoint: bool = False, audience: Optional[str] = None +) -> SharedKeyCredentialPolicy: ... @overload -def _configure_credential(credential: AzureSasCredential) -> AzureSasCredentialPolicy: ... +def _configure_credential( + credential: AzureSasCredential, cosmos_endpoint: bool = False, audience: Optional[str] = None +) -> AzureSasCredentialPolicy: ... @overload -def _configure_credential(credential: TokenCredential) -> BearerTokenChallengePolicy: ... +def _configure_credential( + credential: TokenCredential, cosmos_endpoint: bool = False, audience: Optional[str] = None +) -> BearerTokenChallengePolicy: ... @overload -def _configure_credential(credential: None) -> None: ... +def _configure_credential(credential: None, cosmos_endpoint: bool = False, audience: Optional[str] = None) -> None: ... def _configure_credential( @@ -240,10 +254,14 @@ Union[AzureNamedKeyCredential, AzureSasCredential, TokenCredential, SharedKeyCredentialPolicy] ], cosmos_endpoint: bool = False, + audience: Optional[str] = None, ) -> Optional[Union[BearerTokenChallengePolicy, AzureSasCredentialPolicy, SharedKeyCredentialPolicy]]: if hasattr(credential, "get_token"): credential = cast(TokenCredential, credential) - scope = COSMOS_OAUTH_SCOPE if cosmos_endpoint else STORAGE_OAUTH_SCOPE + if audience: + scope = audience.rstrip("/") + "/.default" + else: + scope = COSMOS_OAUTH_SCOPE if cosmos_endpoint else STORAGE_OAUTH_SCOPE return BearerTokenChallengePolicy(credential, scope) if isinstance(credential, SharedKeyCredentialPolicy): return credential diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure_data_tables-12.6.0/azure/data/tables/_base_client.py new/azure_data_tables-12.7.0/azure/data/tables/_base_client.py --- old/azure_data_tables-12.6.0/azure/data/tables/_base_client.py 2024-11-21 17:18:16.000000000 +0100 +++ new/azure_data_tables-12.7.0/azure/data/tables/_base_client.py 2025-05-06 01:15:52.000000000 +0200 @@ -7,7 +7,7 @@ import os from uuid import uuid4 from urllib.parse import parse_qs, quote, urlparse -from typing import Any, List, Optional, Mapping, Union +from typing import Any, List, Optional, Mapping, Union, Literal from typing_extensions import Self from azure.core.credentials import AzureSasCredential, AzureNamedKeyCredential, TokenCredential @@ -48,6 +48,18 @@ # cspell:disable-next-line _DEV_CONN_STRING = "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1" # pylint: disable=line-too-long +AudienceType = Union[ + str, + Literal[ + "https://storage.azure.com", + "https://storage.azure.us", + "https://storage.azure.cn", + "https://cosmos.azure.com", + "https://cosmos.azure.us", + "https://cosmos.azure.cn", + ], +] + def get_api_version(api_version: Optional[str], default: str) -> str: if api_version and api_version not in _SUPPORTED_API_VERSIONS: @@ -71,6 +83,7 @@ *, credential: Optional[Union[AzureSasCredential, AzureNamedKeyCredential, TokenCredential]] = None, api_version: Optional[str] = None, + audience: Optional[AudienceType] = None, **kwargs: Any, ) -> None: """ @@ -83,6 +96,9 @@ ~azure.core.credentials.AzureNamedKeyCredential or ~azure.core.credentials.AzureSasCredential or ~azure.core.credentials.TokenCredential or None + :keyword audience: Optional audience to use for Microsoft Entra ID authentication. If not specified, + the public cloud audience will be used. + :paramtype audience: str or None :keyword api_version: Specifies the version of the operation to use for this request. Default value is "2019-02-02". :paramtype api_version: str or None @@ -129,7 +145,7 @@ } self._hosts = _hosts - self._policies = self._configure_policies(hosts=self._hosts, **kwargs) + self._policies = self._configure_policies(audience=audience, hosts=self._hosts, **kwargs) if self._cosmos_endpoint: self._policies.insert(0, CosmosPatchTransformPolicy()) @@ -222,8 +238,10 @@ """ return f"{self.scheme}://{hostname}{self._query_str}" - def _configure_policies(self, **kwargs): - credential_policy = _configure_credential(self.credential, self._cosmos_endpoint) + def _configure_policies(self, *, audience: Optional[str] = None, **kwargs: Any) -> List[Any]: + credential_policy = _configure_credential( + self.credential, cosmos_endpoint=self._cosmos_endpoint, audience=audience + ) return [ RequestIdPolicy(**kwargs), StorageHeadersPolicy(**kwargs), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure_data_tables-12.6.0/azure/data/tables/_table_client.py new/azure_data_tables-12.7.0/azure/data/tables/_table_client.py --- old/azure_data_tables-12.6.0/azure/data/tables/_table_client.py 2024-11-21 17:18:16.000000000 +0100 +++ new/azure_data_tables-12.7.0/azure/data/tables/_table_client.py 2025-05-06 01:15:52.000000000 +0200 @@ -14,7 +14,7 @@ from azure.core.paging import ItemPaged from azure.core.tracing.decorator import distributed_trace -from ._base_client import parse_connection_str, TablesBaseClient +from ._base_client import parse_connection_str, TablesBaseClient, AudienceType from ._entity import TableEntity from ._error import ( _decode_error, @@ -60,6 +60,7 @@ table_name: str, *, credential: Optional[Union[AzureSasCredential, AzureNamedKeyCredential, TokenCredential]] = None, + audience: Optional[AudienceType] = None, api_version: Optional[str] = None, **kwargs: Any, ) -> None: @@ -75,6 +76,9 @@ ~azure.core.credentials.AzureNamedKeyCredential or ~azure.core.credentials.AzureSasCredential or ~azure.core.credentials.TokenCredential or None + :keyword audience: Optional audience to use for Microsoft Entra ID authentication. If not specified, + the public cloud audience will be used. + :paramtype audience: str or None :keyword api_version: Specifies the version of the operation to use for this request. Default value is "2019-02-02". :paramtype api_version: str or None @@ -83,7 +87,9 @@ if not table_name: raise ValueError("Please specify a table name.") self.table_name: str = table_name - super(TableClient, self).__init__(endpoint, credential=credential, api_version=api_version, **kwargs) + super(TableClient, self).__init__( + endpoint, credential=credential, api_version=api_version, audience=audience, **kwargs + ) @classmethod def from_connection_string(cls, conn_str: str, table_name: str, **kwargs: Any) -> "TableClient": diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure_data_tables-12.6.0/azure/data/tables/_version.py new/azure_data_tables-12.7.0/azure/data/tables/_version.py --- old/azure_data_tables-12.6.0/azure/data/tables/_version.py 2024-11-21 17:18:16.000000000 +0100 +++ new/azure_data_tables-12.7.0/azure/data/tables/_version.py 2025-05-06 01:15:52.000000000 +0200 @@ -4,4 +4,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "12.6.0" +VERSION = "12.7.0" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure_data_tables-12.6.0/azure/data/tables/aio/_authentication_async.py new/azure_data_tables-12.7.0/azure/data/tables/aio/_authentication_async.py --- old/azure_data_tables-12.6.0/azure/data/tables/aio/_authentication_async.py 2024-11-21 17:18:16.000000000 +0100 +++ new/azure_data_tables-12.7.0/azure/data/tables/aio/_authentication_async.py 2025-05-06 01:15:52.000000000 +0200 @@ -17,8 +17,8 @@ class AsyncBearerTokenChallengePolicy(AsyncBearerTokenCredentialPolicy): """Adds a bearer token Authorization header to requests, for the tenant provided in authentication challenges. - See https://docs.microsoft.com/azure/active-directory/develop/claims-challenge for documentation on AAD - authentication challenges. + See https://learn.microsoft.com/azure/active-directory/develop/claims-challenge for documentation on Microsoft + Entra authentication challenges. :param credential: The credential. :type credential: ~azure.core.credentials_async.AsyncTokenCredential @@ -65,30 +65,44 @@ return False if self._discover_tenant: - await self.authorize_request(request, scope, tenant_id=challenge.tenant_id) + if isinstance(scope, str): + await self.authorize_request(request, scope, tenant_id=challenge.tenant_id) + else: + await self.authorize_request(request, *scope, tenant_id=challenge.tenant_id) else: - await self.authorize_request(request, scope) + if isinstance(scope, str): + await self.authorize_request(request, scope) + else: + await self.authorize_request(request, *scope) return True @overload -def _configure_credential(credential: AzureNamedKeyCredential) -> SharedKeyCredentialPolicy: ... +def _configure_credential( + credential: AzureNamedKeyCredential, cosmos_endpoint: bool = False, audience: Optional[str] = None +) -> SharedKeyCredentialPolicy: ... @overload -def _configure_credential(credential: SharedKeyCredentialPolicy) -> SharedKeyCredentialPolicy: ... +def _configure_credential( + credential: SharedKeyCredentialPolicy, cosmos_endpoint: bool = False, audience: Optional[str] = None +) -> SharedKeyCredentialPolicy: ... @overload -def _configure_credential(credential: AzureSasCredential) -> AzureSasCredentialPolicy: ... +def _configure_credential( + credential: AzureSasCredential, cosmos_endpoint: bool = False, audience: Optional[str] = None +) -> AzureSasCredentialPolicy: ... @overload -def _configure_credential(credential: AsyncTokenCredential) -> AsyncBearerTokenChallengePolicy: ... +def _configure_credential( + credential: AsyncTokenCredential, cosmos_endpoint: bool = False, audience: Optional[str] = None +) -> AsyncBearerTokenChallengePolicy: ... @overload -def _configure_credential(credential: None) -> None: ... +def _configure_credential(credential: None, cosmos_endpoint: bool = False, audience: Optional[str] = None) -> None: ... def _configure_credential( @@ -96,10 +110,14 @@ Union[AzureNamedKeyCredential, AzureSasCredential, AsyncTokenCredential, SharedKeyCredentialPolicy] ], cosmos_endpoint: bool = False, + audience: Optional[str] = None, ) -> Optional[Union[AsyncBearerTokenChallengePolicy, AzureSasCredentialPolicy, SharedKeyCredentialPolicy]]: if hasattr(credential, "get_token"): credential = cast(AsyncTokenCredential, credential) - scope = COSMOS_OAUTH_SCOPE if cosmos_endpoint else STORAGE_OAUTH_SCOPE + if audience: + scope = audience.rstrip("/") + "/.default" + else: + scope = COSMOS_OAUTH_SCOPE if cosmos_endpoint else STORAGE_OAUTH_SCOPE return AsyncBearerTokenChallengePolicy(credential, scope) if isinstance(credential, SharedKeyCredentialPolicy): return credential diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure_data_tables-12.6.0/azure/data/tables/aio/_base_client_async.py new/azure_data_tables-12.7.0/azure/data/tables/aio/_base_client_async.py --- old/azure_data_tables-12.6.0/azure/data/tables/aio/_base_client_async.py 2024-11-21 17:18:16.000000000 +0100 +++ new/azure_data_tables-12.7.0/azure/data/tables/aio/_base_client_async.py 2025-05-06 01:15:52.000000000 +0200 @@ -30,7 +30,7 @@ from .._common_conversion import _is_cosmos_endpoint, _get_account from .._constants import DEFAULT_STORAGE_ENDPOINT_SUFFIX from .._generated.aio import AzureTable -from .._base_client import extract_batch_part_metadata, parse_query, format_query_string, get_api_version +from .._base_client import extract_batch_part_metadata, parse_query, format_query_string, get_api_version, AudienceType from .._error import ( RequestTooLargeError, TableTransactionError, @@ -57,6 +57,7 @@ endpoint: str, *, credential: Optional[Union[AzureSasCredential, AzureNamedKeyCredential, AsyncTokenCredential]] = None, + audience: Optional[AudienceType] = None, api_version: Optional[str] = None, **kwargs: Any, ) -> None: @@ -70,6 +71,9 @@ ~azure.core.credentials.AzureNamedKeyCredential or ~azure.core.credentials.AzureSasCredential or ~azure.core.credentials_async.AsyncTokenCredential or None + :keyword audience: Optional audience to use for Microsoft Entra ID authentication. If not specified, + the public cloud audience will be used. + :paramtype audience: str or None :keyword api_version: Specifies the version of the operation to use for this request. Default value is "2019-02-02". :paramtype api_version: str or None @@ -116,7 +120,7 @@ } self._hosts = _hosts - self._policies = self._configure_policies(hosts=self._hosts, **kwargs) + self._policies = self._configure_policies(audience=audience, hosts=self._hosts, **kwargs) if self._cosmos_endpoint: self._policies.insert(0, CosmosPatchTransformPolicy()) @@ -215,8 +219,8 @@ """ return f"{self.scheme}://{hostname}{self._query_str}" - def _configure_policies(self, **kwargs): - credential_policy = _configure_credential(self.credential, self._cosmos_endpoint) + def _configure_policies(self, *, audience: Optional[str] = None, **kwargs: Any) -> List[Any]: + credential_policy = _configure_credential(self.credential, self._cosmos_endpoint, audience=audience) return [ RequestIdPolicy(**kwargs), StorageHeadersPolicy(**kwargs), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure_data_tables-12.6.0/azure/data/tables/aio/_table_client_async.py new/azure_data_tables-12.7.0/azure/data/tables/aio/_table_client_async.py --- old/azure_data_tables-12.6.0/azure/data/tables/aio/_table_client_async.py 2024-11-21 17:18:16.000000000 +0100 +++ new/azure_data_tables-12.7.0/azure/data/tables/aio/_table_client_async.py 2025-05-06 01:15:52.000000000 +0200 @@ -16,7 +16,7 @@ from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async -from .._base_client import parse_connection_str +from .._base_client import parse_connection_str, AudienceType from .._entity import TableEntity from .._generated.models import SignedIdentifier, TableProperties from .._models import TableAccessPolicy, TableItem, UpdateMode @@ -65,6 +65,7 @@ table_name: str, *, credential: Optional[Union[AzureSasCredential, AzureNamedKeyCredential, AsyncTokenCredential]] = None, + audience: Optional[AudienceType] = None, api_version: Optional[str] = None, **kwargs: Any, ) -> None: @@ -80,6 +81,9 @@ ~azure.core.credentials.AzureNamedKeyCredential or ~azure.core.credentials.AzureSasCredential or ~azure.core.credentials_async.AsyncTokenCredential or None + :keyword audience: Optional audience to use for Microsoft Entra ID authentication. If not specified, + the public cloud audience will be used. + :paramtype audience: str or None :keyword api_version: Specifies the version of the operation to use for this request. Default value is "2019-02-02". :paramtype api_version: str or None @@ -88,7 +92,9 @@ if not table_name: raise ValueError("Please specify a table name.") self.table_name: str = table_name - super(TableClient, self).__init__(endpoint, credential=credential, api_version=api_version, **kwargs) + super(TableClient, self).__init__( + endpoint, credential=credential, api_version=api_version, audience=audience, **kwargs + ) @classmethod def from_connection_string(cls, conn_str: str, table_name: str, **kwargs: Any) -> "TableClient": diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure_data_tables-12.6.0/azure_data_tables.egg-info/PKG-INFO new/azure_data_tables-12.7.0/azure_data_tables.egg-info/PKG-INFO --- old/azure_data_tables-12.6.0/azure_data_tables.egg-info/PKG-INFO 2024-11-21 17:20:04.000000000 +0100 +++ new/azure_data_tables-12.7.0/azure_data_tables.egg-info/PKG-INFO 2025-05-06 01:17:46.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: azure-data-tables -Version: 12.6.0 +Version: 12.7.0 Summary: Microsoft Azure Azure Data Tables Client Library for Python Home-page: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/tables/azure-data-tables Author: Microsoft Corporation @@ -11,13 +11,13 @@ Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 Classifier: License :: OSI Approved :: MIT License -Requires-Python: >=3.8 +Requires-Python: >=3.9 Description-Content-Type: text/markdown License-File: LICENSE Requires-Dist: azure-core>=1.29.4 @@ -43,7 +43,7 @@ The Azure Tables SDK can access an Azure Storage or CosmosDB account. ### Prerequisites -* Python 3.8 or later is required to use this package. +* Python 3.9 or later is required to use this package. * You must have an [Azure subscription][azure_subscription] and either * an [Azure Storage account][azure_storage_account] or * an [Azure Cosmos Account][azure_cosmos_account]. @@ -82,7 +82,7 @@ * Shared Key * Connection String * Shared Access Signature Token -* TokenCredential(AAD)(Supported on Storage) +* TokenCredential (Microsoft Entra ID)(Supported on Storage) ##### Creating the client from a shared key To use an account [shared key][azure_shared_key] (aka account key or access key), provide the key as a string. This can be found in your storage account in the [Azure Portal][azure_portal_account_url] under the "Access Keys" section or by running the following Azure CLI command: @@ -106,7 +106,7 @@ ``` ##### Creating the client from a connection string -Depending on your use case and authorization method, you may prefer to initialize a client instance with a connection string instead of providing the account URL and credential separately. To do this, pass the connection string to the client's `from_connection_string` class method. If the connection string does not specify a fully qualified endpoint URL (`"TableEndpoint"`), or URL suffix (`"EndpointSuffix"`), the endpoint will be assumed to be an Azure Storage account, and the URL automatically formatted accordingly. +Depending on your use case and authorization method, you may prefer to initialize a client instance with a connection string instead of providing the account URL and credential separately. To do this, pass the connection string to the client's `from_connection_string` class method. If the connection string does not specify a fully qualified endpoint URL (`"TableEndpoint"`), or URL suffix (`"EndpointSuffix"`), the endpoint will be assumed to be an Azure Storage account, and the URL automatically formatted accordingly. For Tables Storage, the connection string can be found in your storage account in the [Azure Portal][azure_portal_account_url] under the "Access Keys" section or with the following Azure CLI command: @@ -132,7 +132,7 @@ ``` ##### Creating the client from a SAS token -To use a [shared access signature (SAS) token][azure_sas_token], provide the token as a string. If your account URL includes the SAS token, omit the credential parameter. You can generate a SAS token from the Azure Portal under [Shared access signature](https://docs.microsoft.com/rest/api/storageservices/create-service-sas) or use one of the `generate_*_sas()` functions to create a sas token for the account or table: +To use a [shared access signature (SAS) token][azure_sas_token], provide the token as a string. If your account URL includes the SAS token, omit the credential parameter. You can generate a SAS token from the Azure Portal under [Shared access signature](https://learn.microsoft.com/rest/api/storageservices/create-service-sas) or use one of the `generate_*_sas()` functions to create a sas token for the account or table: ```python from datetime import datetime, timedelta @@ -156,11 +156,12 @@ ``` ##### Creating the client from a TokenCredential -Azure Tables provides integration with Azure Active Directory(Azure AD) for identity-based authentication of requests to the Table service when targeting a Storage endpoint. With Azure AD, you can use role-based access control(RBAC) to grant access to your Azure Table resources to users, groups, or applications. + +Azure Tables provides integration with Microsoft Entra ID for identity-based authentication of requests to the Table service when targeting a Storage endpoint. With Microsoft Entra ID, you can use role-based access control (RBAC) to grant access to your Azure Table resources to users, groups, or applications. To access a table resource with a TokenCredential, the authenticated identity should have either the "Storage Table Data Contributor" or "Storage Table Data Reader" role. -With the `azure-identity` package, you can seamlessly authorize requests in both development and production environments. To learn more about Azure AD integration in Azure Storage, see the [azure-identity README](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/identity/azure-identity/README.md) +With the `azure-identity` package, you can seamlessly authorize requests in both development and production environments. To learn more about Microsoft Entra ID integration in Azure Storage, see the [azure-identity README](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/identity/azure-identity/README.md) ```python from azure.data.tables import TableServiceClient @@ -173,6 +174,33 @@ print(f"{properties}") ``` +###### Configure client for an Azure sovereign cloud + +When TokenCredential authentication is used, all clients are configured to use the Azure public cloud by default. To configure a client for a sovereign cloud, you should provide the correct `audience` keyword argument when creating the client. The following table lists some known audiences: + +| Cloud | Audience | +|-------|----------| +| Azure Public | https://storage.azure.com / https://cosmos.azure.com | +| Azure US Government | https://storage.azure.us / https://cosmos.azure.us | +| Azure China | https://storage.chinacloudapi.cn / https://cosmos.chinacloudapi.cn | + +The following example shows how to configure the `TableServiceClient` to connect to Azure US Government: + +```python +from azure.data.tables import TableServiceClient +from azure.identity import AzureAuthorityHosts, DefaultAzureCredential + +# Authority can also be set via the AZURE_AUTHORITY_HOST environment variable. +credential = DefaultAzureCredential(authority=AzureAuthorityHosts.AZURE_GOVERNMENT) + +table_service_client = TableServiceClient( + endpoint="https://<my_account_name>.table.core.usgovcloudapi.net", + credential=credential, + audience="https://storage.azure.us" +) +``` + + ## Key concepts Common uses of the Table service included: * Storing TBs of structured data capable of serving web scale applications @@ -324,7 +352,7 @@ ### General Azure Tables clients raise exceptions defined in [Azure Core][azure_core_readme]. -When you interact with the Azure table library using the Python SDK, errors returned by the service respond ot the same HTTP status codes for [REST API][tables_rest] requests. The Table service operations will throw a `HttpResponseError` on failure with helpful [error codes][tables_error_codes]. +When you interact with the Azure table library using the Python SDK, errors returned by the service respond to the same HTTP status codes for [REST API][tables_rest] requests. The Table service operations will throw a `HttpResponseError` on failure with helpful [error codes][tables_error_codes]. For examples, if you try to create a table that already exists, a `409` error is returned indicating "Conflict". ```python @@ -390,7 +418,7 @@ * Committing many requests in a single transaction: [sample_batching.py](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/tables/azure-data-tables/samples/sample_batching.py) ([async version](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/tables/azure-data-tables/samples/async_samples/sample_batching_async.py)) ### Additional documentation -For more extensive documentation on Azure Tables, see the [Azure Tables documentation][Tables_product_doc] on docs.microsoft.com. +For more extensive documentation on Azure Tables, see the [Azure Tables documentation][Tables_product_doc] on learn.microsoft.com. ## Known Issues A list of currently known issues relating to Cosmos DB table endpoints can be found [here](https://aka.ms/tablesknownissues). @@ -405,43 +433,43 @@ <!-- LINKS --> [source_code]:https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/tables/azure-data-tables [Tables_pypi]:https://aka.ms/azsdk/python/tablespypi -[Tables_ref_docs]:https://docs.microsoft.com/python/api/overview/azure/data-tables-readme?view=azure-python -[Tables_product_doc]:https://docs.microsoft.com/azure/cosmos-db/table-introduction +[Tables_ref_docs]:https://learn.microsoft.com/python/api/overview/azure/data-tables-readme?view=azure-python +[Tables_product_doc]:https://learn.microsoft.com/azure/cosmos-db/table-introduction [Tables_samples]:https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/tables/azure-data-tables/samples [migration_guide]:https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/tables/azure-data-tables/migration_guide.md [azure_subscription]:https://azure.microsoft.com/free/ -[azure_storage_account]:https://docs.microsoft.com/azure/storage/common/storage-account-create?tabs=azure-portal -[azure_cosmos_account]:https://docs.microsoft.com/azure/cosmos-db/create-cosmosdb-resources-portal +[azure_storage_account]:https://learn.microsoft.com/azure/storage/common/storage-account-create?tabs=azure-portal +[azure_cosmos_account]:https://learn.microsoft.com/azure/cosmos-db/create-cosmosdb-resources-portal [pip_link]:https://pypi.org/project/pip/ -[azure_create_cosmos]:https://docs.microsoft.com/azure/cosmos-db/create-cosmosdb-resources-portal -[azure_cli_create_cosmos]:https://docs.microsoft.com/azure/cosmos-db/scripts/cli/table/create -[azure_portal_create_cosmos]:https://docs.microsoft.com/azure/cosmos-db/create-cosmosdb-resources-portal -[azure_portal_create_account]:https://docs.microsoft.com/azure/storage/common/storage-account-create?tabs=azure-portal -[azure_powershell_create_account]:https://docs.microsoft.com/azure/storage/common/storage-account-create?tabs=azure-powershell -[azure_cli_create_account]: https://docs.microsoft.com/azure/storage/common/storage-account-create?tabs=azure-cli - -[azure_cli_account_url]:https://docs.microsoft.com/cli/azure/storage/account?view=azure-cli-latest#az-storage-account-show -[azure_powershell_account_url]:https://docs.microsoft.com/powershell/module/az.storage/get-azstorageaccount?view=azps-4.6.1 -[azure_portal_account_url]:https://docs.microsoft.com/azure/storage/common/storage-account-overview#storage-account-endpoints +[azure_create_cosmos]:https://learn.microsoft.com/azure/cosmos-db/create-cosmosdb-resources-portal +[azure_cli_create_cosmos]:https://learn.microsoft.com/azure/cosmos-db/scripts/cli/table/create +[azure_portal_create_cosmos]:https://learn.microsoft.com/azure/cosmos-db/create-cosmosdb-resources-portal +[azure_portal_create_account]:https://learn.microsoft.com/azure/storage/common/storage-account-create?tabs=azure-portal +[azure_powershell_create_account]:https://learn.microsoft.com/azure/storage/common/storage-account-create?tabs=azure-powershell +[azure_cli_create_account]: https://learn.microsoft.com/azure/storage/common/storage-account-create?tabs=azure-cli + +[azure_cli_account_url]:https://learn.microsoft.com/cli/azure/storage/account?view=azure-cli-latest#az-storage-account-show +[azure_powershell_account_url]:https://learn.microsoft.com/powershell/module/az.storage/get-azstorageaccount?view=azps-4.6.1 +[azure_portal_account_url]:https://learn.microsoft.com/azure/storage/common/storage-account-overview#storage-account-endpoints -[azure_sas_token]:https://docs.microsoft.com/azure/storage/common/storage-sas-overview -[azure_shared_key]:https://docs.microsoft.com/rest/api/storageservices/authorize-with-shared-key +[azure_sas_token]:https://learn.microsoft.com/azure/storage/common/storage-sas-overview +[azure_shared_key]:https://learn.microsoft.com/rest/api/storageservices/authorize-with-shared-key [odata_syntax]:https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/tables/azure-data-tables/samples/README.md#writing-filters -[azure_core_ref_docs]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-core/latest/azure.core.html +[azure_core_ref_docs]: https://azuresdkdocs.z19.web.core.windows.net/python/azure-core/latest/azure.core.html [azure_core_readme]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md [python_logging]: https://docs.python.org/3/library/logging.html -[tables_error_codes]: https://docs.microsoft.com/rest/api/storageservices/table-service-error-codes +[tables_error_codes]: https://learn.microsoft.com/rest/api/storageservices/table-service-error-codes [msft_oss_coc]:https://opensource.microsoft.com/codeofconduct/ [msft_oss_coc_faq]:https://opensource.microsoft.com/codeofconduct/faq/ [contact_msft_oss]:mailto:openc...@microsoft.com -[tables_rest]: https://docs.microsoft.com/rest/api/storageservices/table-service-rest-api +[tables_rest]: https://learn.microsoft.com/rest/api/storageservices/table-service-rest-api [create_entity]:https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/tables/azure-data-tables/samples/sample_insert_delete_entities.py#L67-L73 [delete_entity]:https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/tables/azure-data-tables/samples/sample_insert_delete_entities.py#L89-L92 @@ -450,11 +478,19 @@ [get_entity]:https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/tables/azure-data-tables/samples/sample_update_upsert_merge_entities.py#L67-L71 [upsert_entity]:https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/tables/azure-data-tables/samples/sample_update_upsert_merge_entities.py#L155-L163 - - # Release History +## 12.7.0 (2025-05-06) + +### Features Added + +* Added support for configuring custom audiences for `TokenCredential` authentication when initializing a `TableClient` or `TableServiceClient`. ([#40487](https://github.com/Azure/azure-sdk-for-python/pull/40487)) + +### Other Changes + +* Python 3.8 is no longer supported. Please use Python version 3.9 or later. + ## 12.6.0 (2024-11-21) ### Features Added diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure_data_tables-12.6.0/samples/README.md new/azure_data_tables-12.7.0/samples/README.md --- old/azure_data_tables-12.6.0/samples/README.md 2024-11-21 17:18:16.000000000 +0100 +++ new/azure_data_tables-12.7.0/samples/README.md 2025-05-06 01:15:52.000000000 +0200 @@ -32,7 +32,7 @@ ### Prerequisites * Python 3.8 or later is required to use this package. * You must have an [Azure subscription](https://azure.microsoft.com/free/) and either an -[Azure storage account](https://docs.microsoft.com/azure/storage/common/storage-account-overview) or an [Azure Cosmos Account](https://docs.microsoft.com/azure/cosmos-db/account-overview) to use this package. +[Azure storage account](https://learn.microsoft.com/azure/storage/common/storage-account-overview) or an [Azure Cosmos Account](https://learn.microsoft.com/azure/cosmos-db/account-overview) to use this package. ## Setup @@ -150,8 +150,8 @@ <!-- LINKS --> -[api_reference_documentation]: https://docs.microsoft.com/rest/api/storageservices/table-service-rest-api -[query_reference_documentation]: https://docs.microsoft.com/rest/api/storageservices/querying-tables-and-entities +[api_reference_documentation]: https://learn.microsoft.com/rest/api/storageservices/table-service-rest-api +[query_reference_documentation]: https://learn.microsoft.com/rest/api/storageservices/querying-tables-and-entities [sample_authentication]:https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/tables/azure-data-tables/samples/sample_authentication.py [sample_authentication_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/tables/azure-data-tables/samples/async_samples/sample_authentication_async.py @@ -183,4 +183,4 @@ [sample_get_entity_etag_and_timestamp]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/tables/azure-data-tables/samples/sample_get_entity_etag_and_timestamp.py [sample_get_entity_etag_and_timestamp_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/tables/azure-data-tables/samples/async_samples/sample_get_entity_etag_and_timestamp_async.py - \ No newline at end of file + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure_data_tables-12.6.0/samples/async_samples/sample_authentication_async.py new/azure_data_tables-12.7.0/samples/async_samples/sample_authentication_async.py --- old/azure_data_tables-12.6.0/samples/async_samples/sample_authentication_async.py 2024-11-21 17:18:16.000000000 +0100 +++ new/azure_data_tables-12.7.0/samples/async_samples/sample_authentication_async.py 2025-05-06 01:15:52.000000000 +0200 @@ -15,7 +15,7 @@ * shared access key * generating a sas token with which the returned signature can be used with the credential parameter of any TableServiceClient or TableClient - * Azure Active Directory(AAD) + * Microsoft Entra ID USAGE: python sample_authentication_async.py @@ -27,7 +27,7 @@ The following environment variables are required for using azure-identity's DefaultAzureCredential. For more information, please refer to https://aka.ms/azsdk/python/identity/docs#azure.identity.DefaultAzureCredential 4) AZURE_TENANT_ID - the tenant ID in Azure Active Directory - 5) AZURE_CLIENT_ID - the application (client) ID registered in the AAD tenant + 5) AZURE_CLIENT_ID - the application (client) ID registered in the Microsoft Entra tenant 6) AZURE_CLIENT_SECRET - the client secret for the registered application """ @@ -91,7 +91,7 @@ print(f"{properties}") # [END auth_by_sas] - async def authentication_by_AAD(self): + async def authentication_by_entra(self): print("Instantiate a TableServiceClient using a TokenCredential") # [START auth_from_aad] from azure.data.tables.aio import TableServiceClient @@ -110,7 +110,7 @@ await sample.authentication_by_connection_string() await sample.authentication_by_shared_key() await sample.authentication_by_shared_access_signature() - await sample.authentication_by_AAD() + await sample.authentication_by_entra() if __name__ == "__main__": diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure_data_tables-12.6.0/samples/sample_authentication.py new/azure_data_tables-12.7.0/samples/sample_authentication.py --- old/azure_data_tables-12.6.0/samples/sample_authentication.py 2024-11-21 17:18:16.000000000 +0100 +++ new/azure_data_tables-12.7.0/samples/sample_authentication.py 2025-05-06 01:15:52.000000000 +0200 @@ -15,7 +15,7 @@ * shared access key * generating a sas token with which the returned signature can be used with the credential parameter of any TableServiceClient or TableClient - * Azure Active Directory(AAD) + * Microsoft Entra ID USAGE: python sample_authentication.py @@ -27,7 +27,7 @@ The following environment variables are required for using azure-identity's DefaultAzureCredential. For more information, please refer to https://aka.ms/azsdk/python/identity/docs#azure.identity.DefaultAzureCredential 4) AZURE_TENANT_ID - the tenant ID in Azure Active Directory - 5) AZURE_CLIENT_ID - the application (client) ID registered in the AAD tenant + 5) AZURE_CLIENT_ID - the application (client) ID registered in the Microsoft Entra tenant 6) AZURE_CLIENT_SECRET - the client secret for the registered application """ @@ -89,7 +89,7 @@ print(f"{properties}") # [END auth_from_sas] - def authentication_by_AAD(self): + def authentication_by_entra(self): print("Instantiate a TableServiceClient using a TokenCredential") # [START auth_from_aad] from azure.data.tables import TableServiceClient @@ -106,4 +106,4 @@ sample.authentication_by_connection_string() sample.authentication_by_shared_key() sample.authentication_by_shared_access_signature() - sample.authentication_by_AAD() + sample.authentication_by_entra() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure_data_tables-12.6.0/setup.py new/azure_data_tables-12.7.0/setup.py --- old/azure_data_tables-12.6.0/setup.py 2024-11-21 17:18:16.000000000 +0100 +++ new/azure_data_tables-12.7.0/setup.py 2025-05-06 01:15:52.000000000 +0200 @@ -49,11 +49,11 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "License :: OSI Approved :: MIT License", ], zip_safe=False, @@ -65,7 +65,7 @@ "azure.data", ] ), - python_requires=">=3.8", + python_requires=">=3.9", install_requires=[ "azure-core>=1.29.4", "yarl>=1.0", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure_data_tables-12.6.0/tests/_shared/asynctestcase.py new/azure_data_tables-12.7.0/tests/_shared/asynctestcase.py --- old/azure_data_tables-12.6.0/tests/_shared/asynctestcase.py 2024-11-21 17:18:16.000000000 +0100 +++ new/azure_data_tables-12.7.0/tests/_shared/asynctestcase.py 2025-05-06 01:15:52.000000000 +0200 @@ -4,7 +4,6 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from __future__ import division from datetime import datetime, timezone import uuid diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure_data_tables-12.6.0/tests/_shared/testcase.py new/azure_data_tables-12.7.0/tests/_shared/testcase.py --- old/azure_data_tables-12.6.0/tests/_shared/testcase.py 2024-11-21 17:18:16.000000000 +0100 +++ new/azure_data_tables-12.7.0/tests/_shared/testcase.py 2025-05-06 01:15:52.000000000 +0200 @@ -4,7 +4,6 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from __future__ import division from base64 import b64encode from datetime import datetime, timedelta, timezone import uuid @@ -320,7 +319,7 @@ self._assert_logging_equal(prop["analytics_logging"], TableAnalyticsLogging()) self._assert_metrics_equal(prop["hour_metrics"], TableMetrics()) self._assert_metrics_equal(prop["minute_metrics"], TableMetrics()) - self._assert_cors_equal(prop["cors"], list()) + self._assert_cors_equal(prop["cors"], []) def _assert_policy_datetime(self, val1, val2): assert isinstance(val2, datetime) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure_data_tables-12.6.0/tests/test_challenge_auth.py new/azure_data_tables-12.7.0/tests/test_challenge_auth.py --- old/azure_data_tables-12.6.0/tests/test_challenge_auth.py 2024-11-21 17:18:16.000000000 +0100 +++ new/azure_data_tables-12.7.0/tests/test_challenge_auth.py 2025-05-06 01:15:52.000000000 +0200 @@ -35,7 +35,7 @@ Recorded using an incorrect tenant for the credential provided to our client. To run this live, ensure that the service principal used for testing is enabled for multitenant authentication - (https://docs.microsoft.com/azure/active-directory/develop/howto-convert-app-to-be-multi-tenant). Set the + (https://learn.microsoft.com/azure/active-directory/develop/howto-convert-app-to-be-multi-tenant). Set the TABLES_TENANT_ID environment variable to a different, existing tenant than the one the storage account exists in, and set CHALLENGE_TABLES_TENANT_ID to the tenant that the storage account exists in. """ @@ -57,7 +57,7 @@ Recorded using an incorrect tenant for the credential provided to our client. To run this live, ensure that the service principal used for testing is enabled for multitenant authentication - (https://docs.microsoft.com/azure/active-directory/develop/howto-convert-app-to-be-multi-tenant). Set the + (https://learn.microsoft.com/azure/active-directory/develop/howto-convert-app-to-be-multi-tenant). Set the TABLES_TENANT_ID environment variable to a different, existing tenant than the one the storage account exists in, and set CHALLENGE_TABLES_TENANT_ID to the tenant that the storage account exists in. """ @@ -249,7 +249,7 @@ raise ValueError("unexpected token request") credential = Mock(spec_set=["get_token"], get_token=Mock(wraps=get_token)) - policy = BearerTokenChallengePolicy(credential, "scope", discover_scopes=False) + policy = BearerTokenChallengePolicy(credential, ["scope1", "scope2"], discover_scopes=False) pipeline = Pipeline(policies=[policy], transport=Mock(send=send)) pipeline.run(http_request("GET", "https://localhost")) @@ -300,7 +300,10 @@ raise ValueError("unexpected token request") credential = Mock(spec_set=["get_token"], get_token=Mock(wraps=get_token)) - policy = BearerTokenChallengePolicy(credential, "scope", discover_tenant=False, discover_scopes=False) + + policy = BearerTokenChallengePolicy( + credential, ["scope1", "scope2"], discover_tenant=False, discover_scopes=False + ) pipeline = Pipeline(policies=[policy], transport=Mock(send=send)) pipeline.run(http_request("GET", "https://localhost")) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure_data_tables-12.6.0/tests/test_challenge_auth_async.py new/azure_data_tables-12.7.0/tests/test_challenge_auth_async.py --- old/azure_data_tables-12.6.0/tests/test_challenge_auth_async.py 2024-11-21 17:18:16.000000000 +0100 +++ new/azure_data_tables-12.7.0/tests/test_challenge_auth_async.py 2025-05-06 01:15:52.000000000 +0200 @@ -38,7 +38,7 @@ Recorded using an incorrect tenant for the credential provided to our client. To run this live, ensure that the service principal used for testing is enabled for multitenant authentication - (https://docs.microsoft.com/azure/active-directory/develop/howto-convert-app-to-be-multi-tenant). Set the + (https://learn.microsoft.com/azure/active-directory/develop/howto-convert-app-to-be-multi-tenant). Set the TABLES_TENANT_ID environment variable to a different, existing tenant than the one the storage account exists in, and set CHALLENGE_TABLES_TENANT_ID to the tenant that the storage account exists in. """ @@ -60,7 +60,7 @@ Recorded using an incorrect tenant for the credential provided to our client. To run this live, ensure that the service principal used for testing is enabled for multitenant authentication - (https://docs.microsoft.com/azure/active-directory/develop/howto-convert-app-to-be-multi-tenant). Set the + (https://learn.microsoft.com/azure/active-directory/develop/howto-convert-app-to-be-multi-tenant). Set the TABLES_TENANT_ID environment variable to a different, existing tenant than the one the storage account exists in, and set CHALLENGE_TABLES_TENANT_ID to the tenant that the storage account exists in. """ @@ -250,7 +250,7 @@ raise ValueError("unexpected token request") credential = Mock(spec_set=["get_token"], get_token=Mock(wraps=get_token)) - policy = AsyncBearerTokenChallengePolicy(credential, "scope", discover_scopes=False) + policy = AsyncBearerTokenChallengePolicy(credential, ["scope1", "scope2"], discover_scopes=False) pipeline = AsyncPipeline(policies=[policy], transport=Mock(send=send)) await pipeline.run(http_request("GET", "https://localhost")) @@ -301,7 +301,9 @@ raise ValueError("unexpected token request") credential = Mock(spec_set=["get_token"], get_token=Mock(wraps=get_token)) - policy = AsyncBearerTokenChallengePolicy(credential, "scope", discover_tenant=False, discover_scopes=False) + policy = AsyncBearerTokenChallengePolicy( + credential, ["scope1", "scope2"], discover_tenant=False, discover_scopes=False + ) pipeline = AsyncPipeline(policies=[policy], transport=Mock(send=send)) await pipeline.run(http_request("GET", "https://localhost")) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure_data_tables-12.6.0/tests/test_table.py new/azure_data_tables-12.7.0/tests/test_table.py --- old/azure_data_tables-12.6.0/tests/test_table.py 2024-11-21 17:18:16.000000000 +0100 +++ new/azure_data_tables-12.7.0/tests/test_table.py 2025-05-06 01:15:52.000000000 +0200 @@ -410,7 +410,7 @@ table = self._create_table(ts) try: # Act - identifiers = dict() + identifiers = {} for i in range(0, 6): identifiers["id{}".format(i)] = None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure_data_tables-12.6.0/tests/test_table_async.py new/azure_data_tables-12.7.0/tests/test_table_async.py --- old/azure_data_tables-12.6.0/tests/test_table_async.py 2024-11-21 17:18:16.000000000 +0100 +++ new/azure_data_tables-12.7.0/tests/test_table_async.py 2025-05-06 01:15:52.000000000 +0200 @@ -358,7 +358,7 @@ table = await self._create_table(ts) try: # Act - identifiers = dict() + identifiers = {} for i in range(0, 6): identifiers["id{}".format(i)] = None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure_data_tables-12.6.0/tests/test_table_client.py new/azure_data_tables-12.7.0/tests/test_table_client.py --- old/azure_data_tables-12.6.0/tests/test_table_client.py 2024-11-21 17:18:16.000000000 +0100 +++ new/azure_data_tables-12.7.0/tests/test_table_client.py 2025-05-06 01:15:52.000000000 +0200 @@ -10,6 +10,7 @@ from datetime import datetime, timedelta from devtools_testutils import AzureRecordedTestCase, recorded_by_proxy +from unittest.mock import patch from azure.data.tables import ( TableServiceClient, @@ -189,6 +190,7 @@ assert ("Please check your account URL.") in str(exc.value) valid_tc.delete_table() + @pytest.mark.skip("Test missing recording") @tables_decorator @recorded_by_proxy def test_error_handling(self, tables_storage_account_name, tables_primary_storage_account_key): @@ -903,6 +905,24 @@ assert service.credential == token_credential assert not hasattr(service.credential, "account_key") + @pytest.mark.parametrize("client_class", SERVICES) + def test_create_service_client_with_custom_audience(self, client_class): + url = self.account_url(self.tables_storage_account_name, "table") + token_credential = self.get_token_credential() + custom_audience = "https://foo.bar" + expected_scope = custom_audience + "/.default" + + # Test with patching to verify BearerTokenChallengePolicy is created with the proper scope. + with patch("azure.data.tables._authentication.BearerTokenChallengePolicy") as mock_policy: + client_class( + url, + credential=token_credential, + table_name="foo", + audience=custom_audience, + ) + + mock_policy.assert_called_with(token_credential, expected_scope) + def test_create_client_with_api_version(self): url = self.account_url(self.tables_storage_account_name, "table") client = TableServiceClient(url, credential=self.credential) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure_data_tables-12.6.0/tests/test_table_client_async.py new/azure_data_tables-12.7.0/tests/test_table_client_async.py --- old/azure_data_tables-12.6.0/tests/test_table_client_async.py 2024-11-21 17:18:16.000000000 +0100 +++ new/azure_data_tables-12.7.0/tests/test_table_client_async.py 2025-05-06 01:15:52.000000000 +0200 @@ -11,6 +11,7 @@ from datetime import datetime, timedelta from devtools_testutils import AzureRecordedTestCase from devtools_testutils.aio import recorded_by_proxy_async +from unittest.mock import patch from azure.core.credentials import AzureNamedKeyCredential, AzureSasCredential from azure.core.exceptions import ResourceNotFoundError, HttpResponseError, ClientAuthenticationError @@ -670,6 +671,25 @@ assert service.credential == token_credential assert not hasattr(service.credential, "account_key") + @pytest.mark.asyncio + @pytest.mark.parametrize("client_class", SERVICES) + def test_create_service_client_with_custom_audience(self, client_class): + url = self.account_url(self.tables_storage_account_name, "table") + token_credential = self.get_token_credential() + custom_audience = "https://foo.bar" + expected_scope = custom_audience + "/.default" + + # Test with patching to verify AsyncBearerTokenChallengePolicy is created with the proper scope. + with patch("azure.data.tables.aio._authentication_async.AsyncBearerTokenChallengePolicy") as mock_policy: + client_class( + url, + credential=token_credential, + table_name="foo", + audience=custom_audience, + ) + + mock_policy.assert_called_with(token_credential, expected_scope) + @pytest.mark.skip("HTTP prefix does not raise an error") @pytest.mark.asyncio async def test_create_service_with_token_and_http(self):