From b4880a512168b65d8d10f194a1215be80c1fedfa Mon Sep 17 00:00:00 2001 From: UrinrinogheneOmughelli <149425821+microsoftuser64@users.noreply.github.com> Date: Wed, 24 Jul 2024 03:00:36 -0500 Subject: [PATCH 1/4] Update Update-AzVmssInstance.md This change is proposed due to a change request by a customer from a case that I worked on as the Microsoft Azure Support Engineer. The customer submitted was VMSS update failure case to Azure Support. The case included an error message that stated that there was a "Conflict with concurrent request". The Cx used the parameters in this document to apply the updates to their VMSS instances. After some technical analysis with their cloud solution architect, it was the discovered that the -AsJob parameter in their commands was causing this error since the jobs were being asynchronously executed as background jobs and throws this concurrent request conflict error. I believe it would be good to state this in this documentation to help other Azure users prevent this error from occurring and resulting in an unhealthy VMSS instance. The customer also made this document update request. Here is a sample of the command that the customer was running: $VMSS = Get-AzVmssVM -ResourceGroupName "myResourceGroup" -VmScaleSetName "myScaleSet" foreach ($bi in $VMSS) { Update-AzVmssInstance -ResourceGroupName "myResourceGroup" -VMScaleSetName "myScaleSet" -InstanceId "myInstanceID" -AsJob | Out-Null } Thanks! --- .../Compute/help/Update-AzVmssInstance.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Compute/Compute/help/Update-AzVmssInstance.md b/src/Compute/Compute/help/Update-AzVmssInstance.md index e1e49c190b22..f0a7f59e19dc 100644 --- a/src/Compute/Compute/help/Update-AzVmssInstance.md +++ b/src/Compute/Compute/help/Update-AzVmssInstance.md @@ -47,7 +47,24 @@ Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False + ``` +> [!WARNING] +> Avoid using AsJob in a foreach loop as it can cause a "**Conflict with Concurrent Request**" error causing some instance updates in the scale set to fail and the health status of the instances to state "unhealthy". +
+An example of where the "-AsJob" is used in the foreach loop is shown below: + + + ```powershell + $VMSS = Get-AzVmssVM -ResourceGroupName "myResourceGroup" -VmScaleSetName "myScaleSet" + foreach ($bi in $VMSS) + { + Update-AzVmssInstance -ResourceGroupName "myResourceGroup" -VMScaleSetName "myScaleSet" -InstanceId "myInstanceID" -AsJob + } + ``` +This "-AsJob" parameter must be removed, if foreach loops are used, to avoid error messages and failure of the VMSS update. +
+ ### -DefaultProfile The credentials, account, tenant, and subscription used for communication with azure. From 2f108c70140bd3c3cf9cbb41e7a3af1e7bc9f7f6 Mon Sep 17 00:00:00 2001 From: Lei jin Date: Wed, 4 Sep 2024 13:56:51 +0800 Subject: [PATCH 2/4] Try to fix static analysis error --- .../Compute/help/Update-AzVmssInstance.md | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Compute/Compute/help/Update-AzVmssInstance.md b/src/Compute/Compute/help/Update-AzVmssInstance.md index f0a7f59e19dc..10c3fee16fd1 100644 --- a/src/Compute/Compute/help/Update-AzVmssInstance.md +++ b/src/Compute/Compute/help/Update-AzVmssInstance.md @@ -47,23 +47,7 @@ Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False - ``` -> [!WARNING] -> Avoid using AsJob in a foreach loop as it can cause a "**Conflict with Concurrent Request**" error causing some instance updates in the scale set to fail and the health status of the instances to state "unhealthy". -
-An example of where the "-AsJob" is used in the foreach loop is shown below: - - - ```powershell - $VMSS = Get-AzVmssVM -ResourceGroupName "myResourceGroup" -VmScaleSetName "myScaleSet" - foreach ($bi in $VMSS) - { - Update-AzVmssInstance -ResourceGroupName "myResourceGroup" -VMScaleSetName "myScaleSet" -InstanceId "myInstanceID" -AsJob - } - ``` -This "-AsJob" parameter must be removed, if foreach loops are used, to avoid error messages and failure of the VMSS update. -
### -DefaultProfile @@ -172,6 +156,22 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## NOTES +> [!WARNING] +> Avoid using AsJob in a foreach loop as it can cause a "**Conflict with Concurrent Request**" error causing some instance updates in the scale set to fail and the health status of the instances to state "unhealthy". +
+An example of where the "-AsJob" is used in the foreach loop is shown below: + + ```powershell + $VMSS = Get-AzVmssVM -ResourceGroupName "myResourceGroup" -VmScaleSetName "myScaleSet" + foreach ($bi in $VMSS) + { + Update-AzVmssInstance -ResourceGroupName "myResourceGroup" -VMScaleSetName "myScaleSet" -InstanceId "myInstanceID" -AsJob + } + ``` +This "-AsJob" parameter must be removed, if foreach loops are used, to avoid error messages and failure of the VMSS update. +
+ + ## RELATED LINKS [Update-AzVmss](./Update-AzVmss.md) From 2f0ea07112db9e90500934e1740a8bdb42f42227 Mon Sep 17 00:00:00 2001 From: Lei jin Date: Wed, 4 Sep 2024 13:58:18 +0800 Subject: [PATCH 3/4] Remove the empty line --- src/Compute/Compute/help/Update-AzVmssInstance.md | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Compute/Compute/help/Update-AzVmssInstance.md b/src/Compute/Compute/help/Update-AzVmssInstance.md index 10c3fee16fd1..65c1be712028 100644 --- a/src/Compute/Compute/help/Update-AzVmssInstance.md +++ b/src/Compute/Compute/help/Update-AzVmssInstance.md @@ -49,7 +49,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` - ### -DefaultProfile The credentials, account, tenant, and subscription used for communication with azure. From 37af01e4095b27e21df518921c162234c9f7a7bf Mon Sep 17 00:00:00 2001 From: Lei jin Date: Wed, 4 Sep 2024 14:00:48 +0800 Subject: [PATCH 4/4] Remove the empty line --- src/Compute/Compute/help/Update-AzVmssInstance.md | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Compute/Compute/help/Update-AzVmssInstance.md b/src/Compute/Compute/help/Update-AzVmssInstance.md index 65c1be712028..1f5e608d67c2 100644 --- a/src/Compute/Compute/help/Update-AzVmssInstance.md +++ b/src/Compute/Compute/help/Update-AzVmssInstance.md @@ -170,7 +170,6 @@ An example of where the "-AsJob" is used in the foreach loop is shown below: This "-AsJob" parameter must be removed, if foreach loops are used, to avoid error messages and failure of the VMSS update.
- ## RELATED LINKS [Update-AzVmss](./Update-AzVmss.md)