Functions/Set-IADataDefinition.ps1

Function Set-IADataDefinition {
    <#
        .SYNOPSIS
            This is used to change a DataDefinition.
        .DESCRIPTION
            This function is used to change the properties of a DataDefinition.
        .EXAMPLE
            $IADataDefinition = Get-IADataDefinition -All | Where-Object -Property Id -eq '2c7a365f-92f5-4a35-52be-08d7929dd5a6'
 
            $IADataDefinition.ConfigurationId = 'a378ea1a-a653-4766-8a6c-2f37a3ae9c5a'
 
            Set-IADataDefinition -IADataDefinition $IADataDefinition
    #>

    Param(
        # OData filter query
        [Parameter(Mandatory = $true)]
        [PSObject] $IADataDefinition
    )
    $Uri = "DataDefinitions($($IADataDefinition.Id))"
    
    $Body = $IADataDefinition | ConvertTo-Json

    Write-Verbose "Body: $Body"

    $response = Invoke-IAQuery -QueryUrl $Uri -Method Patch -Body $Body
    if ($null -eq $response.value) {
        return $null
    }

    return $response.value
}