Microsoft AD Spoke - Update Object/Group Action

Phil Wright
Tera Contributor

I want to update an Active Directory object in Flow Designer but, there is no such action in the Microsoft AD spoke.  Specifically, I want to update the description and manager of a group object.  There are actions to create group, delete group and lookup group, but no update action.  Has anyone developed an action to accomplish this deed?

6 REPLIES 6

NBeheydt
Tera Expert

I had a similar requirement to update a group attribute.  I had to create a custom action that ran a Powershell script to update the object.

Hi NBeheydt,

 

Assuming your powershell script solution is working, any chance you could share the steps you took to achieve this and the script used? 

 

Thanks

Andy

Our requirement was to update the AD object GID.  Here is the Powershell script.  You can probably ignore the code regarding the RID as that was a specific requirement based on how we set this value.

 

# Retrieve the group object from Active Directory
$Group = Get-ADGroup -Filter {samAccountName -eq $GroupName} -Properties objectSid -Credential $cred -Server $computer

if ($Group) {
# Extract the RID from the objectSid property

$RID = $Group.objectSid.Value.Substring($Group.objectSid.Value.LastIndexOf("-") + 1)
Write-Host "$GroupName;$($Group.SID);$RID"
$GIDNUM = 1000000000 + $RID
# Write-Host "Set-ADGroup $GroupName -Replace @{ gidNumber=$GIDNUM}"
Set-ADGroup $GroupName -Replace @{gidNumber=$GIDNUM}
} else {
Write-Host "Group not found: $GroupName $Group"
}

 

Then created a custom flow Action that runs the script and outputs (true/false) whether the script ran successfully to update the object.

newmanan
Tera Contributor

Hi,

script looks good thank you - I need a little help to confirm what the custom flow action looks like - would you mind sharing that too please?

 

Thanks