Public/Asset.ps1

function Get-MgWindowsUpdateAssetBeta {
    <#
    .SYNOPSIS
    Gets Windows update assets from the beta API.
    .DESCRIPTION
    Gets Windows update assets from the beta API. This command uses the Microsoft Graph beta endpoint; beta behavior and schemas can change without notice. Requires WindowsUpdates.Read.All or WindowsUpdates.ReadWrite.All in the active Microsoft Graph context.
    .PARAMETER All
    Follows Microsoft Graph pagination links until all result pages are returned.
    .PARAMETER AssetId
    Specifies the Microsoft Graph identifier of the asset.
    .PARAMETER AssetType
    Limits results to the selected asset type.
    .PARAMETER Count
    Requests the OData count annotation.
    .PARAMETER Expand
    Specifies related resources to include through OData $expand.
    .PARAMETER Filter
    Specifies an OData $filter expression.
    .PARAMETER OrderBy
    Specifies an OData $orderby expression.
    .PARAMETER Query
    Specifies additional OData query parameters as key-value pairs.
    .PARAMETER Select
    Specifies properties to include through OData $select.
    .PARAMETER Skip
    Specifies the number of items to skip.
    .PARAMETER Top
    Specifies the maximum number of items requested from Microsoft Graph.
    .EXAMPLE
    PS> Get-MgWindowsUpdateAssetBeta `
        -Select id `
        -All
 
    Gets Windows update assets from the beta API. The example requests useful identity fields and follows all pages when the endpoint supports pagination.
    #>

    [CmdletBinding()]
    param(
        [string] $AssetId,

        [ValidateSet('All', 'AzureADDevice', 'UpdatableAssetGroup')]
        [string] $AssetType = 'All',

        [string] $Filter,
        [string[]] $Select,
        [string[]] $Expand,
        [string[]] $OrderBy,
        [ValidateRange(1, 999)]
        [int] $Top,
        [ValidateRange(0, [int]::MaxValue)]
        [int] $Skip,
        [switch] $Count,
        [switch] $All,
        [hashtable] $Query
    )

    $path = if ($AssetId) {
        "updatableAssets/$AssetId"
    }
    elseif ($AssetType -eq 'AzureADDevice') {
        'updatableAssets/microsoft.graph.windowsUpdates.azureADDevice'
    }
    elseif ($AssetType -eq 'UpdatableAssetGroup') {
        'updatableAssets/microsoft.graph.windowsUpdates.updatableAssetGroup'
    }
    else {
        'updatableAssets'
    }
    $odata = Get-MgWindowsUpdatesQuery -BoundParameters $PSBoundParameters
    Invoke-MgWindowsUpdatesRequest -Method GET -Path $path -Query $odata -All:$All
}

function Get-MgWindowsUpdateAzureAdDeviceBeta {
    <#
    .SYNOPSIS
    Gets Microsoft Entra device assets from the beta API.
    .DESCRIPTION
    Gets Microsoft Entra device assets from the beta API. This command uses the Microsoft Graph beta endpoint; beta behavior and schemas can change without notice. Requires WindowsUpdates.Read.All or WindowsUpdates.ReadWrite.All in the active Microsoft Graph context.
    .PARAMETER All
    Follows Microsoft Graph pagination links until all result pages are returned.
    .PARAMETER AzureAdDeviceId
    Specifies the Microsoft Graph identifier of the azure ad device.
    .PARAMETER Count
    Requests the OData count annotation.
    .PARAMETER Expand
    Specifies related resources to include through OData $expand.
    .PARAMETER Filter
    Specifies an OData $filter expression.
    .PARAMETER OrderBy
    Specifies an OData $orderby expression.
    .PARAMETER Query
    Specifies additional OData query parameters as key-value pairs.
    .PARAMETER Select
    Specifies properties to include through OData $select.
    .PARAMETER Skip
    Specifies the number of items to skip.
    .PARAMETER Top
    Specifies the maximum number of items requested from Microsoft Graph.
    .EXAMPLE
    PS> Get-MgWindowsUpdateAzureAdDeviceBeta `
        -Select id `
        -All
 
    Gets Microsoft Entra device assets from the beta API. The example requests useful identity fields and follows all pages when the endpoint supports pagination.
    #>

    [CmdletBinding()]
    param(
        [string] $AzureAdDeviceId,
        [string] $Filter,
        [string[]] $Select,
        [string[]] $Expand,
        [string[]] $OrderBy,
        [ValidateRange(1, 999)]
        [int] $Top,
        [ValidateRange(0, [int]::MaxValue)]
        [int] $Skip,
        [switch] $Count,
        [switch] $All,
        [hashtable] $Query
    )

    $parameters = @{}
    foreach ($key in $PSBoundParameters.Keys) {
        $parameters[$key] = $PSBoundParameters[$key]
    }
    $parameters.Remove('AzureAdDeviceId')
    $parameters.AssetType = 'AzureADDevice'
    if ($AzureAdDeviceId) {
        $parameters.AssetId = $AzureAdDeviceId
    }
    Get-MgWindowsUpdateAssetBeta @parameters
}

function Get-MgWindowsUpdateAssetGroupBeta {
    <#
    .SYNOPSIS
    Gets updatable asset groups from the beta API.
    .DESCRIPTION
    Gets updatable asset groups from the beta API. This command uses the Microsoft Graph beta endpoint; beta behavior and schemas can change without notice. Requires WindowsUpdates.Read.All or WindowsUpdates.ReadWrite.All in the active Microsoft Graph context.
    .PARAMETER All
    Follows Microsoft Graph pagination links until all result pages are returned.
    .PARAMETER AssetGroupId
    Specifies the Microsoft Graph identifier of the asset group.
    .PARAMETER Count
    Requests the OData count annotation.
    .PARAMETER Expand
    Specifies related resources to include through OData $expand.
    .PARAMETER Filter
    Specifies an OData $filter expression.
    .PARAMETER OrderBy
    Specifies an OData $orderby expression.
    .PARAMETER Query
    Specifies additional OData query parameters as key-value pairs.
    .PARAMETER Select
    Specifies properties to include through OData $select.
    .PARAMETER Skip
    Specifies the number of items to skip.
    .PARAMETER Top
    Specifies the maximum number of items requested from Microsoft Graph.
    .EXAMPLE
    PS> Get-MgWindowsUpdateAssetGroupBeta `
        -Select id `
        -All
 
    Gets updatable asset groups from the beta API. The example requests useful identity fields and follows all pages when the endpoint supports pagination.
    #>

    [CmdletBinding()]
    param(
        [string] $AssetGroupId,
        [string] $Filter,
        [string[]] $Select,
        [string[]] $Expand,
        [string[]] $OrderBy,
        [ValidateRange(1, 999)]
        [int] $Top,
        [ValidateRange(0, [int]::MaxValue)]
        [int] $Skip,
        [switch] $Count,
        [switch] $All,
        [hashtable] $Query
    )

    $parameters = @{}
    foreach ($key in $PSBoundParameters.Keys) {
        $parameters[$key] = $PSBoundParameters[$key]
    }
    $parameters.Remove('AssetGroupId')
    $parameters.AssetType = 'UpdatableAssetGroup'
    if ($AssetGroupId) {
        $parameters.AssetId = $AssetGroupId
    }
    Get-MgWindowsUpdateAssetBeta @parameters
}

function New-MgWindowsUpdateAssetGroupBeta {
    <#
    .SYNOPSIS
    Creates an updatable asset group using the beta API.
    .DESCRIPTION
    Creates an updatable asset group using the beta API. This command uses the Microsoft Graph beta endpoint; beta behavior and schemas can change without notice. Requires WindowsUpdates.ReadWrite.All in the active Microsoft Graph context.
    .PARAMETER Body
    Specifies the Microsoft Graph request body.
    .EXAMPLE
    PS> $body = @{
        '@odata.type' = '#microsoft.graph.windowsUpdates.updatableAssetGroup'
    }
    New-MgWindowsUpdateAssetGroupBeta `
        -Body $body `
        -WhatIf
 
    Adapts the documented Microsoft Graph updatableAssetGroup creation example.
    Remove -WhatIf to create the group.
    #>

    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter(Mandatory)]
        [ValidateNotNull()]
        [hashtable] $Body
    )

    $requestBody = @{} + $Body
    if (-not $requestBody.ContainsKey('@odata.type')) {
        $requestBody['@odata.type'] = '#microsoft.graph.windowsUpdates.updatableAssetGroup'
    }
    if ($PSCmdlet.ShouldProcess('Windows updates assets', 'Create beta asset group')) {
        Invoke-MgWindowsUpdatesRequest `
            -Method POST `
            -Path 'updatableAssets' `
            -Body $requestBody
    }
}

function Remove-MgWindowsUpdateAzureAdDeviceBeta {
    <#
    .SYNOPSIS
    Deletes a Microsoft Entra device asset using the beta API.
    .DESCRIPTION
    Deletes a Microsoft Entra device asset using the beta API. This command uses the Microsoft Graph beta endpoint; beta behavior and schemas can change without notice. Requires WindowsUpdates.ReadWrite.All in the active Microsoft Graph context.
    .PARAMETER AzureAdDeviceId
    Specifies the Microsoft Graph identifier of the azure ad device.
    .EXAMPLE
    PS> $azureAdDeviceId = '<azure-ad-device-id>'
    Remove-MgWindowsUpdateAzureAdDeviceBeta `
        -AzureAdDeviceId $azureAdDeviceId `
        -WhatIf
    Deletes a Microsoft Entra device asset using the beta API. The example uses -WhatIf so the target and payload can be reviewed before making the change.
    #>

    [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')]
    param(
        [Parameter(Mandatory)]
        [string] $AzureAdDeviceId
    )

    if ($PSCmdlet.ShouldProcess($AzureAdDeviceId, 'Delete beta Microsoft Entra device asset')) {
        Remove-MgWindowsUpdateAssetBeta -AssetId $AzureAdDeviceId -Confirm:$false
    }
}

function Remove-MgWindowsUpdateAssetGroupBeta {
    <#
    .SYNOPSIS
    Deletes an updatable asset group using the beta API.
    .DESCRIPTION
    Deletes an updatable asset group using the beta API. This command uses the Microsoft Graph beta endpoint; beta behavior and schemas can change without notice. Requires WindowsUpdates.ReadWrite.All in the active Microsoft Graph context.
    .PARAMETER AssetGroupId
    Specifies the Microsoft Graph identifier of the asset group.
    .EXAMPLE
    PS> $assetGroupId = '<asset-group-id>'
    Remove-MgWindowsUpdateAssetGroupBeta `
        -AssetGroupId $assetGroupId `
        -WhatIf
    Deletes an updatable asset group using the beta API. The example uses -WhatIf so the target and payload can be reviewed before making the change.
    #>

    [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')]
    param(
        [Parameter(Mandatory)]
        [string] $AssetGroupId
    )

    if ($PSCmdlet.ShouldProcess($AssetGroupId, 'Delete beta updatable asset group')) {
        Remove-MgWindowsUpdateAssetBeta -AssetId $AssetGroupId -Confirm:$false
    }
}

function Remove-MgWindowsUpdateAssetBeta {
    <#
    .SYNOPSIS
    Deletes an updatable asset using the beta API.
    .DESCRIPTION
    Deletes an updatable asset using the beta API. This command uses the Microsoft Graph beta endpoint; beta behavior and schemas can change without notice. Requires WindowsUpdates.ReadWrite.All in the active Microsoft Graph context.
    .PARAMETER AssetId
    Specifies the Microsoft Graph identifier of the asset.
    .EXAMPLE
    PS> $assetId = '<asset-id>'
    Remove-MgWindowsUpdateAssetBeta `
        -AssetId $assetId `
        -WhatIf
    Deletes an updatable asset using the beta API. The example uses -WhatIf so the target and payload can be reviewed before making the change.
    #>

    [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')]
    param(
        [Parameter(Mandatory)]
        [string] $AssetId
    )

    if ($PSCmdlet.ShouldProcess($AssetId, 'Delete beta updatable asset')) {
        Invoke-MgWindowsUpdatesRequest -Method DELETE -Path "updatableAssets/$AssetId"
    }
}

function Register-MgWindowsUpdateAssetBeta {
    <#
    .SYNOPSIS
    Enrolls typed assets in Windows Autopatch update management using the beta API.
    .DESCRIPTION
    Enrolls typed assets in Windows Autopatch update management using the beta API. This command uses the Microsoft Graph beta endpoint; beta behavior and schemas can change without notice. Requires WindowsUpdates.ReadWrite.All in the active Microsoft Graph context.
    .PARAMETER Asset
    Specifies typed asset objects for the operation.
    .PARAMETER UpdateCategory
    Specifies the Windows update category.
    .EXAMPLE
    PS> $assets = @(
        @{
            '@odata.type' = '#microsoft.graph.windowsUpdates.azureADDevice'
            id = '00000000-0000-0000-0000-000000000001'
        }
    )
    Register-MgWindowsUpdateAssetBeta `
        -Asset $assets `
        -UpdateCategory quality `
        -WhatIf
    Enrolls typed assets in Windows Autopatch update management using the beta API. The example uses -WhatIf so the target and payload can be reviewed before making the change.
    #>

    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter(Mandatory)]
        [ValidateSet('driver', 'feature', 'quality')]
        [string] $UpdateCategory,

        [Parameter(Mandatory)]
        [ValidateNotNullOrEmpty()]
        [hashtable[]] $Asset
    )

    $body = @{
        updateCategory = $UpdateCategory
        assets = $Asset
    }
    if ($PSCmdlet.ShouldProcess(($Asset.id -join ', '), "Enroll $UpdateCategory assets")) {
        Invoke-MgWindowsUpdatesRequest -Method POST `
            -Path 'updatableAssets/enrollAssets' `
            -Body $body
    }
}

function Register-MgWindowsUpdateAssetByIdBeta {
    <#
    .SYNOPSIS
    Enrolls Microsoft Entra device IDs in Windows Autopatch using the beta API.
    .DESCRIPTION
    Enrolls Microsoft Entra device IDs in Windows Autopatch using the beta API. This command uses the Microsoft Graph beta endpoint; beta behavior and schemas can change without notice. Requires WindowsUpdates.ReadWrite.All in the active Microsoft Graph context.
    .PARAMETER Id
    Specifies the Microsoft Graph identifier of the .
    .PARAMETER UpdateCategory
    Specifies the Windows update category.
    .EXAMPLE
    PS> $deviceIds = @('00000000-0000-0000-0000-000000000001')
    Register-MgWindowsUpdateAssetByIdBeta `
        -UpdateCategory quality `
        -Id $deviceIds `
        -WhatIf
 
    Previews enrolling a Microsoft Entra device for quality-update management. Remove -WhatIf after validating the device identifiers.
    #>

    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter(Mandatory)]
        [ValidateSet('driver', 'feature', 'quality')]
        [string] $UpdateCategory,

        [Parameter(Mandatory)]
        [ValidateNotNullOrEmpty()]
        [string[]] $Id
    )

    $body = @{
        updateCategory = $UpdateCategory
        memberEntityType = '#microsoft.graph.windowsUpdates.azureADDevice'
        ids = $Id
    }
    if ($PSCmdlet.ShouldProcess(($Id -join ', '), "Enroll $UpdateCategory device IDs")) {
        Invoke-MgWindowsUpdatesRequest -Method POST `
            -Path 'updatableAssets/enrollAssetsById' `
            -Body $body
    }
}

function Unregister-MgWindowsUpdateAssetBeta {
    <#
    .SYNOPSIS
    Unenrolls typed assets from Windows Autopatch update management using the beta API.
    .DESCRIPTION
    Unenrolls typed assets from Windows Autopatch update management using the beta API. This command uses the Microsoft Graph beta endpoint; beta behavior and schemas can change without notice. Requires WindowsUpdates.ReadWrite.All in the active Microsoft Graph context.
    .PARAMETER Asset
    Specifies typed asset objects for the operation.
    .PARAMETER UpdateCategory
    Specifies the Windows update category.
    .EXAMPLE
    PS> $assets = @(
        @{
            '@odata.type' = '#microsoft.graph.windowsUpdates.azureADDevice'
            id = '00000000-0000-0000-0000-000000000001'
        }
    )
    Unregister-MgWindowsUpdateAssetBeta `
        -Asset $assets `
        -UpdateCategory quality `
        -WhatIf
    Unenrolls typed assets from Windows Autopatch update management using the beta API. The example uses -WhatIf so the target and payload can be reviewed before making the change.
    #>

    [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')]
    param(
        [Parameter(Mandatory)]
        [ValidateSet('driver', 'feature', 'quality')]
        [string] $UpdateCategory,

        [Parameter(Mandatory)]
        [ValidateNotNullOrEmpty()]
        [hashtable[]] $Asset
    )

    $body = @{
        updateCategory = $UpdateCategory
        assets = $Asset
    }
    if ($PSCmdlet.ShouldProcess(($Asset.id -join ', '), "Unenroll $UpdateCategory assets")) {
        Invoke-MgWindowsUpdatesRequest -Method POST `
            -Path 'updatableAssets/unenrollAssets' `
            -Body $body
    }
}

function Unregister-MgWindowsUpdateAssetByIdBeta {
    <#
    .SYNOPSIS
    Unenrolls Microsoft Entra device IDs from Windows Autopatch using the beta API.
    .DESCRIPTION
    Unenrolls Microsoft Entra device IDs from Windows Autopatch using the beta API. This command uses the Microsoft Graph beta endpoint; beta behavior and schemas can change without notice. Requires WindowsUpdates.ReadWrite.All in the active Microsoft Graph context.
    .PARAMETER Id
    Specifies the Microsoft Graph identifier of the .
    .PARAMETER UpdateCategory
    Specifies the Windows update category.
    .EXAMPLE
    PS> $deviceIds = @('00000000-0000-0000-0000-000000000001')
    Unregister-MgWindowsUpdateAssetByIdBeta `
        -UpdateCategory quality `
        -Id $deviceIds `
        -WhatIf
 
    Previews removing a Microsoft Entra device from quality-update management. Remove -WhatIf after validating the device identifiers.
    #>

    [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')]
    param(
        [Parameter(Mandatory)]
        [ValidateSet('driver', 'feature', 'quality')]
        [string] $UpdateCategory,

        [Parameter(Mandatory)]
        [ValidateNotNullOrEmpty()]
        [string[]] $Id
    )

    $body = @{
        updateCategory = $UpdateCategory
        memberEntityType = '#microsoft.graph.windowsUpdates.azureADDevice'
        ids = $Id
    }
    if ($PSCmdlet.ShouldProcess(($Id -join ', '), "Unenroll $UpdateCategory device IDs")) {
        Invoke-MgWindowsUpdatesRequest -Method POST `
            -Path 'updatableAssets/unenrollAssetsById' `
            -Body $body
    }
}

function Get-MgWindowsUpdateAssetGroupMemberBeta {
    <#
    .SYNOPSIS
    Gets members of an updatable asset group using the beta API.
    .DESCRIPTION
    Gets members of an updatable asset group using the beta API. This command uses the Microsoft Graph beta endpoint; beta behavior and schemas can change without notice. Requires WindowsUpdates.Read.All or WindowsUpdates.ReadWrite.All in the active Microsoft Graph context.
    .PARAMETER All
    Follows Microsoft Graph pagination links until all result pages are returned.
    .PARAMETER AssetGroupId
    Specifies the Microsoft Graph identifier of the asset group.
    .PARAMETER Query
    Specifies additional OData query parameters as key-value pairs.
    .EXAMPLE
    PS> $assetGroupId = '<asset-group-id>'
    Get-MgWindowsUpdateAssetGroupMemberBeta `
        -AssetGroupId $assetGroupId `
        -All
 
    Gets members of an updatable asset group using the beta API. The example requests useful identity fields and follows all pages when the endpoint supports pagination.
    #>

    [CmdletBinding()]
    param(
        [Parameter(Mandatory)]
        [string] $AssetGroupId,

        [switch] $All,

        [hashtable] $Query
    )

    $odata = Get-MgWindowsUpdatesQuery -BoundParameters $PSBoundParameters
    $path = "updatableAssets/$AssetGroupId/" +
        'microsoft.graph.windowsUpdates.updatableAssetGroup/members'
    Invoke-MgWindowsUpdatesRequest -Method GET -Path $path -Query $odata -All:$All
}

function Add-MgWindowsUpdateAssetGroupMemberBeta {
    <#
    .SYNOPSIS
    Adds typed assets to an updatable asset group using the beta API.
    .DESCRIPTION
    Adds typed assets to an updatable asset group using the beta API. This command uses the Microsoft Graph beta endpoint; beta behavior and schemas can change without notice. Requires WindowsUpdates.ReadWrite.All in the active Microsoft Graph context.
    .PARAMETER Asset
    Specifies typed asset objects for the operation.
    .PARAMETER AssetGroupId
    Specifies the Microsoft Graph identifier of the asset group.
    .EXAMPLE
    PS> $assets = @(
        @{
            '@odata.type' = '#microsoft.graph.windowsUpdates.azureADDevice'
            id = '00000000-0000-0000-0000-000000000001'
        }
    )
    $assetGroupId = '<asset-group-id>'
    Add-MgWindowsUpdateAssetGroupMemberBeta `
        -Asset $assets `
        -AssetGroupId $assetGroupId `
        -WhatIf
 
    Adds typed assets to an updatable asset group using the beta API. The example uses -WhatIf so the target and payload can be reviewed before making the change.
    #>

    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter(Mandatory)]
        [string] $AssetGroupId,

        [Parameter(Mandatory)]
        [ValidateNotNullOrEmpty()]
        [hashtable[]] $Asset
    )

    if ($PSCmdlet.ShouldProcess($AssetGroupId, 'Add beta asset group members')) {
        Invoke-MgWindowsUpdatesRequest -Method POST `
            -Path "updatableAssets/$AssetGroupId/addMembers" `
            -Body @{ assets = $Asset }
    }
}

function Add-MgWindowsUpdateAssetGroupMemberByIdBeta {
    <#
    .SYNOPSIS
    Adds Microsoft Entra device IDs to an updatable asset group using the beta API.
    .DESCRIPTION
    Adds Microsoft Entra device IDs to an updatable asset group using the beta API. This command uses the Microsoft Graph beta endpoint; beta behavior and schemas can change without notice. Requires WindowsUpdates.ReadWrite.All in the active Microsoft Graph context.
    .PARAMETER AssetGroupId
    Specifies the Microsoft Graph identifier of the asset group.
    .PARAMETER Id
    Specifies the Microsoft Graph identifier of the .
    .EXAMPLE
    PS> $assetGroupId = '<asset-group-id>'
    $id = @('00000000-0000-0000-0000-000000000001')
    Add-MgWindowsUpdateAssetGroupMemberByIdBeta `
        -AssetGroupId $assetGroupId `
        -Id $id `
        -WhatIf
 
    Adds Microsoft Entra device IDs to an updatable asset group using the beta API. The example uses -WhatIf so the target and payload can be reviewed before making the change.
    #>

    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter(Mandatory)]
        [string] $AssetGroupId,

        [Parameter(Mandatory)]
        [ValidateNotNullOrEmpty()]
        [string[]] $Id
    )

    $body = @{
        ids = $Id
        memberEntityType = '#microsoft.graph.windowsUpdates.azureADDevice'
    }
    if ($PSCmdlet.ShouldProcess($AssetGroupId, 'Add beta asset group members by ID')) {
        Invoke-MgWindowsUpdatesRequest -Method POST `
            -Path "updatableAssets/$AssetGroupId/addMembersById" `
            -Body $body
    }
}

function Remove-MgWindowsUpdateAssetGroupMemberBeta {
    <#
    .SYNOPSIS
    Removes typed assets from an updatable asset group using the beta API.
    .DESCRIPTION
    Removes typed assets from an updatable asset group using the beta API. This command uses the Microsoft Graph beta endpoint; beta behavior and schemas can change without notice. Requires WindowsUpdates.ReadWrite.All in the active Microsoft Graph context.
    .PARAMETER Asset
    Specifies typed asset objects for the operation.
    .PARAMETER AssetGroupId
    Specifies the Microsoft Graph identifier of the asset group.
    .EXAMPLE
    PS> $assets = @(
        @{
            '@odata.type' = '#microsoft.graph.windowsUpdates.azureADDevice'
            id = '00000000-0000-0000-0000-000000000001'
        }
    )
    $assetGroupId = '<asset-group-id>'
    Remove-MgWindowsUpdateAssetGroupMemberBeta `
        -Asset $assets `
        -AssetGroupId $assetGroupId `
        -WhatIf
 
    Removes typed assets from an updatable asset group using the beta API. The example uses -WhatIf so the target and payload can be reviewed before making the change.
    #>

    [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')]
    param(
        [Parameter(Mandatory)]
        [string] $AssetGroupId,

        [Parameter(Mandatory)]
        [ValidateNotNullOrEmpty()]
        [hashtable[]] $Asset
    )

    if ($PSCmdlet.ShouldProcess($AssetGroupId, 'Remove beta asset group members')) {
        Invoke-MgWindowsUpdatesRequest -Method POST `
            -Path "updatableAssets/$AssetGroupId/removeMembers" `
            -Body @{ assets = $Asset }
    }
}

function Remove-MgWindowsUpdateAssetGroupMemberByIdBeta {
    <#
    .SYNOPSIS
    Removes Microsoft Entra device IDs from an updatable asset group using the beta API.
    .DESCRIPTION
    Removes Microsoft Entra device IDs from an updatable asset group using the beta API. This command uses the Microsoft Graph beta endpoint; beta behavior and schemas can change without notice. Requires WindowsUpdates.ReadWrite.All in the active Microsoft Graph context.
    .PARAMETER AssetGroupId
    Specifies the Microsoft Graph identifier of the asset group.
    .PARAMETER Id
    Specifies the Microsoft Graph identifier of the .
    .EXAMPLE
    PS> $assetGroupId = '<asset-group-id>'
    $id = @('00000000-0000-0000-0000-000000000001')
    Remove-MgWindowsUpdateAssetGroupMemberByIdBeta `
        -AssetGroupId $assetGroupId `
        -Id $id `
        -WhatIf
 
    Removes Microsoft Entra device IDs from an updatable asset group using the beta API. The example uses -WhatIf so the target and payload can be reviewed before making the change.
    #>

    [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')]
    param(
        [Parameter(Mandatory)]
        [string] $AssetGroupId,

        [Parameter(Mandatory)]
        [ValidateNotNullOrEmpty()]
        [string[]] $Id
    )

    $body = @{
        ids = $Id
        memberEntityType = '#microsoft.graph.windowsUpdates.azureADDevice'
    }
    if ($PSCmdlet.ShouldProcess($AssetGroupId, 'Remove beta asset group members by ID')) {
        Invoke-MgWindowsUpdatesRequest -Method POST `
            -Path "updatableAssets/$AssetGroupId/removeMembersById" `
            -Body $body
    }
}