2016-11-15 31 views
0

PDFファイルを作成し、そのファイルをAzure Blob StorageにアップロードするAzure Web Job(WebAppに付属のシンプルなもの)としてpowershellスクリプトを実行しようとしています。Azure WebJob Powershellスクリプトを使用してAzure Blobストレージにファイルをアップロードする

$pdfFileName = $reportId + ".pdf"; 
$storageAccountName = "MY-STORE" 
$storageAccountKey = "MY-KEY" 
$containerName = "_MY_CONTAINER" 
$fullFileName = $PSScriptRoot + "\" + $pdfFileName 

$ctx = New-AzureStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $storageAccountKey 
Set-AzureStorageBlobContent -File "$fullFileName" -Container $containerName -Blob $pdfFileName -Context $ctx -Force 

私は(クーズーポータル内)のAzureのWebジョブログに表示されるメッセージを以下している結果:ファイルが正常に次のコマンドを使用して、ファイルのアップロード中にエラーが発生したときに作成されます。

[11/15/2016 15:20:24 > 89499f: ERR ] Set-AzureStorageBlobContent : Win32 internal error "The handle is invalid" 0x6 
[11/15/2016 15:20:24 > 89499f: ERR ] occurred while reading the console output buffer. Contact Microsoft Customer 
[11/15/2016 15:20:24 > 89499f: ERR ] Support Services. 
[11/15/2016 15:20:24 > 89499f: ERR ] At 
[11/15/2016 15:20:24 > 89499f: ERR ] D:\local\Temp\jobs\triggered\ddd\orgmoz1g.dqi\generateAndUploadReports.ps1:53 
[11/15/2016 15:20:24 > 89499f: ERR ] char:3 
[11/15/2016 15:20:24 > 89499f: ERR ] +  Set-AzureStorageBlobContent -File $fullFileName -Container 
[11/15/2016 15:20:24 > 89499f: ERR ] $containerName -Blo ... 
[11/15/2016 15:20:24 > 89499f: ERR ] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
[11/15/2016 15:20:24 > 89499f: ERR ] ~~~~~~ 
[11/15/2016 15:20:24 > 89499f: ERR ]  + CategoryInfo   : ReadError: (:) [Set-AzureStorageBlobContent], Ho 
[11/15/2016 15:20:24 > 89499f: ERR ] stException 
[11/15/2016 15:20:24 > 89499f: ERR ]  + FullyQualifiedErrorId : ReadConsoleOutput,Microsoft.WindowsAzure.Command 
[11/15/2016 15:20:24 > 89499f: ERR ] s.Storage.Blob.SetAzureBlobContentCommand 

同じスクリプトがローカルマシンで正常に動作します。 Get-Module -ListAvailable私は次のものを持つモジュールも受け取りました。

... 
[11/15/2016 15:40:36 > 89499f: INFO] ModuleType Version Name        ExportedCommands  
[11/15/2016 15:40:36 > 89499f: INFO] ---------- ------- ----        ----------------  
[11/15/2016 15:40:36 > 89499f: INFO] Manifest 1.4.0  Azure        {Get-AzureAutomati... 
... 
[11/15/2016 15:40:36 > 89499f: INFO] ModuleType Version Name        ExportedCommands  
[11/15/2016 15:40:36 > 89499f: INFO] ---------- ------- ----        ----------------  
[11/15/2016 15:40:36 > 89499f: INFO] Manifest 1.1.2  Azure.Storage      {Get-AzureStorageB... 
... 

答えて

1

あなたの説明によれば、問題を再現できました。いくつかの試行の後、長時間実行されている操作中にUIに進捗インジケータを提供するのはPowerShell Progress Indicatorsであると仮定しました。あなたはSet-AzureStorageBlobContentを呼び出す前に、次のコマンドを実行してパワーシェルで進行状況インジケーターを無効にしようとすることができます:

$ProgressPreference="SilentlyContinue"

+0

理由は、プログレスバーがシェルのリモートのWeb UIに投影することができないということです、毎回あなたを無効にしてくださいSCM WebベースのPSコンソールに更新またはナビゲートします。この問題を参照してください:https://github.com/projectkudu/kudu/issues/2172 –

+0

Bruceが提案したソリューションは、私が探していたものです。今はすべて正常に動作します。ありがとう。 –

関連する問題