rwilson504 / power-automate-azure-portal-hidden-api

2 stars 0 forks source link

Get initial-refresh-token via DeviceCode fails #1

Open Seji64 opened 6 months ago

Seji64 commented 6 months ago

Hi i have read your blog and wanted to try out the whole thing. However i am stuck authenticating via DeviceCode

CodeRef

I am getting the following error:

AADSTS500011: The resource principal named https://main.iam.ad.ext.azure.com/ was not found in the tenant named K-SYS.IO. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant.

I think MS have changed something. Do you know if there is a fix?

Thanks in advance!

rwilson504 commented 6 months ago

What Azure region is your tenant based in?

Seji64 commented 6 months ago

EU / Germany. But i found a fix myself => Using https://graph.microsoft.com instead of https://main.iam.ad.ext.azure.com/ as resource does the job

rwilson504 commented 6 months ago

Can you provide where in the process you needed to change that? I would love to update the instructions to help others. Thanks.

On Tue, Apr 16, 2024 at 2:37 AM Seji @.***> wrote:

EU / Germany. But i found a fix myself => Using https://graph.microsoft.com instead of https://main.iam.ad.ext.azure.com/ as resource does the job

— Reply to this email directly, view it on GitHub https://github.com/rwilson504/power-automate-azure-portal-hidden-api/issues/1#issuecomment-2058337457 or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYZTQLVI3TA54HQLAMKWCLY5TBJBBFKMF2HI4TJMJ2XIZLTSOBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJDUOJ2WLJDOMFWWLLTXMF2GG2C7MFRXI2LWNF2HTAVFOZQWY5LFUVUXG43VMWSG4YLNMWVXI2DSMVQWIX3UPFYGLLDTOVRGUZLDORPXI6LQMWWES43TOVSUG33NNVSW45FGORXXA2LDOOJIFJDUPFYGLKTSMVYG643JORXXE6NFOZQWY5LFVE3TCMZQGMZTIMJZQKSHI6LQMWSWS43TOVS2K5TBNR2WLKRSGI2DGNRVGUZDCMNHORZGSZ3HMVZKMY3SMVQXIZI . You are receiving this email because you commented on the thread.

Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub .

Seji64 commented 5 months ago

https://github.com/rwilson504/power-automate-azure-portal-hidden-api/blob/bef2b266557b26aa5fcd1bbbbd9ff43461fd2233/02-set-initial-refresh-token.ps1#L60

Change to $resource = if ($Environment -eq "AzureUSGovernment") {"main.iam.ad.ext.azure.us"} else {"graph.microsoft.com"}