diff --git a/.github/agents/ps-cmdlet.agent.md b/.github/agents/ps-cmdlet.agent.md new file mode 100644 index 000000000000..97d138ac6748 --- /dev/null +++ b/.github/agents/ps-cmdlet.agent.md @@ -0,0 +1,75 @@ +--- +name: PowerShell Pull Request Agent +description: Specialized agent for creating PowerShell pull requests based on a design request +--- + +The user is going to ask you to implement a new feature in existing C# code for a Powershell cmdlet. You will write tests, make code changes, add help docs, and add changelog. +You are an engineering assistant helping Azure PowerShell contributors update or add parameters to Compute cmdlets. Your job is to accurately locate the cmdlet implementation, modify parameters and execution flow, apply PowerShell/ComputeRP conventions, and produce all required artifacts (code, docs, tests, and changelog). Prioritize correctness, least-risk edits, and traceability. + +# Scope +- Module: Azure PowerShell Compute +- Cmdlet files live under `src/Compute/Compute/**` +- You will read and reason about C# cmdlet sources, strategy classes, model classes, and test assets + +# Objectives +1) Identify the correct cmdlet file and confirm the cmdlet mapping. +2) Add or modify parameters with proper metadata and mapping. +3) Update all required files (code, help, tests, changelog). + +# Ground Truth & Location Rules +- Primary cmdlet implementation: `src/Compute/Compute/…/.cs` + - Example: `New-AzVM` → `NewAzureVMCommand.cs` +- Confirm mapping via `[Cmdlet("Verb", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "Noun", ...)]` + - Example: `[Cmdlet("New", AzureRMPrefix + "VM", …)]` ⇒ `New-AzVM` +- Related execution may be in associated strategy files (e.g., `VirtualMachineStrategy.cs`) +- Model classes representing Swagger schema live in: `src/Compute/Compute/Models/.cs` + +# Parameter Authoring Rules +- Parameters are usually declared at the top of the cmdlet C# file. +- Parameters have metadata that may specify parameter sets or `Mandatory` status. +- **Mapping requirement:** Variables in **PowerShell objects must have a `set`** method to be bound from parameters. Follow the structure of existing parameters +- Keep parameter names, types, and sets consistent with the cmdlet design + +# Execution Flow Rules +- `ExecuteCmdlet()` implements logic per **parameter set** (usually via `switch`). +- `DefaultExecuteCmdlet()` handles **DefaultParameterSet**. +- Additional methods (e.g., `CreateConfigAsync()`) may be invoked directly or via a `*Strategy` file. +- **Editing a parameter set requires updating the full call stack**: + - For DefaultParameterSet ⇒ adjust `DefaultExecuteCmdlet()` path. + - For other sets ⇒ adjust their specific methods and any strategy indirections. + - Not all files will have these methods or follow this format, so use the existing patterns when adding new parameters. + +# Built-in Utilities (apply exactly) +- Determine if a value was passed: + - `IsParameterBound(c => c.)` + +- If required details are missing, make a comment and request clarification from the owning team. + +# Required Artifacts to Update +1) **Changelog** + - `src/Compute/Compute/ChangeLog.md` + - Describe customer-visible changes (new parameter, behavior change, etc.). +2) **Model Class** (Swagger mapping) + - `src/Compute/Compute/Models/.cs` + - Add/adjust properties to represent the API schema. +3) **Cmdlet Implementation** + - `src/Compute/Compute//…/.cs` + - Add/modify parameters, validation, binding, and execution paths. + - If code is split, also update related files (e.g., `NewAzureVMCommand.cs`, `VirtualMachineStrategy.cs`). +4) **Help Content** + - `src/Compute/Compute/help/.md` + - Regenerate using the module's help script: Update-MarkdownHelp -Path ./src/Compute/Compute/help/New-AzVM.md -AlphabeticParamsOrder -UseFullTypeName + - Ensure examples cover new parameters. +5) **Tests** + - PowerShell scenario test: `src/Compute/Compute.Test/ScenarioTests/.ps1` + - C# test reference: `src/Compute/Compute.Test/ScenarioTests/.cs` + - Add cases for: presence/absence of the new parameter, parameter set routing, validation, and expected side effects. Use existing tests for reference on how to create new tests. + +# Quality & Safety Checklist (enforce before finalizing) +- Cmdlet attribute matches `-Az` and correct parameter sets. +- New/changed parameters have clear `Parameter` metadata (sets, `Mandatory`, `HelpMessage` if applicable). +- `ExecuteCmdlet()` routes correctly; Default vs non-default paths updated. +- `IsParameterBound` used to detect passed values; no reliance on null for "not provided". +- Help regenerated and examples verified. +- Scenario tests cover success/failure paths. +- `ChangeLog.md` describes customer-visible impact. diff --git a/src/Compute/Compute.Test/ScenarioTests/StrategiesVmssTests.cs b/src/Compute/Compute.Test/ScenarioTests/StrategiesVmssTests.cs index dcda2e463a44..30c6c19cd85a 100644 --- a/src/Compute/Compute.Test/ScenarioTests/StrategiesVmssTests.cs +++ b/src/Compute/Compute.Test/ScenarioTests/StrategiesVmssTests.cs @@ -137,5 +137,19 @@ public void SimpleNewVmssSkipExtOverprovision() { TestRunner.RunTestScript("Test-SimpleNewVmssSkipExtOverprovision"); } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestSimpleNewVmssWithHighSpeedInterconnect() + { + TestRunner.RunTestScript("Test-SimpleNewVmssWithHighSpeedInterconnect"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestNewVmssConfigWithHighSpeedInterconnect() + { + TestRunner.RunTestScript("Test-NewVmssConfigWithHighSpeedInterconnect"); + } } } diff --git a/src/Compute/Compute.Test/ScenarioTests/StrategiesVmssTests.ps1 b/src/Compute/Compute.Test/ScenarioTests/StrategiesVmssTests.ps1 index 459adf55c85a..689dc8e94d67 100644 --- a/src/Compute/Compute.Test/ScenarioTests/StrategiesVmssTests.ps1 +++ b/src/Compute/Compute.Test/ScenarioTests/StrategiesVmssTests.ps1 @@ -551,3 +551,58 @@ function Test-SimpleNewVmssSkipExtOverprovision Clean-ResourceGroup $vmssname } } + +<# +.SYNOPSIS +Test HighSpeedInterconnectPlacement parameter for New-AzVmss +#> +function Test-SimpleNewVmssWithHighSpeedInterconnect +{ + # Setup + $vmssname = Get-ResourceName + + try + { + $username = "admin01" + $password = Get-PasswordForVM | ConvertTo-SecureString -AsPlainText -Force + $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password + [string]$domainNameLabel = "$vmssname$vmssname".tolower(); + $stnd = "Standard"; + + # Test with HighSpeedInterconnectPlacement = Trunk + New-AzVmss -Name $vmssname -Location "westus2" -Credential $cred -DomainNameLabel $domainNameLabel -SecurityType $stnd ` + -HighSpeedInterconnectPlacement "Trunk"; + $vmss = Get-AzVmss -ResourceGroupName $vmssname -Name $vmssname; + Assert-AreEqual "Trunk" $vmss.HighSpeedInterconnectPlacement; + } + finally + { + # Cleanup + Clean-ResourceGroup $vmssname + } +} + +<# +.SYNOPSIS +Test HighSpeedInterconnectPlacement parameter for New-AzVmssConfig +#> +function Test-NewVmssConfigWithHighSpeedInterconnect +{ + # Setup + $vmssname = Get-ResourceName + + try + { + # Test with HighSpeedInterconnectPlacement = None + $vmssConfig = New-AzVmssConfig -Location "westus2" -HighSpeedInterconnectPlacement "None"; + Assert-AreEqual "None" $vmssConfig.HighSpeedInterconnectPlacement; + + # Test with HighSpeedInterconnectPlacement = Trunk + $vmssConfig2 = New-AzVmssConfig -Location "westus2" -HighSpeedInterconnectPlacement "Trunk"; + Assert-AreEqual "Trunk" $vmssConfig2.HighSpeedInterconnectPlacement; + } + finally + { + # No cleanup needed for config tests + } +} diff --git a/src/Compute/Compute/ChangeLog.md b/src/Compute/Compute/ChangeLog.md index b4745072c75a..50a3d9a466bf 100644 --- a/src/Compute/Compute/ChangeLog.md +++ b/src/Compute/Compute/ChangeLog.md @@ -20,6 +20,10 @@ --> ## Upcoming Release +* Added `HighSpeedInterconnectPlacement` parameter to `New-AzVmss` and `New-AzVmssConfig` cmdlets + - Allows customers to enable or disable Infiniband network interconnect for RDMA VM sizes (Virtual Machine Scale Sets) + - Supported values: 'None' and 'Trunk' + - Requires API version 2025-04-01 or higher ## Version 11.0.0 * Improved user experience and consistency. This may introduce breaking changes. Please refer to [here](https://go.microsoft.com/fwlink/?linkid=2340249). diff --git a/src/Compute/Compute/Generated/Models/PSVirtualMachineScaleSet.cs b/src/Compute/Compute/Generated/Models/PSVirtualMachineScaleSet.cs index 174bb69541e8..585baea8e922 100644 --- a/src/Compute/Compute/Generated/Models/PSVirtualMachineScaleSet.cs +++ b/src/Compute/Compute/Generated/Models/PSVirtualMachineScaleSet.cs @@ -77,5 +77,6 @@ public string ResourceGroupName public string Etag { get; private set; } public ResiliencyPolicy ResiliencyPolicy { get; set; } + public string HighSpeedInterconnectPlacement { get; set; } } } diff --git a/src/Compute/Compute/Generated/VirtualMachineScaleSet/Config/NewAzureRmVmssConfigCommand.cs b/src/Compute/Compute/Generated/VirtualMachineScaleSet/Config/NewAzureRmVmssConfigCommand.cs index fa20ef906905..e05f543349c1 100644 --- a/src/Compute/Compute/Generated/VirtualMachineScaleSet/Config/NewAzureRmVmssConfigCommand.cs +++ b/src/Compute/Compute/Generated/VirtualMachineScaleSet/Config/NewAzureRmVmssConfigCommand.cs @@ -406,6 +406,13 @@ public partial class NewAzureRmVmssConfigCommand : Microsoft.Azure.Commands.Reso [PSArgumentCompleter("CreateBeforeDelete")] public string AutomaticZoneRebalanceBehavior { get; set; } + [Parameter( + Mandatory = false, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the high speed interconnect placement for the virtual machine scale set. Possible values are 'None' and 'Trunk'.")] + [PSArgumentCompleter("None", "Trunk")] + public string HighSpeedInterconnectPlacement { get; set; } + protected override void ProcessRecord() { if (ShouldProcess("VirtualMachineScaleSet", "New")) @@ -1145,7 +1152,8 @@ private void Run() SpotRestorePolicy = this.IsParameterBound(c => c.EnableSpotRestore) ? new SpotRestorePolicy(true, this.SpotRestoreTimeout) : null, PriorityMixPolicy = vPriorityMixPolicy, SkuProfile = vSkuProfile, - ResiliencyPolicy = vResiliencyPolicy + ResiliencyPolicy = vResiliencyPolicy, + HighSpeedInterconnectPlacement = this.IsParameterBound(c => c.HighSpeedInterconnectPlacement) ? this.HighSpeedInterconnectPlacement : null }; WriteObject(vVirtualMachineScaleSet); diff --git a/src/Compute/Compute/Manual/VirtualMachineScaleSetCreateOrUpdateMethod.cs b/src/Compute/Compute/Manual/VirtualMachineScaleSetCreateOrUpdateMethod.cs index cc6cc0aca4e0..b4ade7e2d862 100644 --- a/src/Compute/Compute/Manual/VirtualMachineScaleSetCreateOrUpdateMethod.cs +++ b/src/Compute/Compute/Manual/VirtualMachineScaleSetCreateOrUpdateMethod.cs @@ -299,6 +299,14 @@ public partial class NewAzureRmVmss : ComputeAutomationBaseCmdlet HelpMessage = "Specify whether to implicitly install the ProxyAgent Extension. This option is currently applicable only for Linux Os.")] public SwitchParameter AddProxyAgentExtension { get; set; } + [Parameter( + Mandatory = false, + ValueFromPipelineByPropertyName = true, + ParameterSetName = SimpleParameterSet, + HelpMessage = "Specifies the high speed interconnect placement for the virtual machine scale set. Possible values are 'None' and 'Trunk'.")] + [PSArgumentCompleter("None", "Trunk")] + public string HighSpeedInterconnectPlacement { get; set; } + private void ConfigureSecuritySettings() { if (SecurityType?.ToLower() == SecurityTypes.TrustedLaunch || @@ -560,7 +568,8 @@ private async Task> SimpleParameterSetNor securityPostureId: _cmdlet.SecurityPostureId, securityPostureExcludeExtension: _cmdlet.SecurityPostureExcludeExtension, enableProxyAgent: _cmdlet.EnableProxyAgent ? true : (bool?)null, - addProxyAgentExtension: _cmdlet.AddProxyAgentExtension.IsPresent ? true : (bool?)null + addProxyAgentExtension: _cmdlet.AddProxyAgentExtension.IsPresent ? true : (bool?)null, + highSpeedInterconnectPlacement: _cmdlet.IsParameterBound(c => c.HighSpeedInterconnectPlacement) ? _cmdlet.HighSpeedInterconnectPlacement : null ); } @@ -701,7 +710,8 @@ private async Task> SimpleParameterSetOrc securityPostureId: _cmdlet.SecurityPostureId, securityPostureExcludeExtension: _cmdlet.SecurityPostureExcludeExtension, enableProxyAgent: _cmdlet.EnableProxyAgent ? true : (bool?)null, - addProxyAgentExtension: _cmdlet.AddProxyAgentExtension.IsPresent ? true : (bool?)null + addProxyAgentExtension: _cmdlet.AddProxyAgentExtension.IsPresent ? true : (bool?)null, + highSpeedInterconnectPlacement: _cmdlet.IsParameterBound(c => c.HighSpeedInterconnectPlacement) ? _cmdlet.HighSpeedInterconnectPlacement : null ); } } diff --git a/src/Compute/Compute/Strategies/ComputeRp/VirtualMachineScaleSetStrategy.cs b/src/Compute/Compute/Strategies/ComputeRp/VirtualMachineScaleSetStrategy.cs index e588ab6469cc..be58385696f8 100644 --- a/src/Compute/Compute/Strategies/ComputeRp/VirtualMachineScaleSetStrategy.cs +++ b/src/Compute/Compute/Strategies/ComputeRp/VirtualMachineScaleSetStrategy.cs @@ -84,7 +84,8 @@ internal static ResourceConfig CreateVirtualMachineScale string securityPostureId = null, string[] securityPostureExcludeExtension = null, bool? enableProxyAgent = null, - bool? addProxyAgentExtension = null + bool? addProxyAgentExtension = null, + string highSpeedInterconnectPlacement = null ) => Strategy.CreateResourceConfig( resourceGroup: resourceGroup, @@ -201,7 +202,8 @@ internal static ResourceConfig CreateVirtualMachineScale AllocationStrategy = skuProfileAllocationStrategy }, DoNotRunExtensionsOnOverprovisionedVMs = doNotRunExtensionsOnOverprovisionedVMs ? true : (bool?)null, - OrchestrationMode = orchestrationMode + OrchestrationMode = orchestrationMode, + HighSpeedInterconnectPlacement = highSpeedInterconnectPlacement }; if (auxAuthHeader != null) { @@ -254,7 +256,8 @@ internal static ResourceConfig CreateVirtualMachineScale string securityPostureId = null, string[] securityPostureExcludeExtension = null, bool? enableProxyAgent = null, - bool? addProxyAgentExtension = null + bool? addProxyAgentExtension = null, + string highSpeedInterconnectPlacement = null ) => Strategy.CreateResourceConfig( resourceGroup: resourceGroup, @@ -353,7 +356,8 @@ internal static ResourceConfig CreateVirtualMachineScale AllocationStrategy = skuProfileAllocationStrategy }, DoNotRunExtensionsOnOverprovisionedVMs = doNotRunExtensionsOnOverprovisionedVMs ? true : (bool?)null, - OrchestrationMode = orchestrationMode + OrchestrationMode = orchestrationMode, + HighSpeedInterconnectPlacement = highSpeedInterconnectPlacement }; if (auxAuthHeader != null) { diff --git a/src/Compute/Compute/help/New-AzVmss.md b/src/Compute/Compute/help/New-AzVmss.md index 6663ba896e1d..10a215501a80 100644 --- a/src/Compute/Compute/help/New-AzVmss.md +++ b/src/Compute/Compute/help/New-AzVmss.md @@ -33,7 +33,8 @@ New-AzVmss [[-ResourceGroupName] ] [-VMScaleSetName] [-AsJob] [ [-BackendPoolName ] [-SystemAssignedIdentity] [-UserAssignedIdentity ] [-EnableUltraSSD] [-Zone ] [-NatBackendPort ] [-DataDiskSizeInGb ] [-ProximityPlacementGroupId ] [-HostGroupId ] - [-Priority ] [-EvictionPolicy ] [-MaxPrice ] [-ScaleInPolicy ] + [-HighSpeedInterconnectPlacement ] [-Priority ] [-EvictionPolicy ] + [-MaxPrice ] [-ScaleInPolicy ] [-SkipExtensionsOnOverprovisionedVMs] [-EncryptionAtHost] [-PlatformFaultDomainCount ] [-OrchestrationMode ] [-CapacityReservationGroupId ] [-ImageReferenceId ] [-DiskControllerType ] [-SharedGalleryImageId ] [-SecurityType ] @@ -618,6 +619,23 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -HighSpeedInterconnectPlacement +Specifies the high speed interconnect placement for the virtual machine scale set. This property allows customers to enable or disable Infiniband network interconnect for RDMA VM sizes. Possible values are: +- None: No high speed interconnect placement +- Trunk: Trunk high speed interconnect placement + +```yaml +Type: System.String +Parameter Sets: SimpleParameterSet +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + ### -IfMatch used to make a request conditional for the PUT and other non-safe methods. The server will only return the requested resources if the resource matches one of the listed ETag values. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes. diff --git a/src/Compute/Compute/help/New-AzVmssConfig.md b/src/Compute/Compute/help/New-AzVmssConfig.md index 9570feb7496f..fe9e49671a60 100644 --- a/src/Compute/Compute/help/New-AzVmssConfig.md +++ b/src/Compute/Compute/help/New-AzVmssConfig.md @@ -24,7 +24,8 @@ New-AzVmssConfig [[-Overprovision] ] [[-Location] ] [-EdgeZone [-PlanName ] [-PlanPublisher ] [-PlanProduct ] [-PlanPromotionCode ] [-RollingUpgradePolicy ] [-EnableAutomaticRepair] [-AutomaticRepairGracePeriod ] [-EnableAutomaticOSUpgrade] [-DisableAutoRollback ] [-EnableUltraSSD] [-HealthProbeId ] - [-BootDiagnostic ] [-LicenseType ] [-Priority ] [-EnableSpotRestore] + [-HighSpeedInterconnectPlacement ] [-BootDiagnostic ] [-LicenseType ] + [-Priority ] [-EnableSpotRestore] [-SpotRestoreTimeout ] [-EvictionPolicy ] [-MaxPrice ] [-TerminateScheduledEvents] [-TerminateScheduledEventNotBeforeTimeoutInMinutes ] [-ProximityPlacementGroupId ] [-ScaleInPolicy ] [-EncryptionAtHost] [-OrchestrationMode ] @@ -50,7 +51,8 @@ New-AzVmssConfig [[-Overprovision] ] [[-Location] ] [-EdgeZone [-PlanName ] [-PlanPublisher ] [-PlanProduct ] [-PlanPromotionCode ] [-RollingUpgradePolicy ] [-EnableAutomaticRepair] [-AutomaticRepairGracePeriod ] [-EnableAutomaticOSUpgrade] [-DisableAutoRollback ] [-EnableUltraSSD] [-HealthProbeId ] - [-BootDiagnostic ] [-LicenseType ] [-Priority ] [-EnableSpotRestore] + [-HighSpeedInterconnectPlacement ] [-BootDiagnostic ] [-LicenseType ] + [-Priority ] [-EnableSpotRestore] [-SpotRestoreTimeout ] [-EvictionPolicy ] [-MaxPrice ] [-TerminateScheduledEvents] [-TerminateScheduledEventNotBeforeTimeoutInMinutes ] [-ProximityPlacementGroupId ] [-ScaleInPolicy ] -IdentityType [-IdentityId ] @@ -587,6 +589,23 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -HighSpeedInterconnectPlacement +Specifies the high speed interconnect placement for the virtual machine scale set. This property allows customers to enable or disable Infiniband network interconnect for RDMA VM sizes. Possible values are: +- None: No high speed interconnect placement +- Trunk: Trunk high speed interconnect placement + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + ### -IdentityId Specifies the list of user identities associated with the virtual machine scale set. The user identity references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/identities/{identityName}'