由于“ClientSecretCredential”问题,无法执行 Azure ARM 部署

问题描述

我想使用 Python 执行 Azure ARM 模板部署。我正在使用“ClientSecretCredential”库来构建我的 Azure 凭据。我正在使用“ClientSecretCredential”,因为根据此 post,看起来我们构建凭据的方式已从 azure.common (ServicePrincipalCredentials) 增强到 azure-identity (ClientSecretCredential) 在执行部署时,我得到了错误

    Message='ClientSecretCredential' object has no attribute 'signed_session'
  Source=C:\Users\manjug\Desktop\sqlServer_armtemplate\testFunction.py
  StackTrace:
  File "C:\Users\manjug\Desktop\sqlServer_armtemplate\testFunction.py",line 109,in executeArmDeployment
    Deployment(properties=deployment_properties)
  File "C:\Users\manjug\Desktop\sqlServer_armtemplate\testFunction.py",line 119,in <module> (Current frame)
    executeArmDeployment('coe-extollo-apis-dev',resourceManagerClient)

enter image description here

解决方法

我能够通过以下方式解决这个问题:

  1. 将“azure-mgmt-resource”模块更新到 16.0.0
  2. 将“deployments.create_or_update”函数更改为“deployments.begin_create_or_update”