Skip to content

Commit 00183df

Browse files
haaghavidai-msft
andauthored
[Compute] Changes to Set-azVmOperatingSystem (#22160)
* Set-azvmoperatingsystem changes * changelog * Update ChangeLog.md --------- Co-authored-by: Vincent Dai <[email protected]>
1 parent e6de049 commit 00183df

File tree

4 files changed

+25
-24
lines changed

4 files changed

+25
-24
lines changed

src/Compute/Compute/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
* Added a message to the user when they provide an outdated image alias to `New-AzVM` via the `-Image` parameter or to `New-AzVmss` via the `-ImageName` parameter.
2828
The non-versioned image aliases are being updated to versioned values in October 2023, and this message is to help urge customers to use the newer versioned image alias values.
2929
* Changed the installation behavior for the `GuestAttestation` extension in `New-AzVM` and `New-AzVmss` to set the property `EnableAutomaticUpgrade` to true.
30+
* Changes to `Set-AzVMOperatingSyste` to correct unnecessary mandatory paramaters.
3031

3132
## Version 6.0.0
3233
* Added new switch parameter `OSImageScheduledEventEnabled` and string parameter `OSImageScheduledEventNotBeforeTimeoutInMinutes` to the cmdlets `New-AzVmssConfig` and `Update-AzVmss`.

src/Compute/Compute/VirtualMachine/Config/SetAzureVMOperatingSystemCommand.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,25 +51,25 @@ public class SetAzureVMOperatingSystemCommand : Microsoft.Azure.Commands.Resourc
5151

5252
[Parameter(
5353
ParameterSetName = WindowsParamSet,
54-
Mandatory = true,
54+
Mandatory = false,
5555
Position = 1,
5656
ValueFromPipelineByPropertyName = true,
5757
HelpMessage = "Windows")]
5858
[Parameter(
5959
ParameterSetName = WinRmHttpsParamSet,
60-
Mandatory = true,
60+
Mandatory = false,
6161
Position = 1,
6262
ValueFromPipelineByPropertyName = true,
6363
HelpMessage = "Windows")]
6464
[Parameter(
6565
ParameterSetName = WindowsDisableVMAgentParamSet,
66-
Mandatory = true,
66+
Mandatory = false,
6767
Position = 1,
6868
ValueFromPipelineByPropertyName = true,
6969
HelpMessage = "Windows")]
7070
[Parameter(
7171
ParameterSetName = WindowsDisableVMAgentWinRmHttpsParamSet,
72-
Mandatory = true,
72+
Mandatory = false,
7373
Position = 1,
7474
ValueFromPipelineByPropertyName = true,
7575
HelpMessage = "Windows")]
@@ -78,23 +78,23 @@ public class SetAzureVMOperatingSystemCommand : Microsoft.Azure.Commands.Resourc
7878

7979
[Parameter(
8080
ParameterSetName = LinuxParamSet,
81-
Mandatory = true,
81+
Mandatory = false,
8282
Position = 1,
8383
ValueFromPipelineByPropertyName = true,
8484
HelpMessage = "Linux")]
8585
[ValidateNotNullOrEmpty]
8686
public SwitchParameter Linux { get; set; }
8787

8888
[Parameter(
89-
Mandatory = true,
89+
Mandatory = false,
9090
Position = 2,
9191
ValueFromPipelineByPropertyName = true,
9292
HelpMessage = HelpMessages.VMComputerName)]
9393
[ValidateNotNullOrEmpty]
9494
public string ComputerName { get; set; }
9595

9696
[Parameter(
97-
Mandatory = true,
97+
Mandatory = false,
9898
Position = 3,
9999
ValueFromPipelineByPropertyName = true,
100100
HelpMessage = HelpMessages.VMCredential)]

src/Compute/Compute/help/Az.Compute.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ Configures the DSC extension on a virtual machine.
618618
Updates extension properties or adds an extension to a virtual machine.
619619

620620
### [Set-AzVMOperatingSystem](Set-AzVMOperatingSystem.md)
621-
Sets operating system properties during the creation of a new virtual machine.
621+
Sets operating system properties during the creation of a new virtual machine or updating a virtual machine.
622622

623623
### [Set-AzVMOSDisk](Set-AzVMOSDisk.md)
624624
Sets the operating system disk properties on a virtual machine.

src/Compute/Compute/help/Set-AzVMOperatingSystem.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,49 +9,49 @@ schema: 2.0.0
99
# Set-AzVMOperatingSystem
1010

1111
## SYNOPSIS
12-
Sets operating system properties during the creation of a new virtual machine.
12+
Sets operating system properties during the creation of a new virtual machine or updating a virtual machine.
1313

1414
## SYNTAX
1515

1616
### Windows (Default)
1717
```
18-
Set-AzVMOperatingSystem [-VM] <PSVirtualMachine> [-Windows] [-ComputerName] <String>
19-
[-Credential] <PSCredential> [[-CustomData] <String>] [-ProvisionVMAgent] [-EnableAutoUpdate]
18+
Set-AzVMOperatingSystem [-VM] <PSVirtualMachine> [-Windows] [[-ComputerName] <String>]
19+
[[-Credential] <PSCredential>] [[-CustomData] <String>] [-ProvisionVMAgent] [-EnableAutoUpdate]
2020
[[-TimeZone] <String>] [-WinRMHttp] [-PatchMode <String>] [-EnableHotpatching] [-AssessmentMode <String>]
2121
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
2222
```
2323

2424
### WindowsWinRmHttps
2525
```
26-
Set-AzVMOperatingSystem [-VM] <PSVirtualMachine> [-Windows] [-ComputerName] <String>
27-
[-Credential] <PSCredential> [[-CustomData] <String>] [-ProvisionVMAgent] [-EnableAutoUpdate]
26+
Set-AzVMOperatingSystem [-VM] <PSVirtualMachine> [-Windows] [[-ComputerName] <String>]
27+
[[-Credential] <PSCredential>] [[-CustomData] <String>] [-ProvisionVMAgent] [-EnableAutoUpdate]
2828
[[-TimeZone] <String>] [-WinRMHttp] [-WinRMHttps] [-WinRMCertificateUrl] <Uri> [-PatchMode <String>]
2929
[-EnableHotpatching] [-AssessmentMode <String>] [-DefaultProfile <IAzureContextContainer>]
3030
[<CommonParameters>]
3131
```
3232

3333
### WindowsDisableVMAgent
3434
```
35-
Set-AzVMOperatingSystem [-VM] <PSVirtualMachine> [-Windows] [-ComputerName] <String>
36-
[-Credential] <PSCredential> [[-CustomData] <String>] [-DisableVMAgent] [-EnableAutoUpdate]
35+
Set-AzVMOperatingSystem [-VM] <PSVirtualMachine> [-Windows] [[-ComputerName] <String>]
36+
[[-Credential] <PSCredential>] [[-CustomData] <String>] [-DisableVMAgent] [-EnableAutoUpdate]
3737
[[-TimeZone] <String>] [-WinRMHttp] [-PatchMode <String>] [-EnableHotpatching] [-AssessmentMode <String>]
3838
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
3939
```
4040

4141
### WindowsDisableVMAgentWinRmHttps
4242
```
43-
Set-AzVMOperatingSystem [-VM] <PSVirtualMachine> [-Windows] [-ComputerName] <String>
44-
[-Credential] <PSCredential> [[-CustomData] <String>] [-DisableVMAgent] [-EnableAutoUpdate]
43+
Set-AzVMOperatingSystem [-VM] <PSVirtualMachine> [-Windows] [[-ComputerName] <String>]
44+
[[-Credential] <PSCredential>] [[-CustomData] <String>] [-DisableVMAgent] [-EnableAutoUpdate]
4545
[[-TimeZone] <String>] [-WinRMHttp] [-WinRMHttps] [-WinRMCertificateUrl] <Uri> [-PatchMode <String>]
4646
[-EnableHotpatching] [-AssessmentMode <String>] [-DefaultProfile <IAzureContextContainer>]
4747
[<CommonParameters>]
4848
```
4949

5050
### Linux
5151
```
52-
Set-AzVMOperatingSystem [-VM] <PSVirtualMachine> [-Linux] [-ComputerName] <String> [-Credential] <PSCredential>
53-
[[-CustomData] <String>] [-PatchMode <String>] [-DisablePasswordAuthentication] [-AssessmentMode <String>]
54-
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
52+
Set-AzVMOperatingSystem [-VM] <PSVirtualMachine> [-Linux] [[-ComputerName] <String>]
53+
[[-Credential] <PSCredential>] [[-CustomData] <String>] [-PatchMode <String>] [-DisablePasswordAuthentication]
54+
[-AssessmentMode <String>] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
5555
```
5656

5757
## DESCRIPTION
@@ -167,7 +167,7 @@ Type: System.String
167167
Parameter Sets: (All)
168168
Aliases:
169169

170-
Required: True
170+
Required: False
171171
Position: 2
172172
Default value: None
173173
Accept pipeline input: True (ByPropertyName)
@@ -184,7 +184,7 @@ Type: System.Management.Automation.PSCredential
184184
Parameter Sets: (All)
185185
Aliases:
186186
187-
Required: True
187+
Required: False
188188
Position: 3
189189
Default value: None
190190
Accept pipeline input: True (ByPropertyName)
@@ -291,7 +291,7 @@ Type: System.Management.Automation.SwitchParameter
291291
Parameter Sets: Linux
292292
Aliases:
293293
294-
Required: True
294+
Required: False
295295
Position: 1
296296
Default value: None
297297
Accept pipeline input: True (ByPropertyName)
@@ -374,7 +374,7 @@ Type: System.Management.Automation.SwitchParameter
374374
Parameter Sets: Windows, WindowsWinRmHttps, WindowsDisableVMAgent, WindowsDisableVMAgentWinRmHttps
375375
Aliases:
376376
377-
Required: True
377+
Required: False
378378
Position: 1
379379
Default value: None
380380
Accept pipeline input: True (ByPropertyName)

0 commit comments

Comments
 (0)