簡體   English   中英

在Webjob中運行Powershell腳本

[英]Running powershell script in Webjob

我正在Azure Webjob中的Powershell腳本下運行以連接到存儲帳戶並上傳文件

Write-Output "Getting Azure storage context..."
   $storageContext = New-AzureStorageContext  -StorageAccountName "awemigcitest" -StorageAccountKey "xx+74Z81YJf373p88Emp2jKidMZ8b4/+UTLJT4Rvgqrc8IedRxkg=="

$ProgressPreference="SilentlyContinue"
   Set-AzureStorageBlobContent -Blob $azureBlobStorageFileName -File $tempFilename -Container $MigrationReportsContainerName -Context $storageContext  -Force
   Write-Output "Copied HTML file to Azure blob storage."

但是變得低於錯誤。 有什么想法嗎?

New-AzureStorageContext:設置控制台輸出緩沖區的字符屬性時,發生Win32內部錯誤“句柄無效” 0x6 [09/30/2017 06:41:20> 4db5e9:ERR]。

您正在使用的命令似乎還可以,它對本地和Azure WebJob都適用。 請檢查您的腳本是否可以在本地運行。 此外,如果可能,您可以嘗試創建一個新的WebJob來運行您的腳本,並檢查它是否可以正常工作。

Write-Output "Getting Azure storage context..."
   $storageContext = New-AzureStorageContext  -StorageAccountName "{account_name}" -StorageAccountKey "{account_key}"

$ProgressPreference="SilentlyContinue"
   Set-AzureStorageBlobContent -Blob 'source.txt' -File 'D:\home\data\jobs\continuous\FileIn.txt' -Container 'mycontainer' -Context $storageContext  -Force
   Write-Output "Copied HTML file to Azure blob storage."

Web作業日志

在此處輸入圖片說明

注意:我使用Kudu Console訪問站點文件夾並創建FileIn.txt

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM