Modules/AzureDevOpsDsc.Common/Api/Functions/Private/Api/Group/Remove-DevOpsGroup.ps1
|
<#
.SYNOPSIS Removes a group from Azure DevOps. .DESCRIPTION The Remove-DevOpsGroup function is used to remove a group from Azure DevOps using the Azure DevOps REST API. .PARAMETER ApiUri The mandatory parameter for the API URI. .PARAMETER ApiVersion The optional parameter for the API version with a default value obtained from the Get-AzDevOpsApiVersion function. .PARAMETER GroupDescriptor The optional parameter for the project scope descriptor. .OUTPUTS System.Management.Automation.PSObject .EXAMPLE Remove-DevOpsGroup -ApiUri "https://dev.azure.com/myorganization" -GroupDescriptor "MyGroup" This example removes the group with the specified group descriptor from Azure DevOps. #> Function Remove-DevOpsGroup { [CmdletBinding()] [OutputType([System.Management.Automation.PSObject])] param ( [Parameter(Mandatory = $true)] [string] $ApiUri, [Parameter()] [String] $ApiVersion, [Parameter()] [String] $GroupDescriptor ) if (-not $ApiVersion) { $ApiVersion = Get-AzDevOpsApiVersion -Default } $params = @{ Uri = '{0}/_apis/graph/groups/{1}?api-version={2}' -f $ApiUri.TrimEnd('/'), $GroupDescriptor, $ApiVersion Method = 'Delete' ContentType = 'application/json' } try { return (Invoke-AzDevOpsApiRestMethod @params) } catch { Write-Error "Failed to remove group: $_" } } |