$users = Invoke-RestMethod -Uri "$baseUrl/users" -Headers $headers -Method Get $users | Format-Table id, email, active, role 3. Create a New User in Tenfold $newUser = @ email = "john.doe@example.com" firstName= "John" lastName = "Doe" role = "Analyst" active = $true | ConvertTo-Json Invoke-RestMethod -Uri "$baseUrl/users" -Headers $headers -Method Post -Body $newUser 4. Assign Role from CSV (Bulk Update) $csv = Import-Csv "C:\temp\tenfold_role_updates.csv" foreach ($row in $csv) ConvertTo-Json Invoke-RestMethod -Uri "$baseUrl/users/$($row.UserId)/role" -Headers $headers -Method Patch -Body $body Write-Host "Updated $($row.UserId) to $($row.NewRole)"
Here’s a post you can use for internal documentation, a blog, or a Slack/Teams update. Title: Automating Tenfold User & Role Management with PowerShell Summary Tenfold helps sync identity data across systems. Using PowerShell, you can automate user provisioning, role assignments, and audit log pulls instead of relying solely on the UI. Key PowerShell Use Cases for Tenfold 1. Connect to Tenfold API (Basic Auth Example) $baseUrl = "https://your-tenant.tenfold.com/api/v1" $apiKey = "your_api_key_here" $headers = @ "Authorization" = "Bearer $apiKey" "Content-Type" = "application/json"
$since = (Get-Date).AddDays(-1).ToString("yyyy-MM-ddTHH:mm:ssZ") $logs = Invoke-RestMethod -Uri "$baseUrl/audit?since=$since" -Headers $headers -Method Get $logs | Export-Csv "tenfold_audit_$((Get-Date -Format yyyyMMdd)).csv" -NoTypeInformation Pro Tip Store your Tenfold API key in Windows Credential Manager or Azure Key Vault instead of hardcoding it in scripts.
