Register app in the azure portal with the below link:
- Select App registrations.
- Search for SharePoint and click on “SharePoint Online Client Extensibility Web Application Principal”.
Click on API permissions under Manage (left side) you will see the application related permissions.
Move these permissions to Configured permissions and grant admin consent.
Choose Graph API and save the configuration from the employee directory's advanced settings. After that refresh the page.
Global Admin access is required to configure Azure API.