Azure Notification Hub - The remote server returned an error: (403) Forbidden

Azure notification hub can be used to send push notification to your client app. It supports sending push notification to application build with Xamarin (but not only restricted to it).

I create a notification hub in Azure using FREE TIER for a work related project, with intention to be used by team to work and test push notification in their application development. Development environment setup gave assumption that the usage will be quite less so free tier will suffice the need here.

When you install the application (the one which has integrated Azure Notification Hub) on first run application will register the device with the Azure notification hub service (based on permission available) and that will count against "Active Device" in your hub server statistics.

Last night, team member complained that he is now getting:

'The remote server returned an error: (403) Forbidden.'.', Exception=System.Net.WebException: The remote server returned an error: (403) Forbidden.

every time he tries to debug app which is registering device with Azure notification hub on run.

I started looking into the Azure portal - Notification Hub manage page, remember these options are available in "Classic portal" only (at the time of writing).

I see the limit exceeded and marked red for active device count in the statics section.

Azure Notification Hub - Active Device Limit exceeded

The (403) Forbidden error was thrown because notification hub service was denying any more new registrations due to exceeded limits available in FREE TIER which is 500 Active devices per notification hub / namespace.

To resolve this issue I upgraded the service to BASIC plan (you can also upgrade to STANDARD plan. You can change this setting in "Scale" tab at top. That did it, error poofed!

I do not say that you HAVE TO upgrade. There can be other way to reduce or control that count. But out of scope for this topic. If you get (403) Forbidden error for integrating Azure notification hub in your client app, look for this problem to resolve it.

Happy coding!

Show Comments