-1

こんにちは、特定の時間枠で powershell を使用して Azure DevOps からエクスポート ログを csv でダウンロードできるスクリプトを探しています。時間枠を入力すると、スクリプトが Azure DevOps ui から csv ファイルをダウンロードして返すように -

ここに画像の説明を入力

ここでこのスクリプトを見つけましたhttps://developercommunity.visualstudio.com/content/problem/615053/question-we-want-to-get-the-export-audit-log-using.html

ここで使用するユーザー名、パスワード、および URL がわかりません

$Username = 'domain\user'
$Password = 'password'
$Url = "https://server:8080/tfs/_api/_licenses/Export"
$Path = "D:\temp\data.csv"
$WebClient = New-Object System.Net.WebClient
$WebClient.Credentials = New-Object    
System.Net.Networkcredential($Username, $Password)
$WebClient.DownloadFile( $url, $path )

これに関するこれ以上のデータを見つけることができません

4

1 に答える 1

2

The sample you shared is download audit log form Azure DevOps Server, the url is https://{your_server}/tfs/_api/_licenses/Export, username , password are your username and password to log on to TFS. Note: Do not forget add domain name before the username.

If you are using Azure DevOps Service, you can try this REST API and power shell script to save the Audit log.

$outfile = "{Local path}"
$connectionToken="{PAT}"
$base64AuthInfo= [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($connectionToken)"))
$AuditLogURL = "https://auditservice.dev.azure.com/{organization}/_apis/audit/downloadlog?format=csv&startTime={startTime}&endTime={endTime}&api-version=6.1-preview.1" 
$AuditInfo = Invoke-RestMethod -Uri $AuditLogURL -Headers @{authorization = "Basic $base64AuthInfo"} -Method Get –OutFile $outfile

Result:

enter image description here

于 2020-10-19T03:33:02.553 に答える