Azure 服务主体无法访问服务管理 API

Azure Service Principal cannot access Service Management API

似乎针对 Azure 作为服务主体进行身份验证的应用程序(按照此 post 设置)无法访问服务管理 API。我找不到任何明确说明不支持的地方。可能吗?它会得到支持吗?

使用管理证书进行身份验证的应用程序无法访问资源管理器API(明确不支持)。

有没有办法根据 Azure 对应用程序(而非个人)进行身份验证并访问两者 服务管理和资源管理器API?

Is there a way to authenticate an application (not a person) against Azure and access both Service Management and Resource Manager API's?

据我了解,不,今天不可能。为了对服务管理 API 使用基于 tokens 的身份验证,为其颁发令牌的 user/application 必须是相关 Azure 订阅的管理员或共同管理员,而我不能找到一种在 Azure 门户中将服务主体添加为 admin/co-admin 的方法。

但是服务主体可以访问资源管理器API。为此,您必须使用 Azure 预览门户为该服务主体分配适当的角色。请参阅此 link 关于相同的说明:https://azure.microsoft.com/en-in/documentation/articles/role-based-access-control-configure/

我知道你不想这样做,但你可以做的一件事是在你的 Azure AD 中创建一个 service principal 类型的用户,然后将该用户用于服务管理和资源管理器 API.请参阅此博客 post 了解更多详情:http://blogs.msdn.com/b/tomholl/archive/2014/11/25/unattended-authentication-to-azure-management-apis-with-azure-active-directory.aspx.