Resolved: Connect Microsoft Identity to Azure AD error

Question:

Can someone explain to me why am I getting the following error when trying to connect Microsoft Identity to my Azure account to enable Azure AD authentication in my web app? enter image description here

Answer:

This error commonly occurs when Visual Studio or your method of authentication to your Azure subscription was done with a Microsoft Account and not an Azure Active Directory account.
  1. If it is something like username@yourdomain.com, Please try to add this identity in the office 365 subscribed azure active directory account as a new guest user by creating a user identity by filling name matching your Hotmail account and creating a password .So that identity is created as username@yourdomain.onmicrosoft.com.

  2. The user must be recognized as a subscription owner.For that go to subscription properties by searching for Subscriptions . If you have multiple subscriptions, please make sure to select the one you intend to use for your application. Once in the subscription properties, select the Access control (IAM) option > Role assignments > Add.


iam
  1. In the Add role assignment blade, select Owner from the Role drop-down list. Leave the Assign access to option at its default (User, group, or service principal). You’ll see all of the users listed. Select the newly created one and then save.

enter image description here
  1. Then sign out of aad account , save and close visual studio . Now Sign into azure ad account with this newly created identity and then try to add/Connect this identity in visual studio Microsoft identity platform.

In place of 2nd step from Azure,you can create a Free or Pay as you Go account using your Outlook.com email address (such as personal@outlook.com) or username@hotmail.com.
This creates an Azure subscription with a new Azure Active Directory and your account as the first user. It forms the new directory’s default domain name (personaloutlook.onmicrosoft.com) and you can add a custom domain name next similar to personal microsoft account if needed .
And then continue from step 3 to create owner role or admin to connect.
References:
  1. Using Azure Active Directory Accounts with a Subscription Tied to a Personal (aka Live) Account | The Data Farm
  2. difference between a personal Microsoft account and a work or school account? – Microsoft Tech Community
  3. Connected services – Visual Studio (Windows) | Microsoft Docs

If you have better answer, please add a comment about this, thank you!

Source: Stackoverflow.com