Troubleshooting 'Global Service Principal ID' Error in SPFX Deployment

Getting Could not retrieve Global Service Principal ID Error: Error: {} when deploying SPFX with Graph API.

We recently ran into an issue when creating an SPFX solution to work with OneDrive using App registrations using an O-Auth Implicit flow that our SharePoint Admin Center API Access page then gave an error.

API Access

This is due to a bad Azure AD App Registration tagged under SharePoint that is causing the error.  

Go into Azure ‘Active Directory’, go to ‘App Registrations', and search for “SharePoint”, You can find these two apps.

App Registration

Now open your SharePoint admin page and open ViewSource by clicking “CTRL+U” and search for spfx3rdPartyServicePrincipalId. You’ll find a GUID, copy that GUID, and check with these two apps. 

Delete the app that is not matching. 

Even after deleting the app you still facing the issue, then surely you are not a GlobalAdmin.  

You may be a SharePoint Admin, not a Global Admin. 

Next, get GlobalAdmin access to proceed or ask your Global Admin to approve your request.