원클릭으로
get-pipeline-logs
Get logs from the latest Azure DevOps pipeline run using patterns that actually work.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Get logs from the latest Azure DevOps pipeline run using patterns that actually work.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Automate creation of Azure DevOps workload identity federation service connections. Use this when users need to create or delete Azure service connections with workload identity federation.
Automate the import and execution of Azure DevOps pipelines from YAML files using deployment metadata. Use this when users need to import pipelines to Azure DevOps, run them, and fix any errors that occur during execution.
| name | get-pipeline-logs |
| description | Get logs from the latest Azure DevOps pipeline run using patterns that actually work. |
| license | MIT |
Get logs from Azure DevOps pipeline runs. Always work with the latest run to ensure logs are available (deleted builds have no logs).
az pipelines list)# Load configuration from deploy.json
$config = Get-Content .github/skills/deploy.json | ConvertFrom-Json
$org = ($config.ADOOrg -replace 'https://dev.azure.com/', '')
$project = $config.ADOProject
$pipelineId = 45 # Replace with your pipeline ID# Get latest run (top 1, newest first)$latestRun = az pipelines runs list ` --org "https://dev.azure.com/$org" ` --project $project ` --pipeline-ids $pipelineId ` --top 1 ` --query-order QueueTimeDesc ` --query "[0]" | ConvertFrom-Json$buildId = $latestRun.idWrite-Host "Latest run: $buildId (Status: $($latestRun.status), Result: $($latestRun.result))"
```powershell$logId = 13 # or get from logs list above$token = az account get-access-token --resource 499b84ac-1321-427f-aa17-267ca6975798 --query accessToken -o tsv$headers = @{ Authorization = "Bearer $token" }$uri = "https://dev.azure.com/$org/$project/_apis/build/builds/$buildId/logs/$logId`?api-version=7.1-preview.2"# Download to fileInvoke-RestMethod -Uri $uri -Headers $headers | Out-File "$env:TEMP\build-$buildId-log-$logId.txt"# Search for errorsGet-Content "$env:TEMP\build-$buildId-log-$logId.txt" | Select-String -Pattern "error|Error|##[error]|failed|Failed" -Context 3
### 4) Download all logs as ZIP
```powershell$token = az account get-access-token --resource 499b84ac-1321-427f-aa17-267ca6975798 --query accessToken -o tsv$headers = @{ Authorization = "Bearer $token" }$uri = "https://dev.azure.com/$org/$project/_apis/build/builds/$buildId/logs?api-version=7.1-preview.2&`$format=zip"Invoke-WebRequest -Uri $uri -Headers $headers -OutFile "$env:TEMP\build-$buildId-logs.zip"Expand-Archive -Path "$env:TEMP\build-$buildId-logs.zip" -DestinationPath "$env:TEMP\build-$buildId-logs" -Force# List largest logsGet-ChildItem "$env:TEMP\build-$buildId-logs" | Sort-Object Length -Descending | Select-Object -First 10
$config = Get-Content .github/deploy.json | ConvertFrom-Json
$org = ($config.ADOOrg -replace 'https://dev.azure.com/', '')
$project = $config.ADOProject
$pipelineId = 45$buildId = (az pipelines runs list --org "https://dev.azure.com/$org" --project $project --pipeline-ids $pipelineId --top 1 --query-order QueueTimeDesc --query "[0].id" -o tsv)$token = az account get-access-token --resource 499b84ac-1321-427f-aa17-267ca6975798 --query accessToken -o tsv$logs = Invoke-RestMethod -Uri "https://dev.azure.com/$org/$project/_apis/build/builds/$buildId/logs?api-version=7.1-preview.2" -Headers @{Authorization="Bearer $token"}$largestLog = $logs.value | Sort-Object lineCount -Descending | Select-Object -First 1Invoke-RestMethod -Uri "https://dev.azure.com/$org/$project/_apis/build/builds/$buildId/logs/$($largestLog.id)?api-version=7.1-preview.2" -Headers @{Authorization="Bearer $token"} | Out-File "$env:TEMP\latest-error.txt"Get-Content "$env:TEMP\latest-error.txt" | Select-String "error|Error|##\[error\]" -Context 3
499b84ac-1321-427f-aa17-267ca6975798 is Azure DevOps Entra ID resource.github/deploy.json