Skip to content

Commit e52d1b4

Browse files
SandidomsJinLei
andauthored
Remove unusable NextLink parameter and parameter set from Get-AzVM (#21748)
* all work * Update ExampleIssues.csv * Update ExampleIssues.csv * Update BreakingChangeIssues.csv * Update GetAzureVMCommand.cs * Update BreakingChangeIssues.csv * Update VirtualMachineTests.ps1 * Update GetAzureVMCommand.cs Remove the breaking change notification --------- Co-authored-by: Jin Lei <[email protected]>
1 parent 51b49e5 commit e52d1b4

File tree

5 files changed

+6
-45
lines changed

5 files changed

+6
-45
lines changed

src/Compute/Compute.Test/ScenarioTests/VirtualMachineTests.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,6 @@ function Test-VirtualMachineList
629629
{
630630
Assert-NotNull $s2[0].Id;
631631
}
632-
Assert-ThrowsContains { $s3 = Get-AzVM -NextLink "https://www.test.com/test"; } "Unable to deserialize the response"
633632
}
634633

635634
<#
@@ -6575,4 +6574,4 @@ function Test-VirtualMachineEdgeZoneSimpleParameterSet
65756574
# Cleanup
65766575
Clean-ResourceGroup $ResourceGroup;
65776576
}
6578-
}
6577+
}

src/Compute/Compute/ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
## Upcoming Release
2323
* Added new switch parameter `OSImageScheduledEventEnabled` and string parameter `OSImageScheduledEventNotBeforeTimeoutInMinutes` to the cmdlets `New-AzVmssConfig` and `Update-AzVmss`.
2424
* Fixed an issue that `Add-AzVhd` throws `FileNotFoundException` on Windows PowerShell. [#21321]
25+
* Removed the `NextLink` parameter and parameter set from the `Get-AzVM` cmdelt.
26+
2527

2628
## Version 5.7.1
2729
* Added a breaking change warning to the `Get-AzVM` cmdlet to show that the `NextLink` parameter and parameter set will be removed in June 2023. The parameter has been non-functional for a long time.

src/Compute/Compute/VirtualMachine/Operation/GetAzureVMCommand.cs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,12 @@
2929

3030
namespace Microsoft.Azure.Commands.Compute
3131
{
32-
[GenericBreakingChange("In the June 2023 Powershell release, the NextLink parameter set will be removed. Powershell by default loops through the list of VMs returned, so the user no longer has to use this parameter set.")]
3332
[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "VM", DefaultParameterSetName = DefaultParamSet)]
3433
[OutputType(typeof(PSVirtualMachine), typeof(PSVirtualMachineInstanceView))]
3534
public class GetAzureVMCommand : VirtualMachineBaseCmdlet
3635
{
3736
protected const string DefaultParamSet = "DefaultParamSet";
3837
protected const string GetVirtualMachineInResourceGroupParamSet = "GetVirtualMachineInResourceGroupParamSet";
39-
protected const string ListNextLinkVirtualMachinesParamSet = "ListNextLinkVirtualMachinesParamSet";
4038
protected const string ListLocationVirtualMachinesParamSet = "ListLocationVirtualMachinesParamSet";
4139
protected const string GetVirtualMachineById = "GetVirtualMachineById";
4240
private const string InfoNotAvailable = "Info Not Available";
@@ -87,14 +85,6 @@ public class GetAzureVMCommand : VirtualMachineBaseCmdlet
8785
[ValidateNotNullOrEmpty]
8886
public SwitchParameter Status { get; set; }
8987

90-
[Parameter(
91-
Mandatory = true,
92-
Position = 1,
93-
ParameterSetName = ListNextLinkVirtualMachinesParamSet,
94-
ValueFromPipelineByPropertyName = true)]
95-
[ValidateNotNullOrEmpty]
96-
public Uri NextLink { get; set; }
97-
9888
[Parameter(
9989
Mandatory = false,
10090
ParameterSetName = GetVirtualMachineInResourceGroupParamSet,
@@ -112,11 +102,6 @@ public class GetAzureVMCommand : VirtualMachineBaseCmdlet
112102
ParameterSetName = GetVirtualMachineInResourceGroupParamSet,
113103
HelpMessage = "UserData for the VM, which will be Base64 encoded. Customer should not pass any secrets in here.",
114104
ValueFromPipelineByPropertyName = true)]
115-
[Parameter(
116-
Mandatory = false,
117-
ParameterSetName = ListNextLinkVirtualMachinesParamSet,
118-
HelpMessage = "UserData for the VM, which will be Base64 encoded. Customer should not pass any secrets in here.",
119-
ValueFromPipelineByPropertyName = true)]
120105
[Parameter(
121106
Mandatory = false,
122107
ParameterSetName = ListLocationVirtualMachinesParamSet,
@@ -153,12 +138,6 @@ public override void ExecuteCmdlet()
153138
this.VirtualMachineClient.ListByLocationWithHttpMessagesAsync(this.Location).GetAwaiter().GetResult(),
154139
this.VirtualMachineClient.ListByLocationNextWithHttpMessagesAsync);
155140
}
156-
else if (this.NextLink != null)
157-
{
158-
ReturnListVMObject(
159-
this.VirtualMachineClient.ListAllNextWithHttpMessagesAsync(this.NextLink.ToString()).GetAwaiter().GetResult(),
160-
this.VirtualMachineClient.ListAllNextWithHttpMessagesAsync);
161-
}
162141
else if (ShouldListBySubscription(ResourceGroupName, Name))
163142
{
164143
ReturnListVMObject(

src/Compute/Compute/help/Get-AzVM.md

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ Get-AzVM -Location <String> [-Status] [-UserData] [-DefaultProfile <IAzureContex
3131
[<CommonParameters>]
3232
```
3333

34-
### ListNextLinkVirtualMachinesParamSet
35-
```
36-
Get-AzVM [-Status] [-NextLink] <Uri> [-UserData] [-DefaultProfile <IAzureContextContainer>]
37-
[<CommonParameters>]
38-
```
39-
4034
### GetVirtualMachineById
4135
```
4236
Get-AzVM [-Status] -ResourceId <String> [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
@@ -344,21 +338,6 @@ Accept pipeline input: True (ByPropertyName)
344338
Accept wildcard characters: True
345339
```
346340
347-
### -NextLink
348-
Specifies the next link.
349-
350-
```yaml
351-
Type: System.Uri
352-
Parameter Sets: ListNextLinkVirtualMachinesParamSet
353-
Aliases:
354-
355-
Required: True
356-
Position: 1
357-
Default value: None
358-
Accept pipeline input: True (ByPropertyName)
359-
Accept wildcard characters: False
360-
```
361-
362341
### -ResourceGroupName
363342
Specifies the name of a resource group.
364343
@@ -421,7 +400,7 @@ UserData for the VM, which will be base-64 encoded. Customer should not pass any
421400
422401
```yaml
423402
Type: System.Management.Automation.SwitchParameter
424-
Parameter Sets: DefaultParamSet, GetVirtualMachineInResourceGroupParamSet, ListLocationVirtualMachinesParamSet, ListNextLinkVirtualMachinesParamSet
403+
Parameter Sets: DefaultParamSet, GetVirtualMachineInResourceGroupParamSet, ListLocationVirtualMachinesParamSet
425404
Aliases:
426405

427406
Required: False

tools/StaticAnalysis/Exceptions/Az.Compute/BreakingChangeIssues.csv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,5 @@
2626
"Az.Compute","Microsoft.Azure.Commands.Compute.Automation.GetAzureRmGalleryImageVersion","Get-AzGalleryImageVersion","0","3000","The type of property 'Source' of type 'Microsoft.Azure.Management.Compute.Models.GalleryOSDiskImage' has changed from 'Microsoft.Azure.Management.Compute.Models.GalleryArtifactVersionSource' to 'Microsoft.Azure.Management.Compute.Models.GalleryDiskImageSource'.","Change the type of property 'Source' back to 'Microsoft.Azure.Management.Compute.Models.GalleryArtifactVersionSource'."
2727
"Az.Compute","Microsoft.Azure.Commands.Compute.Automation.GetAzureRmGalleryImageVersion","Get-AzGalleryImageVersion","0","3000","The type of property 'Source' of type 'Microsoft.Azure.Management.Compute.Models.GalleryDataDiskImage' has changed from 'Microsoft.Azure.Management.Compute.Models.GalleryArtifactVersionSource' to 'Microsoft.Azure.Management.Compute.Models.GalleryDiskImageSource'.","Change the type of property 'Source' back to 'Microsoft.Azure.Management.Compute.Models.GalleryArtifactVersionSource'."
2828
"Az.Compute","Microsoft.Azure.Commands.Compute.Automation.NewAzureRmGalleryImageVersion","New-AzGalleryImageVersion","0","3000","The type of property 'Source' of type 'Microsoft.Azure.Management.Compute.Models.GalleryOSDiskImage' has changed from 'Microsoft.Azure.Management.Compute.Models.GalleryArtifactVersionSource' to 'Microsoft.Azure.Management.Compute.Models.GalleryDiskImageSource'.","Change the type of property 'Source' back to 'Microsoft.Azure.Management.Compute.Models.GalleryArtifactVersionSource'."
29+
"Az.Compute","Microsoft.Azure.Commands.Compute.GetAzureVMCommand","Get-AzVM","0","1050","The parameter set 'ListNextLinkVirtualMachinesParamSet' for cmdlet 'Get-AzVM' has been removed.","Add parameter set 'ListNextLinkVirtualMachinesParamSet' back to cmdlet 'Get-AzVM'."
30+
"Az.Compute","Microsoft.Azure.Commands.Compute.GetAzureVMCommand","Get-AzVM","0","2000","The cmdlet 'Get-AzVM' no longer supports the parameter 'NextLink' and no alias was found for the original parameter name.","Add the parameter 'NextLink' back to the cmdlet 'Get-AzVM', or add an alias to the original parameter name."

0 commit comments

Comments
 (0)