Skip to content

Commit b290eb7

Browse files
committed
Update Remove- VMSS cmdlets
1 parent f18f03e commit b290eb7

15 files changed

+259
-333
lines changed

src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineScaleSetTests.ps1

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,11 @@ function Test-VirtualMachineScaleSet
128128
$imgRef = Get-DefaultCRPImage -loc $loc;
129129
$vhdContainer = "https://" + $stoname + ".blob.core.windows.net/" + $vmssName;
130130

131-
$aucComponentName="Microsoft-Windows-Shell-Setup";
132-
$aucComponentName="MicrosoftWindowsShellSetup";
133-
$aucPassName ="oobeSystem";
134-
$aucSetting = "AutoLogon";
135-
$aucContent = "<UserAccounts><AdministratorPassword><Value>password</Value><PlainText>true</PlainText></AdministratorPassword></UserAccounts>";
131+
$extname = 'csetest';
132+
$publisher = 'Microsoft.Compute';
133+
$exttype = 'BGInfo';
134+
$extver = '2.1';
135+
136136
$ipCfg = New-AzureRmVmssIPConfig -Name 'test' `
137137
-LoadBalancerInboundNatPoolsId $expectedLb.InboundNatPools[0].Id `
138138
-LoadBalancerBackendAddressPoolsId $expectedLb.BackendAddressPools[0].Id `
@@ -142,7 +142,11 @@ function Test-VirtualMachineScaleSet
142142
| Set-AzureRmVmssOSProfile -ComputerNamePrefix 'test' -AdminUsername $adminUsername -AdminPassword $adminPassword `
143143
| Set-AzureRmVmssStorageProfile -Name 'test' -OsDiskCreateOption 'FromImage' -OsDiskCaching 'None' `
144144
-ImageReferenceOffer $imgRef.Offer -ImageReferenceSku $imgRef.Skus -ImageReferenceVersion $imgRef.Version `
145-
-ImageReferencePublisher $imgRef.PublisherName -VhdContainer $vhdContainer ;
145+
-ImageReferencePublisher $imgRef.PublisherName -VhdContainer $vhdContainer `
146+
| Add-AzureRmVmssExtension -Name $extname -Publisher $publisher -Type $exttype -TypeHandlerVersion $extver -AutoUpgradeMinorVersion $true `
147+
| Remove-AzureRmVmssExtension -Name $extname `
148+
| Add-AzureRmVmssNetworkInterfaceConfiguration -Name 'test2' -IPConfiguration $ipCfg `
149+
| Remove-AzureRmVmssNetworkInterfaceConfiguration -Name 'test2';
146150

147151
$st = New-AzureRmVmss -ResourceGroupName $rgname -Name $vmssName -VirtualMachineScaleSet $vmss;
148152

@@ -341,6 +345,8 @@ function Test-VirtualMachineScaleSetReimageUpdate
341345
$exttype = 'BGInfo';
342346
$extver = '2.1';
343347

348+
$extname2 = 'csetest2';
349+
344350
$ipCfg = New-AzureRmVmssIPConfig -Name 'test' -SubnetId $subnetId;
345351
$vmss = New-AzureRmVmssConfig -Location $loc -SkuCapacity 2 -SkuName 'Standard_A0' -UpgradePolicyMode 'Manual' -NetworkInterfaceConfiguration $netCfg `
346352
| Add-AzureRmVmssNetworkInterfaceConfiguration -Name 'test' -Primary $true -IPConfiguration $ipCfg `
@@ -354,7 +360,7 @@ function Test-VirtualMachineScaleSetReimageUpdate
354360
$vmss.VirtualMachineProfile.OsProfile.WindowsConfiguration.AdditionalUnattendContent = $null;
355361
$st = New-AzureRmVmss -ResourceGroupName $rgname -Name $vmssName -VirtualMachineScaleSet $vmss;
356362

357-
$vmssInstanceViewResult = Get-AzureRmVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName -InstanceView;
363+
$vmssInstanceViewResult = Get-AzureRmVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName -InstanceView;
358364
$vmssResult = Get-AzureRmVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName;
359365
$st = Update-AzureRmVmss -ResourceGroupName $rgname -Name $vmssName -VirtualMachineScaleSet $vmssResult;
360366

src/ResourceManager/Compute/Commands.Compute.Test/SessionRecords/Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineScaleSetTests/TestVirtualMachineScaleSet.json

Lines changed: 36 additions & 36 deletions
Large diffs are not rendered by default.

src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/Config/AddAzureRmVmssAdditionalUnattendContentCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace Microsoft.Azure.Commands.Compute.Automation
3333
public class AddAzureRmVmssAdditionalUnattendContentCommand : Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet
3434
{
3535
[Parameter(
36-
Mandatory = false,
36+
Mandatory = true,
3737
Position = 0,
3838
ValueFromPipeline = true,
3939
ValueFromPipelineByPropertyName = true)]

src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/Config/AddAzureRmVmssExtensionCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace Microsoft.Azure.Commands.Compute.Automation
3333
public class AddAzureRmVmssExtensionCommand : Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet
3434
{
3535
[Parameter(
36-
Mandatory = false,
36+
Mandatory = true,
3737
Position = 0,
3838
ValueFromPipeline = true,
3939
ValueFromPipelineByPropertyName = true)]

src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/Config/AddAzureRmVmssNetworkInterfaceConfigurationCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace Microsoft.Azure.Commands.Compute.Automation
3333
public class AddAzureRmVmssNetworkInterfaceConfigurationCommand : Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet
3434
{
3535
[Parameter(
36-
Mandatory = false,
36+
Mandatory = true,
3737
Position = 0,
3838
ValueFromPipeline = true,
3939
ValueFromPipelineByPropertyName = true)]

src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/Config/AddAzureRmVmssSecretCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace Microsoft.Azure.Commands.Compute.Automation
3333
public class AddAzureRmVmssSecretCommand : Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet
3434
{
3535
[Parameter(
36-
Mandatory = false,
36+
Mandatory = true,
3737
Position = 0,
3838
ValueFromPipeline = true,
3939
ValueFromPipelineByPropertyName = true)]

src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/Config/AddAzureRmVmssSshPublicKeyCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace Microsoft.Azure.Commands.Compute.Automation
3333
public class AddAzureRmVmssSshPublicKeyCommand : Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet
3434
{
3535
[Parameter(
36-
Mandatory = false,
36+
Mandatory = true,
3737
Position = 0,
3838
ValueFromPipeline = true,
3939
ValueFromPipelineByPropertyName = true)]

src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/Config/AddAzureRmVmssWinRMListenerCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace Microsoft.Azure.Commands.Compute.Automation
3333
public class AddAzureRmVmssWinRMListenerCommand : Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet
3434
{
3535
[Parameter(
36-
Mandatory = false,
36+
Mandatory = true,
3737
Position = 0,
3838
ValueFromPipeline = true,
3939
ValueFromPipelineByPropertyName = true)]

src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/Config/RemoveAzureRmVmssExtensionCommand.cs

Lines changed: 3 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -33,60 +33,18 @@ namespace Microsoft.Azure.Commands.Compute.Automation
3333
public class RemoveAzureRmVmssExtensionCommand : Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet
3434
{
3535
[Parameter(
36-
Mandatory = false,
36+
Mandatory = true,
3737
Position = 0,
3838
ValueFromPipeline = true,
3939
ValueFromPipelineByPropertyName = true)]
4040
public VirtualMachineScaleSet VirtualMachineScaleSet { get; set; }
4141

4242
[Parameter(
43-
Mandatory = false,
43+
Mandatory = true,
4444
Position = 1,
4545
ValueFromPipelineByPropertyName = true)]
4646
public string Name { get; set; }
4747

48-
[Parameter(
49-
Mandatory = false,
50-
Position = 2,
51-
ValueFromPipelineByPropertyName = true)]
52-
public string Publisher { get; set; }
53-
54-
[Parameter(
55-
Mandatory = false,
56-
Position = 3,
57-
ValueFromPipelineByPropertyName = true)]
58-
public string Type { get; set; }
59-
60-
[Parameter(
61-
Mandatory = false,
62-
Position = 4,
63-
ValueFromPipelineByPropertyName = true)]
64-
public string TypeHandlerVersion { get; set; }
65-
66-
[Parameter(
67-
Mandatory = false,
68-
Position = 5,
69-
ValueFromPipelineByPropertyName = true)]
70-
public bool? AutoUpgradeMinorVersion { get; set; }
71-
72-
[Parameter(
73-
Mandatory = false,
74-
Position = 6,
75-
ValueFromPipelineByPropertyName = true)]
76-
public Object Setting { get; set; }
77-
78-
[Parameter(
79-
Mandatory = false,
80-
Position = 7,
81-
ValueFromPipelineByPropertyName = true)]
82-
public Object ProtectedSetting { get; set; }
83-
84-
[Parameter(
85-
Mandatory = false,
86-
Position = 8,
87-
ValueFromPipelineByPropertyName = true)]
88-
public string Id { get; set; }
89-
9048
protected override void ProcessRecord()
9149
{
9250
// VirtualMachineProfile
@@ -111,14 +69,7 @@ protected override void ProcessRecord()
11169
}
11270
var vExtensions = this.VirtualMachineScaleSet.VirtualMachineProfile.ExtensionProfile.Extensions.First
11371
(e =>
114-
(this.Name == null || e.Name == this.Name)
115-
&& (this.Publisher == null || e.Publisher == this.Publisher)
116-
&& (this.Type == null || e.Type == this.Type)
117-
&& (this.TypeHandlerVersion == null || e.TypeHandlerVersion == this.TypeHandlerVersion)
118-
&& (this.AutoUpgradeMinorVersion == null || e.AutoUpgradeMinorVersion == this.AutoUpgradeMinorVersion)
119-
&& (this.Setting == null || e.Settings == this.Setting)
120-
&& (this.ProtectedSetting == null || e.ProtectedSettings == this.ProtectedSetting)
121-
&& (this.Id == null || e.Id == this.Id)
72+
(e.Name == this.Name)
12273
);
12374

12475
if (vExtensions != null)

src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/Config/RemoveAzureRmVmssNetworkInterfaceConfigurationCommand.cs

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,36 +33,18 @@ namespace Microsoft.Azure.Commands.Compute.Automation
3333
public class RemoveAzureRmVmssNetworkInterfaceConfigurationCommand : Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet
3434
{
3535
[Parameter(
36-
Mandatory = false,
36+
Mandatory = true,
3737
Position = 0,
3838
ValueFromPipeline = true,
3939
ValueFromPipelineByPropertyName = true)]
4040
public VirtualMachineScaleSet VirtualMachineScaleSet { get; set; }
4141

4242
[Parameter(
43-
Mandatory = false,
43+
Mandatory = true,
4444
Position = 1,
4545
ValueFromPipelineByPropertyName = true)]
4646
public string Name { get; set; }
4747

48-
[Parameter(
49-
Mandatory = false,
50-
Position = 2,
51-
ValueFromPipelineByPropertyName = true)]
52-
public bool? Primary { get; set; }
53-
54-
[Parameter(
55-
Mandatory = false,
56-
Position = 3,
57-
ValueFromPipelineByPropertyName = true)]
58-
public string Id { get; set; }
59-
60-
[Parameter(
61-
Mandatory = false,
62-
Position = 4,
63-
ValueFromPipelineByPropertyName = true)]
64-
public VirtualMachineScaleSetIPConfiguration [] IpConfiguration { get; set; }
65-
6648
protected override void ProcessRecord()
6749
{
6850
// VirtualMachineProfile
@@ -87,10 +69,7 @@ protected override void ProcessRecord()
8769
}
8870
var vNetworkInterfaceConfigurations = this.VirtualMachineScaleSet.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations.First
8971
(e =>
90-
(this.Name == null || e.Name == this.Name)
91-
&& (this.Primary == null || e.Primary == this.Primary)
92-
&& (this.Id == null || e.Id == this.Id)
93-
&& (this.IpConfiguration == null || e.IpConfigurations == this.IpConfiguration)
72+
(e.Name == this.Name)
9473
);
9574

9675
if (vNetworkInterfaceConfigurations != null)

src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/Config/RemoveAzureRmVmssSecretCommand.cs

Lines changed: 0 additions & 95 deletions
This file was deleted.

0 commit comments

Comments
 (0)