Score:0

Using same credentials for Connect-MgGraph and Connect-ExchangeOnline

it flag

I'm working on a (powershell) script which creates a Service Principal using MS Graph and then wants to grant that principal permissions in MS Exchange. Both the Graph and Exchange are in the same Azure tenant (domain).

I would like the script to ask the user for credentials only once to do this, but both the Connect-MgGraph and Connect-ExchangeOnline commands prompt for credentials.

Is there some way to have just a single prompt for credentials here?

Is it just a case of adding the right scope(s) to the Connect-MgGraph command? Perhaps this also involves replacing the ExchangeOnline commands with ones that use the Graph interface to do the work directly?

Version 3.1.0-Preview1 of the Exchange Online tools (I'm currently on 3.0.0) has a -AccessToken option for Connect-ExchangeOnline which might be what I need, though I still need to know what scopes are required, how to extract the access token from wherever Connect-MgGraph stashed it, and possibly get around the inability to get a token for scopes in multiple domains (or perhaps that is outdated) though this now appears fixed.

Score:0
vi flag

To use app-only access, the certificate is loaded from Cert:\CurrentUser\My\ when or is specified. Make sure that the certificate you're using is present in the store before calling . For more info, seeenter link description here

Kevin Martin avatar
it flag
This doesn't really answer the question at all. The script is not trying for app-only access (although that is ultimately what the script is trying to set up for some other purpose). This is a script to be run by a person, and currently when they run it they are challenged for credentials twice, once by Connect-MgGraph and once by connect-ExchangeOnline. I would like to (somehow) use the credentials or access token or something from the connect-MgGraph authorization in order to have connect-ExchangeOnline not issue a second challenge for credentials.
falaisi avatar
vi flag
It maybe depends on the authentication format.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.