Comments (7)
Investigating... thanks for reporting this issue.
from intune-powershell-sdk.
@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.
@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.
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.
Thanks! You don't happen to know how long the token is valid during inactivity?
from intune-powershell-sdk.
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.
(ref. https://github.com/MicrosoftDocs/windows-itpro-docs/issues/5772 )
from intune-powershell-sdk.
Related Issues (20)
- New-IntuneRoleAssignment gives badrequest
- Get-IntuneManagedDevice returns all devices in a single result
- Get-IntuneDeviceConfigurationPolicy Encrypted omasettings
- Could not create IntuneAppProtectionPolicyiOS policy when assignments are provided HOT 2
- Get-IntuneMobileApp and Get-DeviceAppManagement_MobileApps not retrieving macOS LoB Apps
- This repo is missing important files HOT 2
- Where is Disconnect-MSGraph? HOT 1
- Get-AADGroupmember doesn't work on groups that have a source of Windows Server AD HOT 1
- Exclude Microsoft Intune PowerShell from Compliance Policy
- Security & Compliance Center connection error
- Exchange Online Prerequisite Check Failure HOT 1
- Unable to Connect-msgraph using client secret or cert
- Error on Invoke-IntuneManagedDeviceSyncDevice
- Error on New-MgDeviceManagementDeviceEnrollmentConfiguration HOT 1
- H
- Connect Graph issues
- Get-IntuneMobileApp Productversion parameter shows the wrong data
- Update-mgdevicemanagementmanageddevice -devicecategory HOT 1
- 504 Gateway Timeout when using Get-IntuneManagedDevice | Get-MSGraphAllPages HOT 1
- Assignments missing from get-intunemobileapp output
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from intune-powershell-sdk.