Delegate access is by design interactive only, the exception being the ROPC flow. However, once you authenticate, the module will reuse the obtained refresh token and you will no longer see any login prompts, until either the token expires or you manually disconnect. Alternatively, you can authenticate outside of the module and pass a token.
Powershell Automate MG graph Delegated Access
Hi,
I am looking for a way to Automate certain Tasks using MG Graph, Challenge here is that there is certain permission that requires delegated access. I am not able to get the right article on how to use delegated access without me intervening to enter my username and password Every time.
By Entering Username and password i am able to authenticate and use MG Graph powershell SDK.
i am lost please help here.
2 answers
Sort by: Most helpful
-
-
Limitless Technology 39,786 Reputation points
2022-09-09T07:48:10.68+00:00 Hello there,
This is by design as each API in the Microsoft Graph is protected by one or more permission scopes. The user logging in must consent to one of the required scopes for the APIs you plan to use.
The Find-MgGraphCommand cmdlet can be used to discover the required permissions for another cmdlet.
Use the Connect-MgGraph command to sign in with the required scopes. You'll need to sign in with an admin account to consent to the required scopes.
You can also try App-only authentication with the Microsoft Graph PowerShell SDK
I hope this information helps. If you have any questions please let me know and I will be glad to help you out.
----------------------------------------------------------------------------------------------------------------------------------------
--If the reply is helpful, please Upvote and Accept it as an answer--