Managing external identities to enable secure access for partners, customers, and other non-employees
Use the sign-in logs and the custom extension error codes to understand what is failing and whether the REST API is being called at all.
- Check Microsoft Entra sign-in logs for the exact custom extension error
- In the external tenant, go to Microsoft Entra admin center → Entra ID → Enterprise apps → Sign-in logs.
- Open the latest failed sign-in that corresponds to the correlation ID/time.
- Select the Authentication Events tab.
- In this tab, look for:
- HTTP status for the custom extension call
- Custom extension error code (1003xxx)
- Execution duration and retry count This tells whether the extension was invoked and what error Entra ID saw.
- Map the error from logs to the custom extension error table
In the Authentication Events details, find the
errorCodein the 1003000–1003027 range and match it to the documented meanings:- 1003005
CustomExtensionTimedOut: API didn’t respond within the allowed timeout or token invalid. - 1003007/1003009
CustomExtensionNullClaimsResponse/CustomExtensionEmptyResponse: body missing or null. - 1003006
CustomExtensionInvalidResponseContentType: content-type notapplication/json. - 1003002/1003003/1003008/1003010/1003012: response schema or action type invalid.
- 1003014/1003015/1003020: configuration issues with
identifierUris, domain name, or target URL. - 1003021: missing
CustomAuthenticationExtensions.Receive.Payloadpermission. - 1003027: connection error to the API.
- A configuration problem (resourceId, targetUrl, permissions, URL format), or
- A runtime problem (timeout, invalid response, content type, etc.).
- 1003005
- Verify custom extension configuration (resourceId/targetUrl)
Based on the error codes reference:
- Ensure the targetUrl and resourceId share the same fully qualified domain name (avoid 1003015
CustomExtensionDomainNameDoesNotMatch). - Ensure the resourceId appId corresponds to an existing service principal in the external tenant (avoid 1003016/1003017/1003019).
- Ensure the targetUrl is a valid
httpsURL (avoid 1003020CustomExtensionIncorrectTargetUrlFormat). - Ensure the Microsoft Graph service principal is present and enabled (avoid 1003022).
- Ensure the endpoint is not blocked (avoid 1003023).
- Ensure the targetUrl and resourceId share the same fully qualified domain name (avoid 1003015
- Verify permissions for the custom extension resource app
- In the external tenant, open the app registration used as the resourceId for the custom extension.
- Confirm that admin consent has been granted for the Microsoft Graph
CustomAuthenticationExtensions.Receive.Payloadapp role (application permission) to the service principal that represents the custom extension client (avoid 1003021CustomExtensionPermissionNotGrantedToServicePrincipal).
- Call the REST API directly with a proper Entra access token
Because the API is in another tenant and you currently allow anonymous, confirm that the extension can reach it and that it behaves correctly when called as Entra expects:
- In the external tenant, open the Azure Functions authentication events API (or equivalent) app registration used for the custom extension.
- Create a client secret if not already present.
- From Expose an API, copy the Application ID URI (for example
api://contoso.azurewebsites.net/aaaabbbb-0000-cccc-1111-dddd2222eeee). - In an API testing tool, request a token:
- POST to
https://login.microsoftonline.com/{tenantID}/oauth2/v2.0/token. - Body (form-data):
-
grant_type:client_credentials -
client_id: client ID of the application -
client_secret: its client secret -
scope:{Application ID URI}/.default
-
- POST to
- Decode the
access_token(for example with https://jwt.ms) and verify:-
issmatches the issuer configured in the API. -
audmatches the client ID configured in the API.
-
- Use this token as a Bearer token and call the same endpoints (
create, etc.) that the custom extensions use, with the same request body shape expected by the extension type.
- Authentication/authorization logic in the API (even if currently overridden).
- Response content-type (
application/json). - Response schema (must match the custom extension type’s schema).
- Confirm the API is reachable and not timing out
If the sign-in logs show 1003005
CustomExtensionTimedOutor 1003027CustomExtensionConnectionError:- Check network connectivity from Entra to the AKS-hosted API (public DNS, firewall, IP restrictions, TLS cert validity).
- Ensure the API responds within the two-second timeout window. If there are downstream calls, add logging for their durations and consider caching tokens and using a “warm” hosting plan as recommended.
- Enable and use detailed logging on the API side
The platform hosting the API (for example, Azure Functions or other API platform) should log:
- All incoming requests (method, path, correlation IDs if passed, timestamps).
- Response status codes and durations.
- Any exceptions when parsing the Entra extension payload.
- Performance and reliability checks
If performance-related errors appear (timeouts, throttling):
- Cache any downstream access tokens.
- Log and optimize calls to downstream services.
- Host the API on a plan that keeps it warm (for example, Premium or Dedicated for Azure Functions).
- Use automated integration tests or API testing tools to validate performance against the two-second limit.
By combining the Authentication Events details in sign-in logs with the custom extension error codes and a direct, token-based call to the API, it becomes clear whether the issue is configuration (resourceId/targetUrl/permissions), connectivity, timeout, or response schema/content-type.
References: