question

AaseNomad avatar image
0 Votes"
AaseNomad asked AaseNomad commented

How to connect to Microsoft Graph without prompt

I'm trying to connect Microsoft Graph API in our remote desktop server using PowerShell and without the signin prompt/dialog so just wondering how can I do that?

how can I pass user credential?.

Connect-MgGraph

microsoft-graph-groupsmicrosoft-graph-data-connectmicrosoft-graph-securitymicrosoft-graph-cloud-pc
· 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.

Hi @AaseNomad Has your problem been resolved? Are there any updates?

0 Votes 0 ·
CarlZhao-MSFT avatar image
1 Vote"
CarlZhao-MSFT answered AaseNomad commented

Hi @AaseNomad

Of course, you can use an unattended daemon, which requires connecting to MS graph using the application's client id and certificate name.

 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 @AaseNomad Would you please provide us with an update on the status of your issue?

0 Votes 0 ·

Thank you.

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

Hi @AaseNomad

This command uses the device code flow by default, and when you run this command it prompts you to go to the web page to log in with the device code. Next you just need to copy the device login link to the browser and enter the device code, after which you will be redirected to the user login page. Only after the user is logged in will you receive: "Welcome To Microsoft Graph!" message prompt.

185923-image.png

185922-image.png


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.



image.png (11.0 KiB)
image.png (33.5 KiB)
· 3
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 @AaseNomad Would you please provide us with an update on the status of your issue?

0 Votes 0 ·

Hi this method is work but I'm just wondering if there is a way to connect without a user having to login in because the script will be unattended and it'll be running on our remote desktop server.

0 Votes 0 ·

Hi @AaseNomad Refer to the new answer I posted.

0 Votes 0 ·
michev avatar image
0 Votes"
michev answered
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.