Forum Discussion
Patrick Rote
Jan 19, 2022Iron Contributor
Error when running Get-PnPTenantSite : The remote server returned an error: (403) Forbidden. Help
Hi All,
Hopefully someone can help me here
I can't get to run the below via windows powershell
$Sites = Get-PnPTenantSite -Filter "Url -like $TenantURL" | Where-Object { $_.template -eq "OFFILE#1" -or $_.template -eq "SITEPAGEPUBLISHING#0" -or $_.template -eq "STS#0" -or $_.template -eq "STS#-1"}
I keep getting error
Get-PnPTenantSite : The remote server returned an error: (403) Forbidden
I can confirm I can use the same account to login to the admin center and i can view all the sites.
Any recommendation on what could be wrong or what access level do i need to run this successfully and how can i confirm the acct i'm using to run this.
Any recommendation on what could be wrong or what access level do i need to run this successfully and how can i confirm the acct i'm using to run this.
Thanks in Advance
1 Reply
- slottyCopper Contributor
Hi Patrick Rote,
I got same error. At the first time I tried with an older PnP Powershell module (3.22.2006.1), if the MFA was enabled on user. Without MFA Get-PnPTenantSite worked well. I have updated the pnp module to 3.29.2101.0. With the new version it works with MFA!
Thanks,
slotty