pnp / pnp/powershell

[BUG]Request-PnPPersonalSite: Attempted to perform an unauthorized operation.

Open
#4,329 39 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
904
Forks
407
Avg merge
9h 16m
Merged PRs (30d)
10

Description

Notice

Many bugs reported are actually related to the PnP Framework which is used behind the scenes. Consider carefully where to report an issue:

  1. Are you using Invoke-PnPSiteTemplate or Get-PnPSiteTemplate? The issue is most likely related to the Provisioning Engine. The Provisioning engine is not located in the PowerShell repo. Please report the issue here: https://github.com/pnp/pnpframework/issues.
  2. Is the issue related to the cmdlet itself, its parameters, the syntax, or do you suspect it is the code of the cmdlet that is causing the issue? Then please continue reporting the issue in this repo.
  3. If you think that the functionality might be related to the underlying libraries that the cmdlet is calling (We realize that might be difficult to determine), please first double check the code of the cmdlet, which can be found here: https://github.com/pnp/powershell/tree/master/src/Commands. If related to the cmdlet, continue reporting the issue here, otherwise report the issue at https://github.com/pnp/pnpframework/issues
Reporting an Issue or Missing Feature

Our business requires to enable Onedrive for every new account with automated script.
Followed procedures described below site.
https://pnp.github.io/powershell/cmdlets/Request-PnPPersonalSite.html

I got unauthorized operation error instead success.

I opened Microsoft request and they could reproduce same issue and guided to open request from github.

Expected behavior

Request-PnPPersonalSite should complete with successful.

Actual behavior

Request-PnPPersonalSite: Attempted to perform an unauthorized operation.

Steps to reproduce behavior

https://pnp.github.io/powershell/cmdlets/Request-PnPPersonalSite.html

Created new Sharepoint app via https://tenant-admin.sharepoint.com/_layouts/appregnew.aspx.
Added permission via https://tenant-admin.sharepoint.com/_layouts/appinv.aspx
Then clicked "Trust It" from browser.

Run Powershell
import-module pnp.powershell

Connect-PnPOnline -Url https://[tenant]-admin.sharepoint.com -ClientId xxxxxxxxx-xxxx-xxxx-xxxx-f722d04ee698 -ClientSecret xxxxxxxxxxxxxxxxxxxxxxxxxxx88huvAJAD+9DE=

get-pnPSite

Url CompatibilityLevel


https://[tenant]-admin.sharepoint.com 15

Request-PnPPersonalSite -UserEmails "shp-dev_ww@domain.com"
Request-PnPPersonalSite: Attempted to perform an unauthorized operation.

What is the version of the Cmdlet module you are running?

(you can retrieve this by executing Get-Module -Name "PnP.PowerShell" -ListAvailable)
get-module

ModuleType Version PreRelease Name ExportedCommands


Manifest 2.12.13 nightly PnP.PowerShell {Add-PnPAlert, Add-PnPApp, Add-PnPApplicationCustomizer, Add-PnPAvailableSiteClassification…}
Script 2.3.4 PSReadLine {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PSReadLineKeyHandler, Set-PSReadLineKeyHandler…}

Which operating system/environment are you running PnP PowerShell on?
  • Windows
  • Linux
  • [x ] MacOS
  • Azure Cloud Shell
  • Azure Functions
  • Other : please specify

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.

Research direction

Start with the Request-PnPPersonalSite documentation and the cmdlet sources under src/Commands. Reproduce the failure using the shown Connect-PnPOnline and Request-PnPPersonalSite commands, then trace the permission requirements for the app registration. Done means the command completes successfully with the documented setup or reports a precise actionable permission error.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
authorization, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.