Perhaps a bit OT: Ubuntu, PowerShell 7.4.4 and Azure/Entra

65 views
Skip to first unread message

Kurt Buff

unread,
Aug 2, 2024, 11:36:11 AM8/2/24
to ntpowe...@googlegroups.com
I have a learning project at work, using an Ubuntu 22.04 box, and am trying to query O365 with PowerShell 7.4.4 - the machine is not joined to the domain.

I have the module Microsoft.Graph and Microsoft.Graph.Beta 2.21.1 installed.

I am not very unfamiliar with the Entra ID environment, or at least accessing it via PowerShell, Windows or Ubuntu, and my reading of MSFT docs is frustrating.

Am I barking up the wrong tree - is it even possible to do this, or must I stick with Windows?

I ask, because I am stymied at the very first step.

I populate a variable with my Active Directory credential (UPN, replicated by AAD Connect), then issue the following, and get the error message shown:

Connect-MgGraph -Scopes "User.Read.All" -Credential $cred -TenantId <tenantid>
Connect-MgGraph: Parameter set cannot be resolved using the specified named parameters. One or more parameters issued cannot be used together or an insufficient number of parameters were provided.

I get the same result if I just issue this command:
connect-mggraph -Scopes "User.Read.All" -Credential $cred

And this just times out on Ubuntu, but works in Windows:
connect-mggraph -Scopes "User.Read.All"

I've looked at the help for connect-mggraph, but don't understand much of what it says.

Any pointers appreciated.

Kurt

Henry Awad

unread,
Aug 2, 2024, 11:48:23 AM8/2/24
to NTPowershell Mailing List
Maybe try using the Microsoft Entra PowerShell module instead 


--
You received this message because you are subscribed to the Google Groups "ntpowershell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ntpowershell...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ntpowershell/CADy1Ce4%2BWjHgGR5BQeoeLB8ZkseCdH9TMCPv2eM7F7Z28aiMFQ%40mail.gmail.com.

Michael B. Smith

unread,
Aug 2, 2024, 11:57:10 AM8/2/24
to ntpowe...@googlegroups.com

I just ran through the process of installing PS fresh in an Ubuntu VM and it worked for me. See below.

 

A key factor is that “Microsoft Graph PowerShell” has to be enabled and you have to be authorized to use it in your tenant.

 

--

Michael B. Smith

unread,
Aug 2, 2024, 11:57:37 AM8/2/24
to ntpowe...@googlegroups.com

You might also try using DeviceAuth

 

Kurt Buff

unread,
Aug 2, 2024, 12:30:19 PM8/2/24
to ntpowe...@googlegroups.com
I'll look that over, for sure.

Kurt

Kurt Buff

unread,
Aug 2, 2024, 12:34:43 PM8/2/24
to ntpowe...@googlegroups.com
Wait - where did your auth happen? I don't see a credential or a tenant id in your command, which seems to imply that you're logging into the VM with your Windows credentials.

My machine is a standalone box, isn't joined to the domain, so I can't use Windows credentials.

Kurt

Kurt Buff

unread,
Aug 2, 2024, 12:42:22 PM8/2/24
to ntpowe...@googlegroups.com
No UI, so no web browser on this box.

Kurt

On Fri, Aug 2, 2024 at 9:57 AM Michael B. Smith <mic...@smithcons.com> wrote:

Philip Brothwell

unread,
Aug 2, 2024, 1:11:39 PM8/2/24
to ntpowe...@googlegroups.com
I don't think the -Credential parameter as used by Connect-MgGraph works with username/password like you would expect.  See the comments for the git commit. https://github.com/microsoftgraph/msgraph-sdk-powershell/pull/1555
image.png

Michael B. Smith

unread,
Aug 2, 2024, 1:11:45 PM8/2/24
to ntpowe...@googlegroups.com

Doesn’t have to be on that box.

Michael B. Smith

unread,
Aug 2, 2024, 1:12:22 PM8/2/24
to ntpowe...@googlegroups.com

It opened a browser on the box. If you have no webui, you can use the DeviceAuth.

 

Sent: Friday, August 2, 2024 12:34 PM
To: ntpowe...@googlegroups.com

Michael B. Smith

unread,
Aug 2, 2024, 1:23:03 PM8/2/24
to ntpowe...@googlegroups.com

You’ve got to use Connect-Entra – which is the shimmed version of Connect-MgGraph. You’ll have exactly the same issue.

 

From: ntpowe...@googlegroups.com <ntpowe...@googlegroups.com> On Behalf Of Kurt Buff
Sent: Friday, August 2, 2024 12:30 PM
To: ntpowe...@googlegroups.com
Subject: Re: [ntpowershell] Perhaps a bit OT: Ubuntu, PowerShell 7.4.4 and Azure/Entra

 

I'll look that over, for sure.

 

Kurt

Reply all
Reply to author
Forward
0 new messages