简体   繁体   English

Azure REST API授权失败错误

[英]Azure rest API AuthorizationFailed error

I have tried to read alerts via following azure API 我试图通过以下Azure API阅读警报

endpoint = 'https://management.azure.com/subscriptions/{subscription_id}/providers/microsoft.Security/alerts?api-version=2016-03-01'
headers = {"Authorization": 'Bearer ' + access_token}
json_output = requests.get(endpoint, headers=headers).json()

It returns following error message, 它返回以下错误消息,

{u'error': {u'message': u"The client '8447xxxx-xxxx-xxxx-xxxx-49bb99abxxxx' with object id '8447xxxx-xxxx-xxxx-xxxx-49bb99abxxxx' does not have authorization to perform action 'microsoft.Security/alerts/read' over scope '/subscriptions/{subscription_id}'.", u'code': u'AuthorizationFailed'}} {u'error':{u'message':u“具有对象ID为'8447xxxx-xxxx-xxxx-xxxx-xxxx-49bb99abxxxx'的客户端'8447xxxx-xxxx-xxxx-xxxx-49bb99abxxxx'没有权限执行操作'microsoft .security / alerts / read'over scope'/ subscriptions / {subscription_id}'。“,u'code':u'AuthorizationFailed'}}

Regarding your message, you need the "Security Manager" role added to your credentials: 关于您的消息,您需要在凭据中添加“安全管理器”角色:

Apply the "Security Manager" role at the subscription scope should solve your problem. 在订阅范围内应用“安全管理器”角色应该可以解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM