Issue: I have an small Azure Functions code which should retrieve secrets from the Azure Keyvault. I'm using 2 python modules (Azure.keyvault & Azure.Identity). This used to work but now I'm getting an error.
Troubleshooting: It seems it's coming from Azure.Identity cause when i remove this module, I don't get any errors and when I write & run this code in default way (not Azure Functions), it works as well. Also I have versioned pinned the module (back to previous version 1.5.0 from 1.6.0), but it didn't work.
Please help me to fix this issue. I'll post the Error and my code below:
[My Code]:
[Error]:
Functions:
TimerTriggerPython: timerTrigger
For detailed output, run func with --verbose flag.
[2021-08-10T12:26:45.529Z] Worker process started and initialized.
[2021-08-10T12:26:46.264Z] Worker failed to function id 0f918900-966c-4b13-a12e-7f29d8b28399.
[2021-08-10T12:26:46.264Z] Result: Failure
Exception: AssertionError:
Stack: File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.9/WINDOWS/X64\azure_functions_worker\dispatcher.py", line 302, in _handle__function_load_request
func = loader.load_function(
File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.9/WINDOWS/X64\azure_functions_worker\utils\wrappers.py", line 40, in call
return func(*args, **kwargs)
File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.9/WINDOWS/X64\azure_functions_worker\loader.py", line 83, in load_function
mod = importlib.import_module(fullmodname)
File "C:\Python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 790, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "C:\Users\M65E083\VSOCDE_PWD_Rotation\Azure-Func-Timer-Python\TimerTriggerPython\__init__.py", line 7, in <module>
from azure.identity import DefaultAzureCredential
File "C:\Users\M65E083\VSOCDE_PWD_Rotation\Azure-Func-Timer-Python\.venv\lib\site-packages\azure\identity\__init__.py", line 9, in <module>
from ._credentials import (
File "C:\Users\M65E083\VSOCDE_PWD_Rotation\Azure-Func-Timer-Python\.venv\lib\site-packages\azure\identity\_credentials\__init__.py", line 5, in <module>
from .authorization_code import AuthorizationCodeCredential
File "C:\Users\M65E083\VSOCDE_PWD_Rotation\Azure-Func-Timer-Python\.venv\lib\site-packages\azure\identity\_credentials\authorization_code.py", line 8, in <module>
from .._internal.aad_client import AadClient
File "C:\Users\M65E083\VSOCDE_PWD_Rotation\Azure-Func-Timer-Python\.venv\lib\site-packages\azure\identity\_internal\__init__.py", line 50, in <module>
from .certificate_credential_base import CertificateCredentialBase
File "C:\Users\M65E083\VSOCDE_PWD_Rotation\Azure-Func-Timer-Python\.venv\lib\site-packages\azure\identity\_internal\certificate_credential_base.py", line 11, in <module>
from .persistent_cache import load_service_principal_cache
File "C:\Users\M65E083\VSOCDE_PWD_Rotation\Azure-Func-Timer-Python\.venv\lib\site-packages\azure\identity\_internal\persistent_cache.py", line 9, in <module>
import msal_extensions
File "C:\Users\M65E083\VSOCDE_PWD_Rotation\Azure-Func-Timer-Python\.venv\lib\site-packages\msal_extensions\__init__.py", line 12, in <module>
from .cache_lock import CrossPlatLock
File "C:\Users\M65E083\VSOCDE_PWD_Rotation\Azure-Func-Timer-Python\.venv\lib\site-packages\msal_extensions\cache_lock.py", line 5, in <module>
import portalocker
File "C:\Users\M65E083\VSOCDE_PWD_Rotation\Azure-Func-Timer-Python\.venv\lib\site-packages\portalocker\__init__.py", line 4, in <module>
from . import portalocker
File "C:\Users\M65E083\VSOCDE_PWD_Rotation\Azure-Func-Timer-Python\.venv\lib\site-packages\portalocker\portalocker.py", line 10, in <module>
import pywintypes
File "C:\Users\M65E083\VSOCDE_PWD_Rotation\Azure-Func-Timer-Python\.venv\lib\site-packages\win32\lib\pywintypes.py", line 105, in <module>
__import_pywin32_system_module__("pywintypes", globals())
File "C:\Users\M65E083\VSOCDE_PWD_Rotation\Azure-Func-Timer-Python\.venv\lib\site-packages\win32\lib\pywintypes.py", line 99, in __import_pywin32_system_module__
assert sys.modules[modname] is not old_mod
