Azure / Azure/azure-rest-api-specs

The client '' with object id '' does not have authorization to perform action 'Microsoft.Authorization/elevateAccess/read' over scope '/providers/Microsoft.Authorization' or the scope is invalid.

Open
#10,142 3 comments 0 reactions 0 assignees View on GitHub
Authorization customer-reported needs-team-attention question Service Attention
Dominant language
TypeSpec
Stars
3.1k
Forks
5.9k
Avg merge
2d 22h
Merged PRs (30d)
444

Description

Attempting to follow documentation here: https://docs.microsoft.com/en-us/azure/role-based-access-control/elevate-access-global-admin#rest-api

I am attempting to have a Service Principal elevate their permissions via the following PowerShell code:

```
$TenantId = "12345"
$ClientId = "1234567890"
$ClientSecret = "test12345"
$Resource = "https://management.core.windows.net/"
$RequestAccessTokenUri = "https://login.microsoftonline.com/$TenantId/oauth2/token"
$body = "grant_type=client_credentials&client_id=$ClientId&client_secret=$ClientSecret&resource=$Resource"
$Token = Invoke-RestMethod -Method Post -Uri $RequestAccessTokenUri -Body $body -ContentType 'application/x-www-form-urlencoded'
$Token
$Header = @{}
$Header.Add("Authorization","$($Token.token_type) "+ " " + "$($Token.access_token)")
Invoke-RestMethod -Headers $Header https://management.azure.com/providers/Microsoft.Authorization/elevateAccess?api-version=2016-07-01 -verbose
```

The Application/Service Principal is in the Global Administrators role.

Contributor guide

Open the contributing guide

Research direction

Start with the linked Azure elevate-access documentation and compare its REST API requirements with the PowerShell token request and the Microsoft.Authorization/elevateAccess endpoint shown here. Determine whether the reported authorization failure is a service-principal limitation, a token or role requirement, or a documentation/specification issue; done means documenting the verified behavior and the required correction.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, powershell
Domain
api, authorization, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.