Skip to content

Commit a491957

Browse files
authored
Merge pull request Azure#9864 from hyonholee/august2
[Compute] Add VmssId to New-AzVMConfig
2 parents 212820e + a9d9a14 commit a491957

File tree

13 files changed

+50
-16
lines changed

13 files changed

+50
-16
lines changed

src/Compute/Compute.Test/Compute.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<ItemGroup>
1414
<PackageReference Include="Microsoft.Azure.Graph.RBAC" Version="3.4.0-preview" />
15-
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="28.2.0" />
15+
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="28.3.0" />
1616
<PackageReference Include="Microsoft.Azure.Management.KeyVault" Version="2.4.2" />
1717
<PackageReference Include="Microsoft.Azure.Management.Network" Version="19.14.0-preview" />
1818
</ItemGroup>

src/Compute/Compute.Test/ScenarioTests/VirtualMachineProfileTests.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ function Test-VirtualMachineProfile
2323
# VM Profile & Hardware
2424
$vmsize = 'Standard_A2';
2525
$vmname = 'pstestvm' + ((Get-Random) % 10000);
26-
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize;
26+
$vmssID = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rggroup/providers/Microsoft.Compute/virtualMachineScaleSets/testvmss"
27+
$p = New-AzVMConfig -VMName $vmname -VMSize $vmsize -VmssId $vmssID;
2728
Assert-AreEqual $p.HardwareProfile.VmSize $vmsize;
29+
Assert-AreEqual $vmssID $p.VirtualMachineScaleSet.Id;
2830

2931
# Network
3032
$ipname = 'hpfip' + ((Get-Random) % 10000);

src/Compute/Compute/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
- Additional information about change #1
2020
-->
2121
## Upcoming Release
22+
* Add VmssId to New-AzVMConfig cmdlet
2223
* Add TerminateScheduledEvents and TerminateScheduledEventNotBeforeTimeoutInMinutes parameters to New-AzVmssConfig and Update-AzVmss
2324
* Add HyperVGeneration property to VM image object
2425
* Add Host and HostGroup features

src/Compute/Compute/Compute.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<ItemGroup>
1515
<PackageReference Include="AutoMapper" Version="6.2.2" />
16-
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="28.2.0" />
16+
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="28.3.0" />
1717
<PackageReference Include="System.Security.Permissions" Version="4.5.0" />
1818
<PackageReference Include="System.ServiceModel.Primitives" Version="4.4.1" />
1919
<PackageReference Include="WindowsAzure.Storage" Version="9.3.0" />

src/Compute/Compute/Models/PSVirtualMachine.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,5 +109,8 @@ public string ResourceGroupName
109109

110110
// Gets or sets the Host
111111
public SubResource Host { get; set; }
112+
113+
// Gets or sets the VirtualMachineScaleSet
114+
public SubResource VirtualMachineScaleSet { get; set; }
112115
}
113116
}

src/Compute/Compute/VirtualMachine/Config/NewAzureVMConfigCommand.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ public class NewAzureVMConfigCommand : Microsoft.Azure.Commands.ResourceManager.
9191
HelpMessage = "The Id of Host")]
9292
public string HostId { get; set; }
9393

94+
[Parameter(
95+
ValueFromPipelineByPropertyName = true,
96+
HelpMessage = "The Id of virtual machine scale set")]
97+
public string VmssId { get; set; }
98+
9499
[Parameter(
95100
Mandatory = false,
96101
ValueFromPipelineByPropertyName = true)]
@@ -158,11 +163,16 @@ public override void ExecuteCmdlet()
158163
vm.ProximityPlacementGroup = new SubResource(this.ProximityPlacementGroupId);
159164
}
160165

161-
if (this.MyInvocation.BoundParameters.ContainsKey("HostId"))
166+
if (this.IsParameterBound(c => c.HostId))
162167
{
163168
vm.Host = new SubResource(this.HostId);
164169
}
165170

171+
if (this.IsParameterBound(c => c.VmssId))
172+
{
173+
vm.VirtualMachineScaleSet = new SubResource(this.VmssId);
174+
}
175+
166176
WriteObject(vm);
167177
}
168178
}

src/Compute/Compute/VirtualMachine/Operation/NewAzureVMCommand.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,8 @@ public void DefaultExecuteCmdlet()
534534
Identity = ComputeAutoMapperProfile.Mapper.Map<VirtualMachineIdentity>(this.VM.Identity),
535535
Zones = this.Zone ?? this.VM.Zones,
536536
ProximityPlacementGroup = this.VM.ProximityPlacementGroup,
537-
Host = this.VM.Host
537+
Host = this.VM.Host,
538+
VirtualMachineScaleSet = this.VM.VirtualMachineScaleSet
538539
};
539540

540541
Dictionary<string, List<string>> auxAuthHeader = null;

src/Compute/Compute/VirtualMachine/Operation/UpdateAzureVMCommand.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,17 @@ public override void ExecuteCmdlet()
129129
NetworkProfile = this.VM.NetworkProfile,
130130
OsProfile = this.VM.OSProfile,
131131
Plan = this.VM.Plan,
132+
LicenseType = this.VM.LicenseType,
132133
AvailabilitySet = this.VM.AvailabilitySetReference,
133134
Location = this.VM.Location,
134-
LicenseType = this.VM.LicenseType,
135135
Tags = this.Tag != null ? this.Tag.ToDictionary() : this.VM.Tags,
136136
Identity = this.AssignIdentity.IsPresent
137137
? new VirtualMachineIdentity(null, null, ResourceIdentityType.SystemAssigned, null)
138138
: ComputeAutoMapperProfile.Mapper.Map<VirtualMachineIdentity>(this.VM.Identity),
139-
Zones = (this.VM.Zones != null && this.VM.Zones.Count > 0) ? this.VM.Zones : null
139+
Zones = (this.VM.Zones != null && this.VM.Zones.Count > 0) ? this.VM.Zones : null,
140+
ProximityPlacementGroup = this.VM.ProximityPlacementGroup,
141+
Host = this.VM.Host,
142+
VirtualMachineScaleSet = this.VM.VirtualMachineScaleSet
140143
};
141144

142145
if (this.IsParameterBound(c => c.IdentityType))

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ Id : /subscriptions/00000000-0000-0000-0000-000000000000/res
9191
Name : crptestps2264host
9292
Location : eastus
9393
Tags : {"key1":"val2"}
94-
9594
```
9695

9796
This command returns the instance view of a host.

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ ResourceGroupName Name Location Tags FDCount
5454
----------------- ---- -------- ---- -------
5555
myrg01 myhostgroup01 eastus {[key1, val1]} 1
5656
myrg01 myhostgroup02 eastus {[key1, val1]} 2
57-
5857
```
5958

6059
This command returns all host groups in the given resource group.

src/Compute/Compute/help/New-AzVMConfig.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,24 @@ Creates a configurable virtual machine object.
1616
### DefaultParameterSet (Default)
1717
```
1818
New-AzVMConfig [-VMName] <String> [-VMSize] <String> [[-AvailabilitySetId] <String>] [[-LicenseType] <String>]
19-
[-Zone <String[]>] [-ProximityPlacementGroupId <String>] [-HostId <String>] [-Tags <Hashtable>]
20-
[-EnableUltraSSD] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
19+
[-Zone <String[]>] [-ProximityPlacementGroupId <String>] [-HostId <String>] [-VmssId <String>]
20+
[-Tags <Hashtable>] [-EnableUltraSSD] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
2121
```
2222

2323
### ExplicitIdentityParameterSet
2424
```
2525
New-AzVMConfig [-VMName] <String> [-VMSize] <String> [[-AvailabilitySetId] <String>] [[-LicenseType] <String>]
2626
[-IdentityType] <ResourceIdentityType> [-IdentityId <String[]>] [-Zone <String[]>]
27-
[-ProximityPlacementGroupId <String>] [-HostId <String>] [-Tags <Hashtable>] [-EnableUltraSSD]
28-
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
27+
[-ProximityPlacementGroupId <String>] [-HostId <String>] [-VmssId <String>] [-Tags <Hashtable>]
28+
[-EnableUltraSSD] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
2929
```
3030

3131
### AssignIdentityParameterSet
3232
```
3333
New-AzVMConfig [-VMName] <String> [-VMSize] <String> [[-AvailabilitySetId] <String>] [[-LicenseType] <String>]
3434
[-AssignIdentity] [-Zone <String[]>] [-ProximityPlacementGroupId <String>] [-HostId <String>]
35-
[-Tags <Hashtable>] [-EnableUltraSSD] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
35+
[-VmssId <String>] [-Tags <Hashtable>] [-EnableUltraSSD] [-DefaultProfile <IAzureContextContainer>]
36+
[<CommonParameters>]
3637
```
3738

3839
## DESCRIPTION
@@ -240,6 +241,21 @@ Accept pipeline input: True (ByPropertyName)
240241
Accept wildcard characters: False
241242
```
242243
244+
### -VmssId
245+
The Id of virtual machine scale set
246+
247+
```yaml
248+
Type: System.String
249+
Parameter Sets: (All)
250+
Aliases:
251+
252+
Required: False
253+
Position: Named
254+
Default value: None
255+
Accept pipeline input: True (ByPropertyName)
256+
Accept wildcard characters: False
257+
```
258+
243259
### -Zone
244260
Specifies the availability zone list for the virtual machine. The allowed values depend on the capabilities of the region. Allowed values will normally be 1,2,3.
245261

src/Network/Network.Test/Network.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<PackageReference Include="Microsoft.Azure.Graph.RBAC" Version="3.4.0-preview" />
1717
<PackageReference Include="Microsoft.Azure.Management.Network" Version="19.14.0-preview" />
1818
<PackageReference Include="Microsoft.Azure.Insights" Version="0.16.0-preview" />
19-
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="28.2.0" />
19+
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="28.3.0" />
2020
<PackageReference Include="Microsoft.Azure.Management.ContainerInstance" Version="2.0.0" />
2121
<PackageReference Include="Microsoft.Azure.Management.Redis" Version="4.4.1" />
2222
<PackageReference Include="Microsoft.Azure.Management.OperationalInsights" Version="0.19.0-preview" />

src/RecoveryServices/RecoveryServices.Backup.Test/RecoveryServices.Backup.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="28.2.0" />
14+
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="28.3.0" />
1515
<PackageReference Include="Microsoft.Azure.Management.Network" Version="19.14.0-preview" />
1616
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices" Version="4.2.1-preview" />
1717
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="3.1.1-preview" />

0 commit comments

Comments
 (0)