All Collections
Frequently Asked Questions / Basics
For Admins
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.)
Isabella R. avatar
Written by Isabella R.
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 2 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”

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/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 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 the 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 = @{"@odata.id"="https://graph.microsoft.com/v1.0/users/"+$user.Manager} Set-MgUserManagerByRef -UserId $user.User -BodyParameter $NewManager Update-MgUser -UserId $user.User -Department $user.Department Update-MgUser -UserId $user.User -JobTitle $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 mins 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?