Azure / Azure/azure-powershell

Get-AzAccessToken with scope

Open
#24,334 1 comment 1 reaction 0 assignees View on GitHub
customer-reported needs-triage question
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

### Description

Is it possible to use Get-AzAccessToken to get an MsGraph JWT with a specific scope?

It seems like the token that is returned has fewer / different scopes than when I just use PowerShell to get information from Entra ID directly.

I'm using that JWT to pass that into an application which uses the dotnet Graph SDK.
The jwt contains Directory.AccessAsUser.All as scope, and even though I tried as Global Administrator even, some calls using the Graph SDK (like reading the tenant authorisation policy) fail with a permission error.
Same user can see the policy in the portal or can even go to the web based Graph explorer and it works.

Any insights here?

Thanks.

### Script or Debug output

_No response_

### Environment data

_No response_

### Module versions

_No response_

### Error output

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.