# Azure AD

## Overview <a href="#pdf-page-qbcwdne47qzdelmkd46o-pdf-page-8nbmsc4bxmq9mzlvcnkp-id-1.-overview" id="pdf-page-qbcwdne47qzdelmkd46o-pdf-page-8nbmsc4bxmq9mzlvcnkp-id-1.-overview"></a>

This document describes a brief overview of the functionality and the requirements of AzureAD Oauth connector.

## Setup <a href="#pdf-page-qbcwdne47qzdelmkd46o-pdf-page-8nbmsc4bxmq9mzlvcnkp-id-2.-setup" id="pdf-page-qbcwdne47qzdelmkd46o-pdf-page-8nbmsc4bxmq9mzlvcnkp-id-2.-setup"></a>

1. In your Microsoft Azure UI, navigate to the Azure Active Directory service.&#x20;
2. In App registrations, create a new app.

<figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2FDVigWSF0ZZ9CbZmH9vyw%2Fazure1.png?alt=media&#x26;token=16f46a4a-362b-4522-bcfa-81d9bd825f8e" alt=""><figcaption><p>Create a New Azure AD Application</p></figcaption></figure>

3. From there copy the following information.
   1. **Client Id:**

<figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2F1EP9ujrLO2reMYpvIaG8%2Fazure2.png?alt=media&#x26;token=109eb7b5-3327-4ddc-bcfd-584f2cf1edf0" alt=""><figcaption><p>Client ID</p></figcaption></figure>

&#x20;       b.  **Tenant ID:**

<figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2Fiq3zPtPxMJbtm304J3Lj%2Fazure3.png?alt=media&#x26;token=4fe08efe-3676-4cbd-9769-d85323e3309d" alt=""><figcaption><p>Tenant ID</p></figcaption></figure>

4. From the **Endpoints** copy the following:

<figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2Fe8YcU6ORlBkl6xCjBRK3%2Fazure4.png?alt=media&#x26;token=fea34646-96b7-437c-9cc3-83fd361877d7" alt=""><figcaption><p>OAuth 2.0 authorization endpoint (v2) &#x26; OAuth 2.0 token endpoint (v2)</p></figcaption></figure>

5. You will also need a Client Secret. To get it, open the **Certificates & Secrets** page and click **New Client Secret**:

<figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2FbeVzfzfVeDZJ072ZOt4Y%2Fazure5.png?alt=media&#x26;token=05bb8726-c943-417b-b8fc-bebb5fd6bf2b" alt=""><figcaption><p>New Client Secret</p></figcaption></figure>

6. Copy the generated value:
7. Finally, you will need to set the redirect URL. Click on the redirect URLs:

<figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2F6bUDbfOwhPKzw6u1eYTO%2Fazure7.png?alt=media&#x26;token=3eeeb5ff-407a-4cfc-aa4d-ab8d0aa61fd7" alt=""><figcaption><p>Choose the Redirect URL</p></figcaption></figure>

8. And add the redirect url:&#x20;

<figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2FVptf4nW07ip4jriBcS8C%2Fazure8.png?alt=media&#x26;token=80c75477-8ef8-443f-ab51-1c6880b83e09" alt=""><figcaption><p>Set the Redirect URL </p></figcaption></figure>

&#x20;     `https://<tenantId>.login.aisera.cloud/?id=aisera.oauth.oauthCommand` \
\
where instead  of `<tenantId>` you will insert your company's tenant id, that you received from your Aisera team.

9. Assign the API permission.

<figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2FHtgg9vnMbXXpWnzGRmnb%2Fazure9.png?alt=media&#x26;token=ff1b41aa-7e4f-4f30-bfff-918a3cf2bca9" alt=""><figcaption><p>Assign API Permissions/Token</p></figcaption></figure>

10. Click **Add permissions** and select **Microsoft Graph** in the **API permissions** screen.

<figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2FjllgwESh6YRpysT0GgQi%2Fazure10.png?alt=media&#x26;token=5a1e78ef-b6a6-43f5-9bb7-126cb56e041f" alt=""><figcaption><p>Set API Read/Write Permissions</p></figcaption></figure>

## Create the Azure Integration: <a href="#pdf-page-qbcwdne47qzdelmkd46o-pdf-page-8nbmsc4bxmq9mzlvcnkp-id-3.-create-azure-integration" id="pdf-page-qbcwdne47qzdelmkd46o-pdf-page-8nbmsc4bxmq9mzlvcnkp-id-3.-create-azure-integration"></a>

1. In the Aisera Admin UI, navigate to **Settings > Integration > New Integration.**
2. Search for and select **Azure Active Directory.**
3. Click **Next**.

<div align="left"><figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2F4y3xgcClrKRDuEh0o60e%2Fazure11.png?alt=media&#x26;token=b66a39a6-2f8e-4f45-84ad-943956d2c025" alt="" width="360"><figcaption><p>Choose Azure Active Directory</p></figcaption></figure></div>

4. Enter the configuration details:
   1. **Name** - Enter a Name for the Integration.
   2. **Endpoint** - Enter the of your Azure AD application.
   3. **Public** - Determines whether the integration can be used outside the firewall.
   4. **Description** - Enter the description (Optional).

<div align="left"><figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2FVSx5gQJys0nkehIrqvJ4%2Fazure12.png?alt=media&#x26;token=48673f19-cc34-4b8d-aee0-207c45def3e4" alt="" width="476"><figcaption><p>Configuration Details - Step 2</p></figcaption></figure></div>

5. Enter the Authentication Details:
   1. **Authorization URL** - Value from the OAuth 2.0 authorization endpoint (v2) and append the scope parameter:\
      \
      Example:\
      Add the following command after the tenant URL, within the Administration URL field.\
      `?scope=offline_access%20Device.Read.All%20Device.Command` \
      \
      The scopes chosen in the example above are:&#x20;
      1. offline\_access (you should always add this scope)&#x20;
      2. Device.Read.All Device.Command separated with space (encoded as %20). \
         You may choose any additional permission/scope you want depending on your use case.
   2. **Client ID** - You will insert the value you copied on step 1a).
   3. **Client Secret**- Insert the value from step 2.
   4. **Access Token URL** - Add the OAuth 2.0 token endpoint (v2) that you created previously.

<figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2FEQYF7rpp8AVsN9shw0wr%2Fazure13.png?alt=media&#x26;token=31e8f8aa-5fbf-4b5f-9d22-5ab195e808e4" alt=""><figcaption><p>Integration Configuration Step 3</p></figcaption></figure>

6. Click **OK** and you will be prompted to authorize:

<figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2FCKxnqit8LmLifqxKSEf4%2Fazure14.png?alt=media&#x26;token=708e09ff-1ccc-4f7e-aec9-2c36ca6d8a68" alt=""><figcaption></figcaption></figure>

Have the Aisera Service User who is authorized to log into the customer's data source to finalize the authorization procedure.

<figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2FurkMg7NvHyFBXphqTYTb%2Fazure15.png?alt=media&#x26;token=3277f3dc-ae53-4607-ba5c-d29179807d6d" alt=""><figcaption></figcaption></figure>

## Use Query Scripts in Azure AD Data Source Configuration <a href="#pdf-page-qbcwdne47qzdelmkd46o-pdf-page-8nbmsc4bxmq9mzlvcnkp-id-4.-user-privileges-required-or-oauth" id="pdf-page-qbcwdne47qzdelmkd46o-pdf-page-8nbmsc4bxmq9mzlvcnkp-id-4.-user-privileges-required-or-oauth"></a>

The Azure AD Connector supports arbitrary query parameters, specifically the select and expand parameters, for API calls within the Custom Query field of the  Data Source Configuration window in the Aisera Admin UI.

<figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2Fl3o7sqOLoq2vhCczh42O%2Funknown.png?alt=media&#x26;token=c4e310b6-4de3-4191-b838-7634aa933f5a" alt=""><figcaption></figcaption></figure>

This allows you to define arbitrary query parameters for each content type (such as User or UserProfile) separately.

```
{
  "User": {
    "$select": "id, name, country",
    "$expand": "transitiveMemberOf"
  },
  "UserProfile": {
    "$select": "id, name, country",
    "$expand": "transitiveMemberOf"
  }
}
```

Arbitrary query parameters are values that are not explicitly defined or expected in the API's specification. These parameters provide you with greater flexibility and control over the data retrieved from Azure AD.&#x20;

You can specify your own values for both $expand and $select, to enable more tailored and efficient data synchronization.

## User Privileges required or Oauth Authorization <a href="#pdf-page-qbcwdne47qzdelmkd46o-pdf-page-8nbmsc4bxmq9mzlvcnkp-id-4.-user-privileges-required-or-oauth" id="pdf-page-qbcwdne47qzdelmkd46o-pdf-page-8nbmsc4bxmq9mzlvcnkp-id-4.-user-privileges-required-or-oauth"></a>

For delegated scenarios where an admin is acting on another user, the admin needs one of the following Azure AD roles:

* Global Administrator
* Privileged Authentication Administrator
* Authentication Administrator
