[Azure] AAD “You do not have permission to view this directory or page.”
I ran into this error debugging my Cordova app from Visual Studio, running the debugger locally instead of on my device. After logging into Azure Active Directory with valid credentials, the page would display this error:
“You do not have permission to view this directory or page.”
As this was the second time I had to figure out how to solve it, thought I’d do a quick post on it for my own future reference 🙂
The solution is very simple once you know where to look:
- Open up the Azure management portal and browse to your App Service instance.
- Click Resource Explorer => Go to launch the resource explorer which allows you to browser and edit files.
- Expand the config node and click authSettings. This will open up a JSON file.
- Before you can edit the file, you need to set the application in read/write mode:
- Now search for the allowedExternalRedirectUrls node, it’s probably set to null if you haven’t changed it before.
- Now put in a JSON array of URL’s that you want to allow. In my case, I had to put in localhost:4400 as that is where the Cordova app is running:
"allowedExternalRedirectUrls": [ "http://localhost:4400", "https://localhost:4400" ],
- Click “PUT” to save the file back to the server.
That’s it! This should resolve the error and your authflow will hopefully start having as expected!