Get secret from Azure key vault

I wrote a script using the Modules
Microsoft.Graph.Authentication
Microsoft.Graph.Beta.Users
Microsoft.Graph.Users
Microsoft.Graph.Users.Actions

I want my runbook to get the app secret from Azure Key vault, but the only way to do that (which i know off), is using Connect-AzAccount and Get-AzKeyVaultSecret. Via write-Output i can verify that the automation account can successfully retrieve the app secrets from key vault. Although the app secret is retrieved successfully, the connection to MgGraph fails with " Entry point was not found."

Searching that error brings me to Github, which describes the issue i am facing:
Connect-MgGraph throws ‘Entry point was not found.’ · Issue #2594 · microsoftgraph/msgraph-sdk-powershell · GitHub

Is there another way to retrieve the key vault secret? I have looked in the Microsoft.Graph modules v1.0 and beta, but fail to find a way to connect to the key vault and retrieve secrets.

xX-XX-XxxxxxXXxXxXxXXXXXXXXXXXxXXxXxxXX
XXXxxxxx-xxxx-xxxxxxxxxx-xxxxxX--XXx
02-4-2024 Script started
Converting Application secret to secure string
Creating Cloud credentials
Connecting to Mg Graph
Entry point was not found.
failed to connect to tenant xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Falled to connect to MGGraph

Interesting. From reading a bit this seems like a bug unique to using Az modules and Graph in the same session. I’m feeling a little lucky as we just released a process this week that involved pulling logs from sentinel, so we needed to use the Az PS module, and in that same session, we also do make calls to graph, so we are connecting to graph via app based auth as well. We must be running unimpacted versions.

PS 7 a requirement? I saw one person mention it’s not an issue with PS5, not sure what version you are using or if that’s accurate.

I think there might be other ways of pulling that key, but its likely via other tools like az cli. haven’t done a ton of digging on what’s out there.