We've updated our file storage system, so some links may no longer work. If you need a file, just email us at support@secomea.com—we’re happy to help!

Set a user role with SCIM

Prev Next

Set a user role with SCIM

For setting a different role than the default, please follow the following steps, using Domain Admin as example:

  1. Ensure the user exists in your Entra ID tenant as per the default process
  2. Click Cloud Shell in the Azure Portal, see screenshot below, then wait for initialization

Image

  1. Add and adapt the script below to the Azure Cloud Shell
Connect-MgGraph -Scopes "User.ReadWrite.All"

# Single user
Update-MgUser -UserId "amundsen@acme.com" -OnPremisesExtensionAttributes @{
ExtensionAttribute1 = "Domain_Administrator" 	# role
}

Where amundsen@acme.com is the UserId of the identity to be assigned the role. Use Basic_Administrator when this is the needed role.

  1. Execute the script.
  2. Run Disconnect-MgGraph to close Azure Cloud Shell
  3. Verify that the user has gotten the role assigned. This can be done via Provision on Demand in Entra, or in Secomea’s system once the user has been provisioned.

For On-Premises synced users, please follow the below approach

Run the following on your Active Directory server or any machine with RSAT AD Tools installed.

Set a Single User

# Import AD module
Import-Module ActiveDirectory

# Set extension attributes
Set-ADUser -Identity "username" -Replace @{
    extensionAttribute1 = "Domain_Administrator"
}

# Verify
Get-ADUser -Identity "username" -Properties extensionAttribute1 |
    Select-Object Name, extensionAttribute1

Set Multiple Users at Once

Import-Module ActiveDirectory
# Define users and their attribute values
$Users = @(
    @{ Username = "user1"; Role = "Domain_Administrator" },
    @{ Username = "user2"; Role = "Basic_Administrator" },
    @{ Username = "user3"; Role = "Basic_Administrator"}
)

foreach ($user in $Users) {
    try {
        Set-ADUser -Identity $user.Username -Replace @{
            extensionAttribute1 = $user.Role
        }
        Write-Host "SUCCESS: $($user.Username) | Role=$($user.Role)" -ForegroundColor Green
    }
    catch {
        Write-Host "FAILED: $($user.Username) | Error: $($_.Exception.Message)" -ForegroundColor Red
    }
}

Force Azure AD Connect Sync

After setting attributes in AD, trigger a sync to push changes to Entra ID.

Run on the Azure AD Connect Server

# Delta sync (syncs only changes — recommended)
Start-ADSyncSyncCycle -PolicyType Delta

# Full sync (syncs everything — use only if delta doesn't work)
Start-ADSyncSyncCycle -PolicyType Initial

Check Sync Status

Get-ADSyncScheduler

Typical sync cycle is 30 minutes. A forced delta sync takes 1-2 minutes.

Verify Sync in Entra ID

After the sync completes, verify the attributes are visible in Entra ID.

Connect-MgGraph -Scopes "User.Read.All"
Invoke-MgGraphRequest -Method GET -Uri "https://graph.microsoft.com/v1.0/users/user@domain.com?`$select=displayName,onPremisesExtensionAttributes"

Expected output:

{
  "displayName": "John Doe",
  "onPremisesExtensionAttributes": {
    "extensionAttribute1": "Domain_Administrator"
  }
}

Final Step - Verify that the user has gotten the role assigned

This can be done via Provision on Demand in Entra, or in Secomea’s system once the user has been provisioned.