Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pnp.powershell issues when running in powershell integrated console #3525

Closed
4 tasks done
TobyLeduc opened this issue Aug 24, 2021 · 2 comments
Closed
4 tasks done

pnp.powershell issues when running in powershell integrated console #3525

TobyLeduc opened this issue Aug 24, 2021 · 2 comments
Labels
Issue-Bug A bug to squash. Resolution-Duplicate Will close automatically.

Comments

@TobyLeduc
Copy link

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.

Summary

I have run into an issue when running commands inside the integrated console where it fails to work with pnp teams commands. It doesn't matter if I run w/wo debugging or directly in the console window. It always give the same result. The exact same commands work in the vscode powershell terminal, a new powershell window or powershell ise.

Here is a sample that has two lines, it fails to load the team site and throws an error. We have about a hundred teams in our tenant and even trying to select all teams returns a null

Powershell integration console

PS> Connect-PnPOnline -url "https://<tenant>.sharepoint.com/teams/TLTestTeam" -Interactive
PS> Get-PnPTeamsTeam -Identity "TLTestTeam"

Get-PnPTeamsTeam : Team not found
At C:\Users\tleduc\OneDrive - City of Kelowna\SharePoint Online\scripts\test2.ps1:2 char:1
+ Get-PnPTeamsTeam -Identity "TLTestTeam"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (:) [Get-PnPTeamsTeam], PSArgumentException
    + FullyQualifiedErrorId : PnP.PowerShell.Commands.Graph.GetTeamsTeam

PS> $error[0] | fl * -force
writeErrorStream      : True
PSMessageDetails      :
Exception             : System.Management.Automation.PSArgumentException: Team not found
TargetObject          :
CategoryInfo          : ObjectNotFound: (:) [Get-PnPTeamsTeam], PSArgumentException
FullyQualifiedErrorId : PnP.PowerShell.Commands.Graph.GetTeamsTeam
ErrorDetails          :
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at <ScriptBlock>, C:\Users\tleduc\OneDrive - City of Kelowna\SharePoint Online\scripts\test2.ps1: line 2
PipelineIterationInfo : {0, 1}

PS> Get-PnPConnection
ConnectionType                         : O365
InitializationType                     : Unknown
Scopes                                 :
PSCredential                           :
ClientId                               : 31359c7f-bd7e-475c-86db-fdb8c937548e
ClientSecret                           :
ApplicationInsights                    : PnP.PowerShell.ALC.ApplicationInsights
Url                                    : https://<tenant>.sharepoint.com/teams/tltestteam
TenantAdminUrl                         :
Certificate                            : 
DeleteCertificateFromCacheOnDisconnect : False
Context                                : PnP.Framework.PnPClientContext
Tenant                                 :
AzureEnvironment                       : Production`

PS> Get-Module -name "PnP.Powershell"

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   1.7.0      PnP.PowerShell                      {Add-PnPAlert, Add-PnPApp, Add-PnPApplicationCustomizer, Add-PnPAzureADGroupMember...}

PS> Get-PnPTeamsTeam

PS> 

vscode powershell terminal

PS> Connect-PnPOnline -url "https://<tenant>.sharepoint.com/teams/TLTestTeam" -Interactive
PS> Get-PnPTeamsTeam -Identity "TLTestTeam"

GroupId                              DisplayName Visibility IsArchived MailNickname
-------                              ----------- ---------- ---------- ------------
553e4d70-beb9-491f-b59b-4ba5f8785b05 TLTest Team Private    False      TLTestTeam

PS> Get-PnPConnection
ConnectionType                         : O365
InitializationType                     : Unknown
Scopes                                 : 
PSCredential                           : 
ClientId                               : 31359c7f-bd7e-475c-86db-fdb8c937548e
ClientSecret                           : 
ApplicationInsights                    : PnP.PowerShell.ALC.ApplicationInsights
Url                                    : https://<tenant>.sharepoint.com/teams/tltestteam
TenantAdminUrl                         : 
Certificate                            : 
DeleteCertificateFromCacheOnDisconnect : False
Context                                : PnP.Framework.PnPClientContext
Tenant                                 : 
AzureEnvironment                       : Production

PS> Get-Module -name "PnP.Powershell"

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   1.7.0      PnP.PowerShell                      {Add-PnPAlert, Add-PnPApp, Add-PnPApplicationCustomizer, Add-PnPAzureADGroupMember...}

PowerShell Version

Name                           Value
----                           -----
PSVersion                      5.1.19041.1151
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1151
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Visual Studio Code Version

1.59.1
3866c3553be8b268c8a7f8c0482c0c0177aa8bfa
x64

Extension Version

Steps to Reproduce

  1. run commands in Powershell Integrated Console
  2. run commands in Powershell terminal

Visuals

No response

Logs

Logs sent via email to [email protected] due to length

@TobyLeduc TobyLeduc added the Issue-Bug A bug to squash. label Aug 24, 2021
@ghost ghost added the Needs: Triage Maintainer attention needed! label Aug 24, 2021
@andyleejordan
Copy link
Member

Duplicate of #3510.

@andyleejordan andyleejordan added Resolution-Duplicate Will close automatically. and removed Needs: Triage Maintainer attention needed! labels Aug 24, 2021
@TobyLeduc
Copy link
Author

Sorry, I thought this was different based on the fact the my sharepoint commands worked without any problem. I'll make comments in #3510

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Aug 24, 2021
@StevenBucher98 StevenBucher98 removed the Needs: Maintainer Attention Maintainer attention needed! label Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug A bug to squash. Resolution-Duplicate Will close automatically.
Projects
None yet
Development

No branches or pull requests

3 participants