pnp / PnP-PowerShell

SharePoint PnP PowerShell CmdLets
https://pnp.github.io/powershell
Other
990 stars 663 forks source link

Import-PnPTermGroupFromXml : Access denied. You do not have permission to perform this action or access this resource #2837

Closed Ofer-Gal closed 4 years ago

Ofer-Gal commented 4 years ago

Using XML file created with "Export-PnPTermGroupToXml" and xmlns:pnp="http://schemas.dev.office.com/PnP/2020/02/ProvisioningSchema I am a global admin and a Term Store Administrator but I keep getting error: Import-PnPTermGroupFromXml : Access denied. You do not have permission to perform this action or access this resource.

New From today. I used the connect like this now:"Connect-PnPOnline -Url https://ecgmcaz-admin.sharepoint.com/ -UseWebLogin" then login as my production User ID: ogal@ecgmc.com Then Ran:"Import-PnPTermGroupFromXml -Path C:\Data\O365\PowerShell\ECGmcAZ\Organization.xml" The error now makes no sense: Import-PnPTermGroupFromXml : The user name 'i:0#.f|membership|ofer@ecgmcdev.onmicrosoft.com' can not be found.

ofer@ecgmcdev.onmicrosoft.com is my id in the development environment. Why is the commandlet using it instead of the ID I connected as, ogal@ecgmc.com? I deleted all the cookies I could find, but still same issue. The 2 tenants have nothing in common. How can I make powershell forget ofer@ecgmcdev.onmicrosoft.com ?

Is there some extra instruction I did not see? Thanks for the help

Expected behavior

Just OK that it imported the Termset

Actual behavior

Error "Import-PnPTermGroupFromXml : Access denied. You do not have permission to perform this action or access this resource"

Steps to reproduce behavior

connect-PNP.. Import-PnPTermGroupFromXml path

Which version of the PnP-PowerShell Cmdlets are you using?

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

(you can retrieve this by executing Get-Module -Name sharepointpnppowershell* -ListAvailable) 3.22

How did you install the PnP-PowerShell Cmdlets?

Thank you

ghost commented 4 years ago

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

Ofer-Gal commented 4 years ago

Sorry it is all my fault. the id ofer@ecgmcdev.onmicrosoft.com was all over the XML file as the owner of every item. Changing the XML file made it work. Closing