Skip to content

Connecting to the REST API

This guide explains how to configure Microsoft Entra ID and test connectivity to the REST API using PowerShell.


1. Create a New App Registration in Entra ID

Section titled “1. Create a New App Registration in Entra ID”
  1. Sign in to Microsoft Entra ID.
  2. Navigate to App registrations.
  3. Select + New registration.
  4. Enter a name for the application.
  5. Under Supported account types, select the following or see step 6:

Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant)

  1. (Optional) You might have access to a (Preview) option to allow the app to only be used with your Glue instance, to do so you will need Tikabu to supply you with a tenant id. This may be listed as “Allow only certain tenants (Preview)” under the “Multiple Entra ID tenants”. See screenshot below.

  2. Click Register.

⚠️ Important:
You must create a New App Registrationnot a new Enterprise Application.


After the app is created, record the following values:

  • Azure Tenant ID
  • Client ID (Application ID) Note - This needs to be supplied to the Tikabu team to authorise the access.
  • Client Secret

To create a Client Secret:

  1. Go to Certificates & secrets
  2. Click + New client secret
  3. Copy and securely store the generated secret value

You will use these values in the PowerShell script below.


Replace the placeholder values in the configuration section before running the script.

Terminal window
# ============================================
# Configuration
# ============================================
$customerTenantId = "your tenant id here"
$customerClientId = "your client id here"
$customerClientSecret = "your client secret here"
$glueURL="your glue url"
# ============================================
# Request OAuth Token
# ============================================
# Token endpoint
$tokenUrl = "https://login.microsoftonline.com/$customerTenantId/oauth2/v2.0/token"
# Request body
$body = @{
client_id = $customerClientId
client_secret = $customerClientSecret
scope = "https://$glueURL/.default" # Replace YourGlueURL
grant_type = "client_credentials"
}
# Get the token
$response = Invoke-RestMethod `
-Method Post `
-Uri $tokenUrl `
-Body $body `
-ContentType "application/x-www-form-urlencoded"
# Display the access token
Write-Host "Access Token:" -ForegroundColor Green
Write-Host $response.access_token
# Store token for reuse
$accessToken = $response.access_token
# ============================================
# Example API Call
# ============================================
$headers = @{
Authorization = "Bearer $accessToken"
}
# Replace YourGlueURL and HostNameInYourEnvironment
Invoke-RestMethod `
-Uri "https://$glueURL/api/Devices/HostNameInYourEnvironment" `
-Headers $headers `
-Method Get
# To get the results of a query via the api
$queryID=111
Invoke-RestMethod `
-Uri "https://$glueURL/api/Devices/query/$queryID" `
-Headers $headers `
-Method Get

Below is an example of where to select the correct option during App Registration:

App Registration

Ensure that the option selected is:

Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant)

5. Screenshot – Supported Account Types (Preview)

Section titled “5. Screenshot – Supported Account Types (Preview)”

Below is an example of the preview feature where you can choose which Tenant ID the app is allowed to use

App Registration

Reach out to Tikabu to get the correct Tenant ID