We have a requirement to update the names of over 200 access profiles in bulk. However, the existing utility script for updating access profiles does not update the name field. I also checked for available APIs, but it seems there is no API support for renaming access profiles.
If anyone has encountered a similar issue or has any suggestions, workarounds, or relevant documentation, I’d really appreciate your input.
Thanks for the information @pavya, but can you help me with PowerShell script if you have already written? because i need to do this activity in bulk so PowerShell script will be more helpful.
Hi @swatisharmaaccent , Here is the powershell script for rename the access profiles in bulk.
In below script change the csv location , your tenant name in URL and Bearer token in place of ***.
# Path to your CSV file
$csvPath = "C:\Downloads\access_profiles.csv" # Ensure this CSV has columns: Id, Value
# Prepare headers
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", "application/json-patch+json")
$headers.Add("Accept", "application/json")
$headers.Add("Authorization", "Bearer ....") # Truncated
# Loop through each row in CSV and patch the corresponding Access Profile
Import-Csv $csvPath | ForEach-Object {
$Id = $_.Id
$newValue = $_.Value
$jsonPatch = @"
[
{
"op": "replace",
"path": "/name",
"value": "$newValue"
}
]
"@
try {
$uri = "https://{your tenant}.api.identitynow-demo.com/beta/access-profiles/$Id"
$body = [System.Text.Encoding]::UTF8.GetBytes($jsonPatch)
$response = Invoke-RestMethod -Uri $uri -Method PATCH -Headers $headers -Body $body
Write-Host " Successfully updated Access Profile $Id with name: $newValue"
} catch {
Write-Host "Failed to update Access Profile $Id"
Write-Host $_.Exception.Message
}
}
Use below as csv format and replace the ID with access profile ID and value with new name of access profiles .Name of csv file access_profiles.csv