Reputation: 1252
I have around 10 jobs running in azure daily basis, so I need a total report of the jobs. For this I need to read logs using power shell. Please help me out regarding powershell commands.
Upvotes: 2
Views: 472
Reputation: 24529
If Rest API is acceptable, we could use the following code to get individual log and then combine them together.
The following is an example how to get a continuous job log
$website = Get-AzureWebsite -Name "WebsiteName"
$username = $website.PublishingUsername
$password = $website.PublishingPassword
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username,$password)))
$apiBaseUrl = "https://$($website.Name).scm.azurewebsites.net/vfs/data/jobs/continuous/{jobname}/job_log.txt"
$kuduVersion = Invoke-RestMethod -Uri "$apiBaseUrl" -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -Method GET
Upvotes: 1