Configuring a Notification Hub with token-based APNs authentication (.p8 key) consistently failed with:
BadRequest — Failed to validate credentials with APNS
This error gives no further detail client-side, across every interface tried:
- Azure Portal (Apple (APNS) blade, Authentication Mode = Token)
- Azure CLI (
az notification-hub credential apns update)
- Direct ARM REST PATCH with
apnsCredential
What we verified was correct (to save others from re-checking the same things):
- Key ID, Team ID, and Bundle ID all matched exactly what's shown in the Apple Developer portal
- The Push Notifications capability was confirmed enabled on the App ID before generating the key (tried both before-enable and after-enable key generation — same failure either way)
- "Broadcast Capability" (a sub-option under Push Notifications) was explicitly disabled — this can trip up validation in some setups
- The
.p8 token content was verified byte-for-byte, including the BEGIN/END PRIVATE KEY lines, with real newlines (not escaped \n sequences from a JSON export — a separate gotcha we also hit when configuring FCM v1, worth checking if you're pasting from a downloaded JSON key)
- Tried against both
api.development.push.apple.com and api.push.apple.com endpoints
- Tried with a completely fresh key generated ~20 hours later, to rule out Apple-side propagation delay
- Confirmed via the Portal's own "Change" validation too — same generic error, no additional detail surfaced
Resolution: Since our subscription doesn't have a paid support plan (so no way to open a technical ticket to see server-side logs), we switched to Certificate mode instead — generated an APNs SSL certificate (Sandbox & Production) via Apple Developer portal, built a .p12, and configured the hub with Authentication Mode = Certificate. This validated successfully on the first attempt, using the same App ID/Team ID that had failed repeatedly under token mode.
Posting in case anyone else hits the same wall — token mode is generally recommended over certificates (no annual renewal, works across multiple apps with one key), so if anyone from the product team can shed light on what specifically causes token-mode validation to fail silently like this, it'd help others avoid losing time chasing credential-formatting issues that turn out not to be the actual problem.Configuring a Notification Hub with token-based APNs authentication (.p8 key) consistently failed with:
BadRequest — Failed to validate credentials with APNS
This error gives no further detail client-side, across every interface tried:
- Azure Portal (Apple (APNS) blade, Authentication Mode = Token)
- Azure CLI (
az notification-hub credential apns update)
- Direct ARM REST PATCH with
apnsCredential
What we verified was correct (to save others from re-checking the same things):
- Key ID, Team ID, and Bundle ID all matched exactly what's shown in the Apple Developer portal
- The Push Notifications capability was confirmed enabled on the App ID before generating the key (tried both before-enable and after-enable key generation — same failure either way)
- "Broadcast Capability" (a sub-option under Push Notifications) was explicitly disabled — this can trip up validation in some setups
- The
.p8 token content was verified byte-for-byte, including the BEGIN/END PRIVATE KEY lines, with real newlines (not escaped \n sequences from a JSON export — a separate gotcha we also hit when configuring FCM v1, worth checking if you're pasting from a downloaded JSON key)
- Tried against both
api.development.push.apple.com and api.push.apple.com endpoints
- Tried with a completely fresh key generated ~20 hours later, to rule out Apple-side propagation delay
- Confirmed via the Portal's own "Change" validation too — same generic error, no additional detail surfaced
Resolution: Since our subscription doesn't have a paid support plan (so no way to open a technical ticket to see server-side logs), we switched to Certificate mode instead — generated an APNs SSL certificate (Sandbox & Production) via Apple Developer portal, built a .p12, and configured the hub with Authentication Mode = Certificate. This validated successfully on the first attempt, using the same App ID/Team ID that had failed repeatedly under token mode.
Posting in case anyone else hits the same wall — token mode is generally recommended over certificates (no annual renewal, works across multiple apps with one key), so if anyone from the product team can shed light on what specifically causes token-mode validation to fail silently like this, it'd help others avoid losing time chasing credential-formatting issues that turn out not to be the actual problem.