Skip to content

Get-PnPUserProfileProperty Getting Access Denied #5084

@parsamsandeep

Description

@parsamsandeep

Reporting an Issue or Missing Feature

I'm tryting to retreive user profile details , escpsically Userprofile OneDriveURL

PnP: Connect using Managed Identity

    Connect-PnPOnline -Url $TenantUrl -ManagedIdentity

    # Get user's OneDrive personal URL 
    $userOneDriveURL = (Get-PnPUserProfileProperty -Account $UserEmail).UserProfileProperties["PersonalUrl"]
    Write-Output "User Profile Personal URL: $userOneDriveURL"

Expected behavior

User OneDrive URL returned

Actual behavior

Access Denied: This application does not have the required permissions to access profile information.

Steps to reproduce behavior

Granted Below Roles with Application Permissions
MG Graph Permissions:
User.Read.All
Files.Read.All
Sites.FullControll.All
Sharepoint:
Sites.FullControl.All

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

Runtime Environment: PowerShell 7.4
Packages:
Microsoft.Graph.Authentication
Microsoft.Graph.Files
Microsoft.Graph.Sites
Microsoft.Graph.Users
PnP.PowerShell.2.12.0

Which operating system/environment are you running PnP PowerShell on?

  • Windows
  • Linux
  • MacOS
  • Azure Cloud Shell
  • Azure Functions
  • [X ] Other: Azure Automate Account

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions