Skip to content

New-AzResourceGroupDeployment should have a thread limit to call Deployment API. #22130

Open
@mmmbai

Description

@mmmbai

Description

We are using New-AzResourceGroupDeployment to deploy API Management services. We have found one issue that is if the API have more than 100 operations then the deployment will fail.
For example, we have create one API using raw.githubusercontent.com/microsoft/PowerBI-CSharp/master/sdk/swaggers/swagger.json which have 278 operations. When we deploy it to API Management services using New-AzResourceGroupDeployment, the deployment will take around 2 hours and finally failed.
When we goes to Resource group->Deployment, we found New-AzResourceGroupDeployment created more than 278 calls in parallel. Then it cause some of them can not have enough resource to complete and then failed with timeout. The failed deployment will have retry triggered somewhere and cause more and more resource competition. Then later some deployment failed after more than 2 hours.
The root cause is New-AzResourceGroupDeployment(or some API it called) trigger all the operations together in parallel. Can you improve this by limit the calls for deployment? I suggest in parallel call for deployment should less than 50 then to make sure the deployment have enough resource to complete the deployment.

Issue script & Debug output

New-AzResourceGroupDeployment `
    -mode incremental `
    -name ((Get-ChildItem $templateFile).BaseName + '-' + ((Get-Date).ToUniversalTime()).ToString('MMdd-HHmmss')) `
    -ResourceGRoupName $apimInstance.ResourceGroupName `
    -templatefile $templateFile.Name `
    -TemplateParameterObject $paramSet -Force

Environment data

7.x

Module versions

6.2.1

Error output

2023-06-21T17:03:30.9702421Z ##[error]5:03:30 PM - The deployment 'apimgmt01-apim-master.template-0621-144327' failed with error(s). Showing 3 out of 155 error(s).
Status Message: The resource provision operation did not complete within the allowed timeout period. (Code:ResourceDeploymentFailure)

Status Message: The resource provision operation did not complete within the allowed timeout period. (Code:ResourceDeploymentFailure)

Status Message: The resource provision operation did not complete within the allowed timeout period. (Code:ResourceDeploymentFailure)

Tasks

Preview Give feedback
No tasks being tracked yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ARM - TemplatesService AttentionThis issue is responsible by Azure service team.bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reported

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions