c# - My AzureAD - registered application doesn't have the rights to do anything ...? -


i'm writing c# program right tries authenticate azure make generic http request. got code working , wanted test features every request make following error code in response:

{"error":{"code": "authorizationfailed", "message":"the client "(id of app registered in azuread)" object id "(same value before)" not have authorization perform action 'microsoft.authorization/roleassignments/read' on scope '/subscriptions/(mysubscriptionid)'."}}.

the thing ... account use set global admin. checked every permission box in azuread find...

(that's 8 application permissions , 9 delegated permissions in windows azure active directory api , 1 delegated permission in windows azure service management api, though don't know why there aren't more possible permissions azure service management)

the relevant code rather basic works don't feel need post it, i'll obtain token using microsoft.identitymodel.clients.activedirectory.acquiretokenasync()

authorityuri = "https://login.windows.net/(mytenantid)", string resourceuri = "https://management.azure.com/"; authenticationcontext authcontext = new authenticationcontext(authorityuri); var res = authcontext.acquiretokenasync(resourceuri, new  clientcredential(clientid,clientsecret)); return res.result; 

and make request https://management.azure.com/subscriptions/{subscriptionid}/providers/microsoft.authorization/roleassignments?api-version=2016-03-01&$filter=atscope()

(as example, 1 supposed call roles).

tried several different types of requests different uris, give similar errors.

i'm thinking might not issue code setting in azureportal found there seems set right (or rather "universal access").

according description, forget grant service principal. add on azure portal. grant contributor or owner role it.

please refer link:assign application role.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -