Unable to sign in to Azure AD using a device code when hosted in an Azure Web App


  • I have an application that needs to use the device code option in ADAL (acquireUserCode and acquireTokenWithDeviceCode) to get the users Azure AD token. It works on my local machine but when deployed to an Azure Web App it doesn't work (located in north europe). It worked 24 hours ago, but about 12 hours ago I started to get this message "AADSTS50134: Wrong Data Center" after entering the device code. AppInsights telemetry shows a bad request (400) to Since a few hours I now get another error message "Sorry, but the code you entered earlier has expired. Please get a new code from the application on your device." See attached images below.

    First (and previous issue)

    New issue

    Any thoughts, resolutions, ideas?


    Microsoft Certified Architect - SharePoint 2010, Microsoft Certified Master - SharePoint 2010, SharePoint MVP and Solutions Architect
    Author of SharePoint 2010 Web Parts in Action

    Thursday, April 27, 2017 6:23 AM

All replies