python - Azure api returns "at least one of the claims 'puid' or 'altsecid' or 'oid' should be present" -


when try access azure api, returns following error.

{u'error': {u'message': u"the received access token not valid: @ least 1 of claims 'puid' or 'altsecid' or 'oid' should present. if accessing application please make sure service principal created in tenant.", u'code': u'invalidauthenticationtoken'}}


have tried following,

endpoint = 'https://management.azure.com/subscriptions/{subscription_id}/providers/microsoft.security/alerts?api-version=2015-01-01' headers = {"authorization": 'bearer ' + access_token} responce = requests.get(endpoint, headers=headers).json() print responce 

i suggest use azure sdk python, generic "get":

use azure-mgmt-resource package: https://pypi.python.org/pypi/azure-mgmt-resource

this package provides authentication user/password or servicecredentials (http://azure-sdk-for-python.readthedocs.io/en/latest/quickstart_authentication.html). can use adal complex scenarios (https://pypi.python.org/pypi/adal/)

(i work @ ms , i'm in charge of python azure)


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - IE9 error '$'is not defined -