Merged PR 53135: soc2 audit list changes

soc2 audit list changes #103958 #103959

Related work items: #103958, #103959
This commit is contained in:
Jurjen Ladenius
2024-09-11 11:36:02 +00:00
parent b92ce8b218
commit 1a9214db67
4 changed files with 68 additions and 3 deletions

View File

@@ -0,0 +1,65 @@
class PipelineInfo {
[string] $Id = ""
[string] $Name = ""
[string] $Path = ""
[string] $Type = ""
[string] $Author = ""
[string] $CreatedDate = ""
[string] $PipelineType = ""
[string] $PipelineEditUrl = ""
}
$token = "hyrvwxicogy37djvmhkwrcdexokcrpyudkk4j2n3n7gnjb5wsv5a"
$token = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($token)"))
$organization = "effectory"
$project = "Survey%20Software"
$head = @{ Authorization =" Basic $token" }
function GetPipelineType {
param (
[int] $pipeLineId
)
$url = "https://dev.azure.com/$organization/$project/_apps/hub/ms.vss-build-web.ci-designer-hub?pipelineId=$pipeLineId&__rt=fps&__ver=2"
$response = Invoke-RestMethod -Uri $url -Method GET -Headers $head
return $response.fps.dataProviders.data."ms.vss-build-web.pipeline-detail-data-provider".definitionProcessType
}
[string] $date = Get-Date -Format "yyyy-MM-dd HHmm"
$fileName = ".\$date pipelines.csv"
Write-Host "========================================================================================================================================================================"
Write-Host "Creating service connection overview."
Write-Host "========================================================================================================================================================================"
$url="https://dev.azure.com/$organization/$project/_apis/build/definitions?api-version=7.1-preview.7"
$response = Invoke-RestMethod -Uri $url -Method GET -Headers $head
[PipelineInfo[]]$Result = @()
$response.value | ForEach-Object {
$definitionProcessType = GetPipelineType -pipeLineId $_.id
[PipelineInfo] $pipelineInfo = [PipelineInfo]::new()
$pipelineInfo.Id = $_.id
$pipelineInfo.Name = $_.name
$pipelineInfo.Path = $_.path
$pipelineInfo.Type = $_.type
$pipelineInfo.Author = $_.authoredby.DisplayName
$pipelineInfo.CreatedDate = $_.createdDate
$pipelineInfo.PipelineType = $definitionProcessType -eq 1 ? "Classic" : "Yaml"
$pipelineInfo.PipelineEditUrl = $definitionProcessType -eq 1 ?
"https://dev.azure.com/$organization/$project/_apps/hub/ms.vss-ciworkflow.build-ci-hub?_a=edit-build-definition&id=$($_.id)" :
"https://dev.azure.com/$organization/$project/_apps/hub/ms.vss-build-web.ci-designer-hub?pipelineId=$($_.id)&branch=master"
$Result += $pipelineInfo
}
$Result | Export-Csv -Path $fileName -Append -NoTypeInformation
Write-Host "========================================================================================================================================================================"
Write-Host "Done."