Code Monkey home page Code Monkey logo

Comments (7)

nsoy avatar nsoy commented on May 12, 2024

Investigating... thanks for reporting this issue.

from intune-powershell-sdk.

rohitramu avatar rohitramu commented on May 12, 2024

@giertz Thanks for reporting this - I've found a fix and am in the process of releasing a new version.

Just out of curiosity, why are you trying to unload/reload the module? Is there a specific scenario you need this functionality for?

from intune-powershell-sdk.

giertz avatar giertz commented on May 12, 2024

@rohitramu Im working on a console tool where you can load various cloud modules and then authenticate with stored credentials. There is a function builtin that allows the user to disconnect a current session, in this case it will just unload the module. So in a scenario where the user either wants to just "disconnect" or authenticate with a new account this function will be executed.

from intune-powershell-sdk.

rohitramu avatar rohitramu commented on May 12, 2024

Cool, that sounds interesting! Just in case you weren't aware: even when you unload a module, the currently loaded dll's will not be unloaded from memory - the cmdlets just won't be available to use. The easiest way I know of to unload dll's is to use separate PowerShell sessions. This way, you can just exit the sessions and the dll's will be unloaded from memory.

An alternative is to just not unload the module at all. The "connection" is actually a bit of an illusion. Authentication for Microsoft Graph actually works by retrieving an authentication "token" when you run Connect-MSGraph, and then this token is sent along with each request to Microsoft Graph. This means that there actually isn't any persistent connection that you can close.

In terms of logging into a different account, you can do that with the following command, which will force a login window to open:

Connect-MSGraph -ForceInteractive

I have updated the release with the fix. Please download it again from the "Releases" tab in this repository.

from intune-powershell-sdk.

giertz avatar giertz commented on May 12, 2024

Thanks! You don't happen to know how long the token is valid during inactivity?

from intune-powershell-sdk.

rohitramu avatar rohitramu commented on May 12, 2024

I think it might be an hour. However, you shouldn't need to worry about that because the module will automatically refresh the token (i.e. get a new token) for you if it has expired.

from intune-powershell-sdk.

 avatar commented on May 12, 2024

(ref. https://github.com/MicrosoftDocs/windows-itpro-docs/issues/5772 )

from intune-powershell-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.