Azure授权失败

时间:2020-10-07 18:11:37

标签: python sdk azure-sdk-python

当我在azure环境中运行python脚本来管理虚拟机时,由于 AuthorizationFailed 消息而失败。出现以下异常以及错误消息。

CloudError(“具有对象ID为'bdafca09-d426-4924-b63c-dff61c034187'的客户端'bdafca09-d426-4924-b63c-dff61c034187'无权执行操作'Microsoft.Resources / subscriptions / resourcegroups / write'over scope'/ subscriptions / 49ec57ce-8a6f-4cdf-95bf-8163b231edf6 / resourcegroups / azure-sample-group-virtual-machines'或该范围无效。如果最近授予访问权限,请刷新您的凭据。”)

1 个答案:

答案 0 :(得分:0)

您需要为在门户网站的Azure AD中创建的应用程序添加//current pipeline: pipeline { agent any parameters { string(description: "The full ssh repo URL", name: "REPO_URL") string(description: "The branch name", name: "BRANCH") } stages { stage('Checkout Git Repository') { steps { git branch: "${params.BRANCH}", url: 'git@github.com/myrepo.git', credentialsId: 'my-credentials' } } stage('Running the first Job') { steps { build job: 'util-first-job', parameters: [] //I expected myrepo source to be available in this job. } } } } 角色。

  1. 订阅(搜索订阅)中选择您的订阅 在顶部栏中)

enter image description here

  1. 访问控制
  2. 中添加角色分配

enter image description here

  1. 选择并为您的应用添加贡献者角色。

enter image description here

  1. 如果添加成功,您将在角色分配列表中看到您的应用程序。

enter image description here

相关问题