Azure / Azure/azure-cli

"az webapp webjob triggered run" fails if WebJob is already running

Open
#23,596 2 comments 0 reactions 0 assignees View on GitHub
act-observability-squad Auto-Assign customer-reported Functions Service Attention Web Apps
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

**Related command**

`az webapp webjob triggered run`

**Describe the bug**

Performing `az webapp webjob triggered run ...` to run a WebJob fails if the WebJob is already running, since the Azure API returns Http 409 Conflict. This is reasonable, but annoying for my use-case. As part of a deployment, I want to make sure that a specific WebJob is run as soon as possible. This WebJob is _also_ on a timer, which causes this deployment pipeline to occasionally fail.

**To Reproduce**

1. Start a triggered WebJob in any way (Portal/Azure CLI etc)
2. While the WebJob is still running, trigger it using `az webapp webjob triggered run ...`

**Expected behavior**

Since a Http 409 Conflict response from the Azure API means that the job is already started, I would argue that the Azure CLI command has been successful. Now, I suppose that the running job could be an earlier instance of the job running, which might be unexpected, so it might be considered a breaking change to just blanket ignore if Http 409 is returned. Perhaps a switch parameter potentially named `--ignore-already-running` or something similar would be a better solution.

**Environment summary**

azure-cli 2.39.0

**Additional context**

This behavior today matches the behavior of both the new `Az` and the legacy `azurerm` PowerShell modules.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.