SharePoint / sp-dev-docs

SharePoint & Viva Connections Developer Documentation
https://docs.microsoft.com/en-us/sharepoint/dev/
Creative Commons Attribution 4.0 International
1.25k stars 1.02k forks source link

Get 500 Error "Unable to find target address" when running $appPrincipal = Get-MgServicePrincipal -Filter "AppId eq '$clientId'" #10026

Closed houjianyu closed 2 days ago

houjianyu commented 2 days ago

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

SharePoint Add-ins

Developer environment

Windows

What browser(s) / client(s) have you tested

Additional environment details

Describe the bug / error

The secret of our SharePoint Add-in was expired and I follow here to renew it: https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/replace-an-expiring-client-secret-in-a-sharepoint-add-in. At step 3 when running $appPrincipal = Get-MgServicePrincipal -Filter "AppId eq '$clientId'" it shows me the error:

PS C:\Windows\System32> $appPrincipal = Get-MgServicePrincipal -Filter "AppId eq '$clientId'" Get-MgServicePrincipal_List: Unable to find target address

Status: 500 (InternalServerError) ErrorCode: InternalServerError Date: 2024-11-19T22:51:42

Headers: Vary : Accept-Encoding Strict-Transport-Security : max-age=31536000 request-id : 26bba0ca-22bc-444f-a9d8-380386a6e453 client-request-id : 9e5d6277-4e7e-4ee6-91d2-aa37fb1a3755 x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Canada East","Slice":"E","Ring":"3","ScaleUnit":"001","RoleInstance":"QB1PEPF000057A2"}} Date : Tue, 19 Nov 2024 22:51:41 GMT

Steps to reproduce

  1. As above described.

Expected behavior

Should get principal id by AppId

houjianyu commented 2 days ago

Issue resolved after changing to use a work/school account.