E. Erfan
E. Erfan

Reputation: 1401

Cannot connect Azure DevOps organization to Azure Active Directory

I have created an Azure DevOps organization. I have created it with my outlook account. I want to connect it to Azure Active Directory (AAD), Default Directory, on my Azure portal. I am using the free account on Azure portal which allows me to have one subscription. The AAD directory is shown below:

enter image description here

I want to connect my Azure DevOps organization to Azure Active Directory. I am using the same user in Azure portal and Azure DevOps. I have basically created both by the same account. I am following the instruction at this link to connect Azure DevOps organization to Azure AD. I emphasize that in my case both are created by the same email. However, in Azure DevOps Organization settings, by clicking on "connect directory" under "Azure Active Directory", I get an error that: "User [email protected] is a guest in the target AAD tenant Default Directory. The current organization policy does not allow guest users to access the organization. Change the policy setting to allow external guest access and try again."

This is what I see at organization settings in DevOps:

Azure DevOps Organization Settings

This is the error when I try to connect it to AAD:

enter image description here

When I check my user in Azure Active Directory I can see it has global admin role, and is a member, not guest! It is after all the user by which I have created this account and all the resources: (It is the user on the second row:)

User in AAD

As mentioned earlier, this user has global administrator role:

enter image description here

I also tried changing my policies at AAD side to be able to connect my DevOps project to AAD, but again it fails. This is how the policies are:

external collaboration policy

I basically don't know what else I should do to connect DevOps to AAD. Any help is appreciated.

Upvotes: 18

Views: 10877

Answers (5)

Jakub
Jakub

Reputation: 1155

A solution that doesn't require creating a new Azure DevOps organization

Due to the fact that all solutions suggest creating a new organization - which is not always possible, for example due to the requirement of using a new name - my solution doesn't require creating a new organization.

  1. Go to the Azure Active Directory service in your directory and create a new user. enter image description here
  2. Add the newly created user to the Azure DevOps organization (the email might look like [email protected]).
  3. Log in with this user ([email protected]) in incognito mode in your web browser to the Azure DevOps organization.
  4. Go back to your Azure Devops organization (logged using Microsoft Account) and transfer ownership of the organization to the newly created user ([email protected]).
  5. Remove unnecessary users (optional).
  6. At this point, you can link the organization with Azure Active Directory.

Once the organization is linked to Azure Active Directory, you can change the organization's owner and remove the temporary account from the organization and AD ([email protected]).

Upvotes: 5

Umar Yousaf
Umar Yousaf

Reputation: 11

Switch to right Directory when creating new organization in devops:

enter image description here

Upvotes: 1

vinay shetty
vinay shetty

Reputation: 981

Click on the link and Change the Microsoft Directory To Default Directory. This solves the issue.

Upvotes: 0

Kushal Asopa
Kushal Asopa

Reputation: 1

I actually read the answer many times but still did not understand. After spending a lot of time I realized after deleting my organization when we are on dev.azure.com when we login we need to select the right directory in the popp-up.

Upvotes: 0

RamaraoAdapa
RamaraoAdapa

Reputation: 3119

When you log in to Azure DevOps, it logs in with Microsoft Directory.

You need to switch the tenant to your default directory

enter image description here

Then you would be able to link your Azure AD tenant to your Azure DevOps Organization

Upvotes: 18

Related Questions