All Collections
Rollout & Adoption
Microsoft 365 Settings
How can I upload user information to Azure AD (org-chart, department, job title, etc.)
How can I upload user information to Azure AD (org-chart, department, job title, etc.)
Livia avatar
Written by Livia
Updated over a week ago

Teamflect fetches a user's manager, department, job title, phone number, and office location directly from Microsoft 365, so you don't need to upload the data to Teamflect. Most organizations upload this data to Azure AD, which is objectively a best practice, but if that is not the case for your organization, please follow along.

To upload your user data to Microsoft 365, you have two options:

  1. Upload in bulk [Requires Microsoft365 admin permissions] (Advanced)

  2. Add Manually [Requires Microsoft365 admin permissions]

Note: Both options require you to have administrative permission in Microsoft 365.

Option 1: Upload in bulk

1.1 Installing PowerShell

In Windows, search for Windows PowerShell, right-click, and then select “Run as Admin.”

The Microsoft Graph Powershell module will be used to upload data in bulk. If you have not used Microsoft Graph Powershell on your PC, you need to install the module first. Run the below comments one after the other:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser Install-Module Microsoft.Graph -Scope CurrentUser

When you are prompted to make a selection, type "A.". This will start the installation of the Microsoft Graph Powershell module.

Once the module is installed, run the command below to import the module to PowerShell, and you will be ready.

Import-Module Microsoft.Graph.Authentication

1.2 Preparing the CSV file

In this step, we will create a CSV file that is filled with your employee data. The file will look like this:

Note 1: You are not required to fill in all the cells in the template. Leaving a cell empty in the template will not update or replace the existing values you have in Azure AD. Make sure you don't delete or change the first row (headers) of the template.

Note 2: Make sure you add the UserPrincipalName to the A and B columns, not the mail address. In some organizations, these values can be different.

You can save the file to your desktop.

1.3 Running the script

Now, your CSV file and your PowerShell application are ready for the next step.

Open Powershell again and run the command below to connect to the Graph API:

Connect-MgGraph-Scopes "User.ReadWrite.All"

Once you run the command, you will see a dialog that prompts you to log in to Graph API, which will look similar to the image below. Please select your account and click "Accept."

Once this step is done, you will see the message below in PowerShell.

Now, we will import the CSV file that we created in Step 1.2

Run the command below, but don't forget to change the location of the CSV file. In the command below, the name of my CSV file is "orginfo," and the file is located on my desktop.

$users=Import-CSV "C:\Users\jande\OneDrive\Desktop\orginfo.csv"

After the file is imported, run the command below

foreach ($user in $users){ $NewManager = @{""=""+$user.Manager} Set-MgUserManagerByRef -UserId $user.User -BodyParameter $NewManager Update-MgUser -UserId $user.User: Department $user.Department Update-MgUser -UserId $user.User: Job Title: $user.Jobtitle Update-MgUser-UserId $user.User -OfficeLocation $user.OfficeLocation Update-MgUser -UserId $user.User: BusinessPhones $user.BusinessPhones }

Note: If you don't want to update some of the attributes in Azure AD, you can remove the related lines from the command above.

You will see error messages for the empty cells in the template, but there is no need to worry; the script will run for the existing values in your CSV file. The error message will look similar to the image below:

Option 2: Upload Manually

Select a user by clicking the user’s name (it will look similar to the image below).

A page will open with all the user details. Click “Properties”

Under the “Job Info” section, you will see a text field for job title, department, and manager information. Click the “Pen” icon to select the user’s manager.

Click on the "Pencil" icon next to the manager name to edit manager information. You can search for the manager's name using the search bar. Then select a manager and press the select button.

Then click the "Save" button. It should take around 5–10 minutes for the changes to reflect Teamflect.

Alternative Option

If you don't have access to Microsoft Azure Active Directory, please check out this article for instructions on setting up the relationships in Teamflect.

Did this answer your question?