From fddcf5e052810ae401b5c49d8cfa7b27047e7a1c Mon Sep 17 00:00:00 2001 From: Theodore Chang Date: Thu, 23 Mar 2023 01:36:21 -0400 Subject: [PATCH] fix Remove-AzVmss bug (#21284) * update * Update ChangeLog.md --------- Co-authored-by: Theodore Chang Co-authored-by: Yabo Hu --- src/Compute/Compute/ChangeLog.md | 4 +--- .../VirtualMachineScaleSetDeleteInstancesMethod.cs | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Compute/Compute/ChangeLog.md b/src/Compute/Compute/ChangeLog.md index 052adf4c759e..15fd60814963 100644 --- a/src/Compute/Compute/ChangeLog.md +++ b/src/Compute/Compute/ChangeLog.md @@ -23,9 +23,7 @@ * Removed the image alias `CoreOS` as the publisher CoreOS no longer has any images for Azure. * Updated the names of the `openSUSE-Leap` and `SLES` aliases to `OpenSuseLeap154` and `SuseSles15SP4` respectively. Updated these aliases to point to an image that actually exists and updated the alias names to be descriptive and versioned. * Added new descriptive and versioned alias names for the Linux image aliases. -* Added `-NetworkAccessPolicy` parameter to `New-AzSnapshotUpdateConfig`. -* Added `-SharedGalleryImageId` parameter to `New-AzVM`, `New-AzVmConfig`, `New-AzVmss`, `New-AzVmssConfig`, `Update-AzVmss`, and `Set-AzVmssStorageProfile`. -* Updated `Set-AzVMDiagnosticsExtension` to correct capitalization by passing "StorageAccount" as configuration property instead of "storageAccount". +* Addressed bug in `Remove-AzVmss` to throw error when `-InstanceId` is null. [#21162] ## Version 5.6.0 * Added `-NetworkAccessPolicy` parameter to `New-AzSnapshotUpdateConfig`. diff --git a/src/Compute/Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetDeleteInstancesMethod.cs b/src/Compute/Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetDeleteInstancesMethod.cs index 6c1ccb3c8132..e8bc6bc690a1 100644 --- a/src/Compute/Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetDeleteInstancesMethod.cs +++ b/src/Compute/Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetDeleteInstancesMethod.cs @@ -52,7 +52,7 @@ public override void ExecuteCmdlet() IList instanceIds = this.InstanceId; Rest.Azure.AzureOperationResponse result = null; - if (!string.IsNullOrEmpty(resourceGroupName) && !string.IsNullOrEmpty(vmScaleSetName) && instanceIds != null) + if (!string.IsNullOrEmpty(resourceGroupName) && !string.IsNullOrEmpty(vmScaleSetName) && this.IsParameterBound(c => c.InstanceId)) { result = VirtualMachineScaleSetsClient.DeleteInstancesWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds, forceDeletion:forcedelete).GetAwaiter().GetResult(); }