Bicep deployment fails because there is supposedly one still running, but isnt

I am deploying my bicep template and it errors-out with the message:

Unable to edit or replace deployment '2024-12-12T112858Z-deployment-name': previous deployment from '12/12/2024 11:32:11 AM' is still active

But this is not the case. There are no running deployments. I checked the gui in the portal and also confirmed with

$d = az deployment sub list | convertfrom-json
($d | select properties).properties.provisioningState | select $_ -Unique

which returns only

Succeeded
Failed

I basically cannot deploy anymore. What can I do to debug this? This states that deployment names must be unique, but they are in my case, that’s why I included a timestamp as prefix.

Recognized by Microsoft Azure Collective

1

Bicep deployment fails because there is supposedly one still running, but isnt

If you’re still getting the message that a deployment is in an active status, even when using a timeframe, it might be at a different scope (such as the resource group or subscription level) or associated with a different name. You can check for active deployments at the subscription, resource group, and management group levels.

Verify active deployments across all scopes using below cmdlet

 az deployment sub list --query "[].{Name:name, State:properties.provisioningState}" -o table
    
 az deployment group list --resource-group <resource-group-name> --query "[].{Name:name, State:properties.provisioningState}" -o table
    
az deployment mg list --management-group-id --query "[].{Name:name, State:properties.provisioningState}" -o table
             **AND** 
             

Check all scopes for any deployments in a running state so that if any deployment is running, you can cancel it and deploy again with UUID.

 --query "[?properties.provisioningState=='Running']"

Cancel the deployment and then execute it again with a UUID

  az deployment sub cancel --name <deployment-name>
  az deployment group cancel --resource-group <resource-group-name> --name <deployment-name>
  az deployment mg cancel --management-group-id  --name

Even though you’re adding a timestamp to the deployment name, make sure it is formatted correctly and includes a unique identifier for each deployment.

az deployment sub create --name "deployment-$(date +%Y-%m-%dT%H%M%S)" --location "eastus" --template-file ./venkat.bicep

In my case, when I add the time frame for the deployment, the deployment is created with the same name both times.

1st Deployment

2nd Deployment

To avoid duplicate names, you can use a UUID for a unique deployment name for each deployment.

az deployment sub create --name "deployment-$(uuidgen)" --location "eastus" --template-file ./venkat.bicep

After running the command, the deployment names are different each time.

1st deployment name

2nd deployment name

Recognized by Microsoft Azure Collective

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật