Response status code does not indicate success: Unauthorized (Unauthorized)

Open
#1 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Active
Tech stack
powershell

Research direction

Start by reproducing the Get-WindowsBackup flow shown in the issue and compare its Microsoft Graph request with the same request in Graph Explorer. Check which request returns Unauthorized and whether the listed scopes are accepted for it; done means identifying the missing permission or request issue and documenting the required correction.

Written by the indexing model from the issue text.

Description

Does this work for anyone?

I get:

PS C:\Users\giggedy> Get-WindowsBackup
[1/4] PowerShell 7.6.5 detected.
[2/4] Microsoft.Graph.Authentication module present.
Enter the user UPN to view (or press Enter to view your own backup): 
[3/4] Signing in to Microsoft Graph...
      Signed in as admin_xxxx@xxxx.onmicrosoft.com.
[4/4] Reading backup for 'admin_xxxx@xxxx.onmicrosoft.com'...
Could not read backup for 'admin_xxxx@xxxx.onmicrosoft.com': Response status code does not indicate success: Unauthorized (Unauthorized).

I believe my permissions should be sufficient. I'm a Global Admin, and these are my scopes:

PS C:\Users\giggedy> (Get-MgContext).Scopes | Sort-Object                         
Application.ReadWrite.All
email
openid
profile
User.Read
User.Read.All
User.ReadWrite.All
UserWindowsSettings.Read
UserWindowsSettings.Read.All
UserWindowsSettings.ReadWrite.All

I get the same error when I try the request in Graph Explorer:

Image

What am I doing wrong?

Dominant language
PowerShell
Stars
8
Forks
2
Avg merge
5m
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.