Failing with the Webjobs validation script

…衆ロ難τιáo~ 提交于 2019-12-02 20:54:19

问题


I am running the below script to validate my Webjobs whether they properly stopped or not after running my Webjobs stop and start scripts though PowerShell task in VSTS.But the below script is sometimes working properly and some times not properly.Because even after stopping my Webjobs,the validation script is saying the webjobs are not stopped.I am not sure why the script is throwing the error.I have double checked with the azure portal Whether the jobs are really stopped/started But in azure ,webjobs are stopped and started successfully but my validation script is throwing the error.Please help me on this.

Validation Script:

$ResourceGroupName="XXX"
        $AppService="XXXX"
        $Apiversion="2016-08-01"
        $errorsJobs=New-Object System.Collections.ArrayList
        $continuejobs=Get-AzureRmResource -ResourceGroupName $ResourceGroupName -ResourceName $AppService -ResourceType Microsoft.web/sites/ContinuousWebJobs -ApiVersion $Apiversion 
        foreach($webJob in $continuejobs){
Write-Host $webJob
        $status=$webJob.Properties.status
        if($status -ne "Running"){
          $errorsJobs.Add($webJob.Properties.name)
        }}
      if($errorsJobs.Count -gt 0){
    $result=$errorsJobs -join ";"
    Write-Error $result
    }

来源:https://stackoverflow.com/questions/47694580/failing-with-the-webjobs-validation-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!