小编Ste*_*end的帖子

异常:AttributeError:使用 Azure Function 和 Python 的“DefaultAzureCredential”对象没有属性“signed_session”

我编写了一个运行 Python3 的 Azure 函数来简单地打开 Azure VM。

该函数应用程序具有系统分配的托管标识,我已为其授予 VM 贡献者角色。为了让该函数使用托管标识,我使用了 DefaultAzureCredential() 类。

我得到的错误是: Exception: AttributeError: 'DefaultAzureCredential' object has no attribute 'signed_session' 我已经进行了大量的研究,但似乎找不到解决方案。

这是相关的代码:

from azure.identity import DefaultAzureCredential
credentials = DefaultAzureCredential()
compute_client = ComputeManagementClient(credentials, subscription_id)
# Starting the VM
print('\nStarting VM ' + VM_NAME)
vm_start = compute_client.virtual_machines.start(
    RG_NAME, VM_NAME)
vm_start.wait()
Run Code Online (Sandbox Code Playgroud)

请原谅我,我只是 Python 新手,但对学习非常感兴趣。

python azure-sdk-python

8
推荐指数
2
解决办法
9902
查看次数

标签 统计

azure-sdk-python ×1

python ×1