In the Microsoft lab, you will create a web application that uses the Office 365 APIs. I was struggled for a couple hours to create the MVC5 Web Application from visual studio since it always stay on the O365 login page on the task #1, step 4-vii.
After debugging the issue, I found the issue and you might not be aware of. Here are two major issues you need to correct before creating the MVC5 Web Application from visual studio.
First is the correct O365 domain value. Most company have been provided the user friendly O365 URLs like https://company.sharepoint.com. You might assume that the domain is company.sharepoint.com. You will not pass the domain validation if you try this value. The correct domain vale should be company.onmicrosoft.com.
Second is the account with MFA disabled configuration. If you are stuck on the O365 login page, the root cause is MFA is enabled for the account. You need to login to the O365 and update the account to disable the MFA.
Third is the account Azure subscription. The account you used should be the account assigned the Azure subscription.
If you try to Add Connected Services as described in Microsoftlab task 3, you might receive the following error.
The forth is to verify whether ADFS has any configuration issue. You might need to use a local Azure account to Add Connected Services from visual studio if ADFS has issue. Another option is to set all the permissions directly from Azure that I will provide details in different blog.
Now you should pass the very first step to create MVC5 Web Application from visual studio to use Office 365 APIs. I'll summarize other challenge and tips for O365 provider hosted applications.