question

filoup avatar image
0 Votes"
filoup asked saldana-msft edited

Get-MgOrganization authentification problem

HI,

My powershell script is connected to Graph API using a secretkey.

Modules Microsoft.Graph.Authentication and Microsoft.Graph.Identity.DirectoryManagement are imported.
use application permissions Organization.Read.All, Directory.Read.All, Organization.ReadWrite.All, Directory.ReadWrite.All

Get error "Get-MgOrganization : Authentication needed, call Connect-MgGraph" when running my script

Best regards

microsoft-graph-identitymicrosoft-graph-applications
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@filoup Are you using a service principal to connect to MgGraph?

0 Votes 0 ·

1 Answer

CarlZhao-MSFT avatar image
0 Votes"
CarlZhao-MSFT answered CarlZhao-MSFT commented

Hi @filoup

You need to use a service principal to connect to MgGraph:

 Connect-MgGraph -ClientID YOUR_APP_ID -TenantId YOUR_TENANT_ID -CertificateName YOUR_CERT_SUBJECT 

If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @filoup Would you please provide us with an update on the status of your issue?

0 Votes 0 ·

Hi @filoup

Is there anything else I can help with regarding this issue?

You can comment us at any time and we will continue to follow up.

Thanks,
Carl Zhao

0 Votes 0 ·