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

Add support for PowerShell Graph SDK #22

Open
BrianTJackett opened this issue Nov 17, 2022 · 5 comments
Open

Add support for PowerShell Graph SDK #22

BrianTJackett opened this issue Nov 17, 2022 · 5 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@BrianTJackett
Copy link
Collaborator

Add integration with PowerShell code blocks to call Microsoft Graph SDK

@BrianTJackett BrianTJackett added enhancement New feature or request help wanted Extra attention is needed labels Nov 17, 2022
@BrianTJackett
Copy link
Collaborator Author

Attempting to automatically load Microsoft.Graph (or sub-modules such as Microsoft.Graph.Authentication) within the .Net Interactive extension OnLoadAsync results in the following error:

Import-Module: Could not load type 'Microsoft.Graph.IAuthenticationProvider' from assembly 'Microsoft.Graph.Core,
Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Get-ScriptCmdlet: <redacted>\Modules\Microsoft.Graph.Authentication\1.17.0\StartupScripts\ExportCustomCommands.ps1:11
Line |
  11 |      Export-ModuleMember -Function (Get-ScriptCmdlet -ScriptFolder $Cu …
     |                                     ~~~~~~~~~~~~~~~~
     | The term 'Get-ScriptCmdlet' is not recognized as a name of a cmdlet, function,
     | script file, or executable program. Check the spelling of the name, or if a path
     | was included, verify that the path is correct and try again.

Get-ModuleCmdlet: The term 'Get-ModuleCmdlet' is not recognized as a name of a cmdlet, function, script file, or
executable program. Check the spelling of the name, or if a path was included, verify that the path
is correct and try again.

Importing the module directly in a Polyglot Notebook PowerShell codeblock works successfully though. This appears to be a known issue with PowerShell loading modules that require specific PowerShell features (possibly PowerShell remoting for backwards compatibility with Windows PowerShell). Continuing to research this for the time being.

@BrianTJackett
Copy link
Collaborator Author

Potential reference issue on .Net Interactive repo: Powershell module not importing or cant find #1720

@BrianTJackett
Copy link
Collaborator Author

Testing with an internal preview build of PowerShell v2 SDK for Microsoft Graph, I was able to get the authentication module to load dynamically in the OnLoadAsync method. Awaiting public preview release of that before continuing forward.

@BrianTJackett
Copy link
Collaborator Author

Using PowerShell v2 SDK preview 1, able to import Microsoft.Graph meta-module, but run into issues with Microsoft.Graph.Core NuGet dependency. Appears to be a package mismatch as .Net v5 SDK uses 3.X while PowerShell v2 SDK preview 1 uses 2.X. Opened issue for PowerShell v2 SDK to target Microsoft.Graph.Core to target 3.X, currently under consideration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant