Azure服务主体需要什么权限才能调用New-AzSubscriptionAlias PowerShell函数? [英] What permissions does an Azure service principal need to call the New-AzSubscriptionAlias PowerShell function?

查看:50
本文介绍了Azure服务主体需要什么权限才能调用New-AzSubscriptionAlias PowerShell函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过作为服务主体运行的托管代理上的Azure DevOps管道创建订阅,并收到错误消息:

I'm trying to create subscriptions through an Azure DevOps pipeline on a hosted agent running as a service principal and am receiving the error:

New-AzSubscriptionAlias: /home/vsts/work/1/s/Azure.Automation/Subscriptions/Create-AzureSubscription.ps1:190
Line |
 190 |  $subscription = New-AzSubscriptionAlias `
     |                  ~~~~~~~~~~~~~~~~~~~~~~~~~
     | Operation returned an invalid status code 'Unauthorized'

如何授予服务主体所需的访问权限?

How do I grant the service principal the required access?

推荐答案

此处以编程方式使用最新的API创建Azure订阅

您必须在注册帐户上具有所有者角色才能创建订阅.获得角色的方法有两种:

You must have an Owner role on an Enrollment Account to create a subscription. There are two ways to get the role:

  • 您的注册企业管理员可以使您成为帐户所有者(必须登录),从而使您成为注册帐户的所有者.
  • 注册帐户的现有所有者可以授予您访问权限.同样,要使用服务主体创建EA订阅,您必须授予该服务主体创建订阅的能力.

这篇关于Azure服务主体需要什么权限才能调用New-AzSubscriptionAlias PowerShell函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆