aspnet-connect-sample icon indicating copy to clipboard operation
aspnet-connect-sample copied to clipboard

Permissions Error When Hosted on Azure

Open vchske opened this issue 9 years ago • 4 comments

Hello, I'm trying to wrap my head around using Microsoft Graph for an app that will need to be hosted on Azure. I took the sample app and published it to an Azure app I own. I will be using Azure AD so I set up an AD app as well (putting the app id and secret in my web app's web.config using your instructions). I can launch the app fine. I click on "Get email address" and I get sent to a login page. When I log in via my (Microsoft) account I am presented with the following: You do not have permission to view this directory or page.

Any idea what I might be doing wrong?

My end goal is to simply check to see if a user is a member of a specific group and if not, kick them out. I'm thinking I can use GraphServiceClient.Me.CheckMemberGroups. Am I right here? Any help you can offer would be wonderful.

vchske avatar Apr 20 '17 02:04 vchske

Hello. I apologize for the lateness of this reply. I don't know why your Microsoft account would behave that way, unless there is something special about the way you registered your client. Did you use the app registration portal to register it (https://apps.dev.microsoft.com/) I ask because you mention that you're using Azure AD, and that suggests to me that you used portal.azure.com instead. Is there a reason why you can't use the app registration portal?

As for your plan, I think that looking at the user's member groups before allowing any further action should work.

jamescro avatar May 18 '17 21:05 jamescro

Closing for now. Please reopen if it continues to be a problem.

jamescro avatar May 23 '17 21:05 jamescro

Hi Jim. I ended up scrapping what I had done and started over from scratch. In doing that I got things to work as expected from the instructions (i.e. by using a converged application created at apps.dev.microsoft.com). I am still curious if this will work with an Azure AD application. These can be provisioned via apps.dev but ultimately are managed at portal.azure.com as you mentioned. I had initially gone with an Azure AD because the app I'm creating will be hosted in Azure and you can easily link an AAD to your web app in the Authentication blade.

vchske avatar May 30 '17 17:05 vchske

I don't believe that you can use an Azure AD application with the v2.0 endpoint. This article discusses the differences between the v1 and v2 endpoints: https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-limitations

jamescro avatar May 30 '17 17:05 jamescro