Unable to import DefaultAzureCredential from azure.identity

Aditi Mokashi 130 Reputation points
2025-03-18T11:58:24.7+00:00

Hi,

I'm trying to execute a simple code importing DefaultAzureCredential from azure.identity library but I'm getting following error:
ImportError: DLL load failed while importing _rust: The specified procedure could not be found.

I found some articles where same error was raised for library - cryptography

I suppose its some version compatibility issue.

I referred following article to simply get started with azure blob storage client library using python - https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-python?tabs=managed-identity%2Croles-azure-portal%2Csign-in-azure-cli&pivots=blob-storage-quickstart-scratch

Following are my versions:
python==3.9.0

azure-core==1.32.0

azure-identity==1.6.0

azure-storage-blob==12.8.0

Note that I'm on a windows system.

I got the error immediately after installing the libraries and running the import statement. If its a version issue, please let me know the correct versions that need to be installed of either libraries or the python.

Thanks in advance!

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
3,192 questions
{count} votes

Accepted answer
  1. Hari Babu Vattepally 3,270 Reputation points Microsoft External Staff Moderator
    2025-03-18T16:14:36.9866667+00:00

    Hi @Aditi Mokashi ,

    As per the given error message, we see that it is mainly due to the compatibility issue between the installed versions of the azure.identity library and its dependencies, particularly the cryptography library, and your Python version.

    Please follow the below to get this issue fixed:

    • upgrade cryptography library which is a dependency for azure.identity, and older versions may not be compatible with your setup. By following the below command to upgrade:
        pip install --upgrade cryptography
      
    • The version for azure-identity==1.6.0 quite old one, please upgrade it to the latest version to ensure that it is compatible with Python 3.9.
    • Also, upgrade Python to the latest patch version of Python 3.9 (e.g.: 3.9.13) or consider using Python 3.10 for better compatibility.
    • After upgrading Python, make sure reinstall the Azure SDK libraries to ensure compatibility.
      pip install azure-core azure-identity azure-storage-blob
    
    • Also, please verify the Rust installation _rust module error suggests that the cryptography library requires Rust for building. Make sure Rust is installed on the system from rust-lang website. Once it is installed verify the version by using the cmd: rustc --version
    • If the issue still persists, even after following all the above. Clear the pip cache and reinstall the libraries.
        pip cache purge
        pip install azure-core azure-identity azure-storage-blob
      
      I hope by following the above helps in solving the issue.

    Please let us know in the comments section, if there are any further queries. We will be glad to assist you closely in resolving the issue.

    Please do consider to “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.