Ziba Leah
Ziba Leah

Reputation: 2504

Add existing user to Azure programmatically with Graph API

I'm capable of creating a new Azure User with the Graph.NET API:

POST https://graph.windows.net/myorganization/users?api-version=1.6

I have the token and it's working. But if I already have an user (coming maybe from Office365) how can I add him on Azure?

If I use the same command I get an error like

the user is already registered

Looking at the Microsoft docs, I can't find any help.

Is there any API to use to do it? Is there any useful SDK for c#? I'm actually doing everything with HttpClient.

EDIT: the result I want is the user to see and works with the subscriptions I want him to. Is this feasible with the AD GRAPH API or the GRAPH API?

Upvotes: 0

Views: 264

Answers (1)

Fei Xue
Fei Xue

Reputation: 14649

There is no need to add it to Azure. Based on my understanding, Both Azure and Office 365 use the Azure Active Directory to manager users.

And for the relationship about Azure with Azure Active Directory, you can refer the link below. And it should be similar with other subscriptions like Office 365.

How Azure subscriptions are associated with Azure Active Directory

And the Azure AD Graph users REST in the post is help to create a new user in the Azure Active Directory. And the error is expected when you create a new user with the exits userPrincipalName.

Upvotes: 1

Related Questions