0
votes

I have a webapp in Azure , TestApp in RG TestRG . I have created a zip for deployment and use the following powershell script

az webapp deployment source config-zip -n "TestApp" -g "TestRG" --src "c:\test\deployfile.zip"

It gives the warning

"az : Getting scm site credentials for zip deployment"

Then it says the following:

Starting zip deployment. This operation can take a while to complete ...
Deployment endpoint responded with status code 202

But after that i get a json response that it succeeded under provisioningState field.

When i navigate to the App service in Azure under Setings -WebJobs I dont see that web Job ?

Is there an issue with the powershell script ?

1
Could you please check for directory structure? To deploy a webjob, create a zip file with content structure as it will be deflated to d:\home\site\wwwroot as is - for instance, the top level folder when you open a zip file should be App_Data folder. Then, simply use zipdeploy to deploy the zip. See- This document link github.com/projectkudu/kudu/wiki/WebJobs Also check this blog link: mariankostal.com/2020/07/17/…SnehaAgrawal-MSFT

1 Answers

0
votes

Thank you SnehaAgrawal-MSFT. Posting your suggestions as answer to help other community members.

To deploy a web Job could you please check your directory structure. Try to create a zip file which will be deflated to d:\home\site\wwwroot where you will be finding a folder called App_Data once you open the ZIP file.

Below code will help yoou in deploying the Azure Web Job.

param
(
    [string] $buildOutput = $(throw "Directory with build output is required"),
    [string] $resourceGroupName = $(throw "Resource group name is required"),
    [string] $webAppName = $(throw "Web app name is required"),
    [string] $webJobName = $(throw "Web job name is required"),
    [string] $webJobType = "triggered"
)
 
$currentDir = (Get-Item .).FullName
$tempDir = "$currentDir\Temp"
$webJobDir = "$tempDir\App_Data\jobs\$webJobType\$webJobName"
 
New-Item $webJobDir -ItemType Directory
Copy-Item "$buildOutput\*" -Destination $webJobDir -Recurse
Compress-Archive -Path "$tempDir\*" -DestinationPath ".\$webJobName.zip"
Remove-Item $tempDir -Recurse -Force
 
az webapp deployment source config-zip -g $resourceGroupName -n $webAppName --src "$webJobName.zip"

 

Could you please check the Deploy Azure Web Job documentation for further information. Also check the related links in that documentation.