python - Azure rest API AuthorizationFailed error -
i have tried read alerts via following 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' object id '8447xxxx-xxxx-xxxx-xxxx-49bb99abxxxx' not have authorization perform action 'microsoft.security/alerts/read' on scope '/subscriptions/{subscription_id}'.", u'code': u'authorizationfailed'}}
regarding message, need "security manager" role added credentials:
- see role description: https://azure.microsoft.com/documentation/articles/role-based-access-built-in-roles/#security-manager
- how apply role (ps, cli or restapi): https://azure.microsoft.com/documentation/articles/role-based-access-control-manage-access-azure-cli/
apply "security manager" role @ subscription scope should solve problem.
Comments
Post a Comment