'Change the API Version of the Azure Storage API

I'm trying to deploy a function app which downloads a file from an azure storage account. Locally when I run the code it works fine with API Version 2020-10-02. However, when running the code from an Azure Function it does not work and raises the following error: Result: Failure Exception: ValueError: Unsupported API version '2020-10-02'. Please select from: 2019-02-02 2019-07-07 2019-10-10 2019-12-12 2020-02-10 2020-04-08 2020-06-12

I use the following code:

# Connect to CDE-Currated with the source list data
cdecurrated = DataLakeServiceClient.from_connection_string(
    conn_str)
logging.info('Connected to CDE-Currated')

# Get the csv file based on the request and convert to xml
sl_file = cdecurrated.get_file_client(
    file_system='source-list', 
    file_path=f'{request["file_path"]}/{request["file_name"]}'
)
df = pd.read_csv(BytesIO(sl_file.download_file().readall()))


Solution 1:[1]

There is a bug in the Azure SDK for Python - my colleague got it working by manually specifying the api-version when creating the DataLakeServiceClient that had the issue.

Solution 2:[2]

As went thorugh the different Storage Service API version only API version '2020-10-02' as very less feature as comparsion to others. This Error you are getting for API version 2020-10-02 is not supported with Azure Function. This Might be reason you are getting an error.

Failure Exception: ValueError: Unsupported API version '2020-10-02'. Please select from: 2019-02-02 2019-07-07 2019-10-10 2019-12-12 2020-02-10 2020-04-08 2020-06-12.

Would Suggest you to please use the API version as recommanded in the Error or you can reach out to Azure Support or Can raise a GitHub Issue for root cause of this issue.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 hansmbakker
Solution 2 RahulKumarShaw-MT