DCToolbox icon indicating copy to clipboard operation
DCToolbox copied to clipboard

Connect-DCMSGraphAsDelegated not connecting

Open carfesh opened this issue 1 year ago • 8 comments

It seems that a CA policy backup is currently not possible with the current version 1.0.39 of DCToolbox; the function Connect-DCMSGraphAsDelegated is missing the Get-AuthCode call. Even if I add that in, the export will fail with error 403. Is that a known issue, am I supposed to be doing something differently than calling Export-DCConditionalAccessPolicyDesign with my application ID and secret?

carfesh avatar Mar 15 '23 12:03 carfesh

I too am receiving a null index array error when trying to export the CA policies.

LukePWilkins avatar Mar 15 '23 22:03 LukePWilkins

Same here, the problem is that version 1.0.39 is missing a call to function Get-AuthCode in line 1007

Before (working) ` >> # Get AuthCode.

$Url = "https://login.microsoftonline.com/common/oauth2/authorize?response_type=code&redirect_uri=$RedirectUriEncoded&client_id=$ClientID&resource=$ResourceEncoded&prompt=admin_consent&scope=$ScopeEncoded" Get-AuthCode`

Now (not working)

Get AuthCode.

$Url = "https://login.microsoftonline.com/common/oauth2/authorize?response_type=code&redirect_uri=$RedirectUriEncoded&client_id=$ClientID&resource=$ResourceEncoded&prompt=admin_consent&scope=$ScopeEncoded" `

Juan-Pablo-Rodrigo avatar Mar 20 '23 20:03 Juan-Pablo-Rodrigo

Also getting "Connect-DCMsGraphAsDelegated : Cannot index into a null array." :(

homeslice-g avatar Mar 30 '23 20:03 homeslice-g

Also getting "Connect-DCMsGraphAsDelegated : Cannot index into a null array." after updating to v1.0.39.

If we can't get a fix here can you re-post v1.0,29 which worked correctly, or explain how we can un-update our DCToolbox version?

BTW happy to see this post, I have spent the last month thinking this is my problem and how I might fix it.

Pickell avatar Apr 17 '23 18:04 Pickell

I can also confirm this is happening, doesnt seem like I can use the tool at all any more.

New-DCConditionalAccessPolicyDesignReport @Parameters
VERBOSE: Connecting to Microsoft Graph...
Connect-DCMsGraphAsDelegated : Cannot index into a null array.
At C:\Program Files\WindowsPowerShell\Modules\DCToolbox\1.0.39\DCToolbox.psm1:3159 char:20

samredinet avatar Apr 20 '23 08:04 samredinet

Uninstall-Module DCToolbox Install-Module DCToolbox -RequiredVersion 1.0.29

This allowed me to connect and use version 1.0.29 rather than the latest release.

MichaelRyan87 avatar May 24 '23 01:05 MichaelRyan87

After the uninstall/reinstall to the 1.0.29 version, it's now looking like it's connecting to graph. But now I'm running into an issue where it just keeps cycling the login/picking an account. Anyone run into that or is that a me problem?

brucemspencer avatar Jun 02 '23 21:06 brucemspencer

I can confirm that with 1.0.39 the Connect-DCMsGraphAsDelegated ends up with a NULL array and 1.0.29 is not working for me either because it requires some additional admin permissions, but the message does not explain which and where, afterwards it loops back to the selection window as mentioned by @brucemspencer.

chemical1979 avatar Jul 14 '23 06:07 chemical1979