Skip to content

Import objects from Azure AD (AAD)

As many of the services in Azure, Azure Active Directory (AAD) is easiest to work with in an automated way is with PowerShell, the Microsoft Graph PowerShell SDK and the module Easit.GO.Webservice.

Prerequisites

  • Microsoft PowerShell 7
  • The Microsoft Graph PowerShell SDK
  • The Easit.GO.Webservice PowerShell module.

Install the Microsoft Graph PowerShell SDK

Microsoft has an excellent guide for this here.

Get started with the Microsoft Graph PowerShell SDK

Microsoft has, yet again, an excellent guide for this here.

Install Easit.GO.Webservice

The PowerShell modules for Easit GO WebAPI is published to the PowerShell Gallery so the easiest way to install is by running Install-Module -Name Easit.GO.Webservice

Prepare Easit GO to receive objects

When you have successfully connected to Azure AD with the Graph SDK we can proceed with the necessary configuration needed in Easit GO. These steps require you to have a design license or a user that have completed our Integration training.

  1. Login to Easit GO.
  2. Click on the cog in the top right corner.
  3. Type import handler and click on the result.
  4. Click Add.
  5. Give it a name.
  6. Give it a description explaining what the import handler should do.
  7. Set a simple but clear identifier, for example azureContacts.
  8. Click on + to the right, on the same row as Import actions.
  9. In the popup, type contact as the name, select Import item as the import action and then click OK.
  10. Click on the cog for the same row as 1. @ contact.
  11. Change the value for Module to Contact.
  12. In the "Search section", add a unique mapping by clicking on the +, choose E-mail and click Add.
  13. Type the property name to Mail, this tells the import handler that it should find any existing contacts in Easit GO with the value for the attribute Mail from Azure AD.
  14. In the "Create section", choose an Item type (most likely Contact) and then you add all the mappings you would like to have. Property is the property name from Azure and field is the field in Easit GO that the value should go in.
  15. When you feel that you have some basic mapping done, click OK and then Save.

If you do not have an API-key for Easit GO you can generate one by backing out of the configuration section for import handlers and then type api where you typed import handler in step 3.

You can read more about Import handlers here.

Create / Update PowerShell script

A basic script that will connect to the Microsoft Graph API, get all users and then send them to Easit GO could look like this. In this example we are using app-only access via client credential with a certificate.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
    try {
        Connect-MgGraph -ClientId "YOUR_APP_ID" -TenantId "YOUR_TENANT_ID" -CertificateName "YOUR_CERT_SUBJECT" -ErrorAction 'Stop'
    } catch {
        Write-Error $_
        return
    }
    try {
        # Get the first 50 users
        $users = Get-MgUser -Property "id,displayName,mail" -PageSize 50
    } catch {
        Write-Error $_
        return
    }
    $easitGOAPIparams = @{
        url = 'https://urltoEasitGO'
        apikey = 'myapikey'
        ImportHandlerIdentifier = 'azureContacts'
    }
    try {
        Send-ToEasitGO @easitGOAPIparams -Item $users
    } catch {
        Write-Error $_
        return
    }
    try {
        Disconnect-MgGraph
    } catch {
        Write-Error $_
    }