Hi @Kumar, Pratiyush,
I am able to send the WebJob logs from App Service to Storage Account from Azure CLI.
- You need Username and password from the publishing profile.
Run the below command to get the Publish profile credentials.
az webapp deployment list-publishing-profiles --name AppInsights2025 --resource-group RGName --output json
- Next run this command by copying the UserName and Password from the above output.
and get the Kudu VFS URL
from the Web Job Web Hook properties
OR from the log file URL.
curl -u "UName:Pwd" "https://appinsights2025****.scm.canadacentral-01.azurewebsites.net/vfs/data/jobs/continuous/DaaS/job_log.txt" --output job_log.txt
- Then, run the
az storage blob upload
command to upload file to Container.
az storage blob upload --account-name StorageAccName --container-name ContainerName --file job_log.txt --name "webjoblogs /DaaS-log.txt"
A folder with name webjoblogs
and Daas prefix txt file will be created in the specified container.
download and check the logs.
As you want to automate this process(script), you can schedule a job in the Run book.Run only the below commands while scheduling.
First command will get the latest file (at specified time).And the second command uploads the file to container.
curl -u "UName:Pwd" "https://appins***.scm.canadacentral-01.azurewebsites.net/vfs/data/jobs/continuous/DaaS/job_log.txt" --output job_log.txt
az storage blob upload --account-name SAName --container-name ContainerName --file FilePath --name BlobName
Refer this MSDoc to schedule a Script in Run Book.
Hope this helps
If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions, please reply back