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


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.
Hi @AaseNomad Would you please provide us with an update on the status of your issue?
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.
You can use the "app-only access" method: https://docs.microsoft.com/en-us/graph/powershell/app-only?tabs=azure-portal
4 people are following this question.